does any one knowes how to use DeviceIoControl function, i've noticed that one of its params can be IOCTL_STORAGE_CHECK_VERIFY which my API reference explain like:
The IOCTL_STORAGE_CHECK_VERIFY DeviceIoControl operation determines whether a device's media is accessible; for example, whether the media is in the device.

i've want use this func to check if the CD-compact is in the drive and this way maybe i'll be able to do this.... finly:)

when i tried to assemble: Invoke DeviceIoControl, Eax, IOCTL_STORAGE_CHECK_VERIFY, 0, 0, 0, 0, 0, 0 i've got an error couse in windows.inc there is no definition of IOCTL_STORAGE_CHECK_VERIFY, when i google it i've found this site http://doc.ddart.net/msdn/header/include/winioctl.h.html where i found this:
#define IOCTL_STORAGE_CHECK_VERIFY     CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
and i do not know how to interpret this, i dont know C/C++ yet :(


help.... any one
Posted on 2002-02-03 08:02:51 by NEMO
I just made a C++ program and IOCTL_STORAGE_CHECK_VERIFY is defined to be 0x002d4800

MS gets this number by doing several bit shifts and ORs with other predefined things. That header you linked to contains all the defines and the macro for generating the DWORD

#define CTL_CODE( DeviceType, Function, Method, Access ) ( \
((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
)



#define FILE_DEVICE_MASS_STORAGE 0x0000002d
#define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
#define FILE_READ_ACCESS ( 0x0001 )
#define METHOD_BUFFERED 0


So the macro takes 0x0000002d as it's first parameter and shifts it 16 bits to the left ( the << means bit shift).
Access (0x0001) is shifted to the left 14 bits and Function (0x200) is shifted 2 bits. The | means OR the values together. So to get the final number OR all the shifted values and Method ( 0 ) together.

Also, be aware that in some cases, DeviceIoControl works differently on NT,2k vs 95,98, ME.
Posted on 2002-02-03 10:58:30 by Mecurius