PATCH: reverse return from CDROM_Verify
Alex Pasadyn
ajp at mail.utexas.edu
Wed Dec 11 21:54:02 CST 2002
The function CDROM_Verify seems to be returning the opposite of what is
expected. Along with the trivial patch I have attached a test program
that simply prints out whether or not a disc is in the drive. CVS Wine
is giving the opposite answer from Win2000. (Note that this API is not
supported on Win9x.)
Alex Pasadyn
ajp at mail.utexas.edu
ChangeLog:
- Fix return from IOCTL_CDROM_CHECK_VERIFY
-------------- next part --------------
Index: dlls/ntdll/cdrom.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/cdrom.c,v
retrieving revision 1.20
diff -u -r1.20 cdrom.c
--- dlls/ntdll/cdrom.c 13 Sep 2002 21:42:28 -0000 1.20
+++ dlls/ntdll/cdrom.c 12 Dec 2002 02:36:31 -0000
@@ -759,7 +759,7 @@
SUB_Q_CHANNEL_DATA data;
fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
- return CDROM_ReadQChannel(dev, &fmt, &data) ? 0 : 1;
+ return CDROM_ReadQChannel(dev, &fmt, &data) ? 1 : 0;
}
/******************************************************************
-------------- next part --------------
// TestCdromVerify.cpp
// To compile with MSVC: CL TestCdromVerify.cpp
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <winioctl.h>
int main (int argc, char **argv) {
HANDLE hDevice;
BOOL bPresent = false;
DWORD dwOutput;
char sDriveString[10];
if (argc<2 || strlen(argv[1])>1) {
printf("Call is\n%s x\nwhere x is the drive letter for the cdrom\n", argv[0]);
return 1;
}
sprintf(sDriveString,"\\\\.\\%s:",argv[1]);
hDevice = CreateFile(sDriveString, GENERIC_READ, FILE_SHARE_READ,
0, OPEN_EXISTING, 0, 0);
if (hDevice != INVALID_HANDLE_VALUE) {
bPresent = DeviceIoControl(hDevice, IOCTL_STORAGE_CHECK_VERIFY,
NULL, 0, NULL, 0, &dwOutput, NULL);
if (bPresent) {
printf("a CD is present in the drive\n");
} else {
printf("there is nothing in the drive or an error was encountered\n");
}
} else {
printf("error accessing drive");
}
CloseHandle(hDevice);
return 0;
}
More information about the wine-patches
mailing list