In dlls/mcicda/mcicda.c we have:
if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt, sizeof(fmt), &data, sizeof(data), &br, NULL)) { if (GetLastError() == STATUS_NO_MEDIA_IN_DEVICE) mode = MCI_MODE_OPEN;
However DeviceIoControl() does the following:
if (status) SetLastError( RtlNtStatusToDosError(status) ); return !status; }
And RtlNtStatusToDosError() converts STATUS_NO_MEDIA_IN_DEVICE to ERROR_NOT_READY. So GetLastError() cannot return STATUS_NO_MEDIA_IN_DEVICE. Or did I miss something? Maybe the right thing would be to check the return value of DeviceIoControl() rather than GetLastError()?
However, in MCICDA_GetError() we have a similar check:
static int MCICDA_GetError(WINE_MCICDAUDIO* wmcda) { switch (GetLastError()) { case STATUS_NO_MEDIA_IN_DEVICE: return MCIERR_DEVICE_NOT_READY; case STATUS_IO_DEVICE_ERROR: return MCIERR_HARDWARE; default: FIXME("Unknown mode %x\n", GetLastError()); }
Again, as far as I can see, GetLastError() cannot return these two STATUS_XXX values so this check seems wrong.
On Friday 05 January 2007 13:03, Francois Gouget wrote:
And RtlNtStatusToDosError() converts STATUS_NO_MEDIA_IN_DEVICE to ERROR_NOT_READY. So GetLastError() cannot return STATUS_NO_MEDIA_IN_DEVICE. Or did I miss something? Maybe the right thing would be to check the return value of DeviceIoControl() rather than GetLastError()?
Maybe it should call NtDeviceIoControlFile() instead of DeviceIoControl()?
-Hans
Francois Gouget a écrit :
In dlls/mcicda/mcicda.c we have:
if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt, sizeof(fmt), &data, sizeof(data), &br, NULL)) { if (GetLastError() == STATUS_NO_MEDIA_IN_DEVICE) mode = MCI_MODE_OPEN;
However DeviceIoControl() does the following:
if (status) SetLastError( RtlNtStatusToDosError(status) ); return !status;
}
And RtlNtStatusToDosError() converts STATUS_NO_MEDIA_IN_DEVICE to ERROR_NOT_READY. So GetLastError() cannot return STATUS_NO_MEDIA_IN_DEVICE. Or did I miss something? Maybe the right thing would be to check the return value of DeviceIoControl() rather than GetLastError()?
However, in MCICDA_GetError() we have a similar check:
static int MCICDA_GetError(WINE_MCICDAUDIO* wmcda) { switch (GetLastError()) { case STATUS_NO_MEDIA_IN_DEVICE: return MCIERR_DEVICE_NOT_READY; case STATUS_IO_DEVICE_ERROR: return MCIERR_HARDWARE; default: FIXME("Unknown mode %x\n", GetLastError()); }
Again, as far as I can see, GetLastError() cannot return these two STATUS_XXX values so this check seems wrong.
you're right, the NT error codes should be converted into their win32 equivalents A+