mcicda: How can we get STATUS_XXX in GetLastError()?
Eric Pouech
eric.pouech at wanadoo.fr
Fri Jan 5 11:51:06 CST 2007
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+
More information about the wine-devel
mailing list