mcicda: How can we get STATUS_XXX in GetLastError()?

Francois Gouget fgouget at free.fr
Fri Jan 5 06:03:06 CST 2007


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.


-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
 Advice is what we ask for when we already know the answer but wish we didn't
                                 -- Eric Jong



More information about the wine-devel mailing list