I have written a small piece of code to open/close a cd/dvd drive tray using the DeviceIoControl API and the proper IOCTL but I don't seem to be able to check the tray status.
According to the msdn page (http://msdn.microsoft.com/en-us/library/aa363404%28v=VS.85%29.aspx), IOCTL_STORAGE_CHECK_VERIFY
is supposed to succeed if the drive is loaded with a valid media and fail otherwise with an appropriate error code.
So when DeviceIoControl fails, I expected 21
as lasterror
when the tray was opened and 1112
when the tray was closed but there was no media in the device. Yet it only returns 21
until a proper media is loaded.
Did I missed something ? Is there some other way to find out the tray status ?
Best Regards,