in fact DeviceIOControl is used in two completly separate ways: 1/ control VxD 2/ control "device" handles on specific types
the control on VxD is needed for Win 9x support. In that case the HIWORD of the iocontrol code is always 0. So, in that case, a lookup is made in the list of known VxD:s if wae can handle the request.
Ok. I read the "Calling DeviceIoControl on Windows 95/98/Me" MSDN page, and I now understand what it's about.
the control on "device" handles is done when the high word of the control code is non 0.
as of today (but it's a bit hacky) handles to "device" and VxD:s are viewed (in the server) as very simple objects. They only provide a
clientID (a DWORD). all the calls to DeviceIOControl start by getting
this client ID.
If the value has the bit 0x10000 set, it means it's a VxD. The low word of the client id then identifies the standard ID of the VxD.
You're refering to both VxDs and WDM (.sys) drivers, right ?
How does the server find the correct low word of the client ID ? The driver I want to implement has a device type of 0xef00 (value passed to IoCreateDevice). I added a field to the VxD table with id set to 0xef00. Does wine, when I call CreateFile( "\\.\MyDevice", ... ), check that table and set the client ID low word to the proper value ?
If the 0x20000 bit is set, it's in fact a handle a device. Driver A: through Z: are mapped to 0 to 25 values (in the low word)
Otherwise, it's a handle to the old DOS named devices (with their old IDs too)
I think we should handler those cases in a new device handler (which would just test if the device is a CDROM for now).
So, back to DeviceIoControl when the high word of the io control code is 0. We expect device handle in that case (but don't test the 0x20000 bit for error reporting), and then try to check if the device (from it's driver letter) is a CDROM, and if so apply the io control on it. Support of io
control on other types of device (hard disks, storage...) isn't done at the moment.
You mean when the high word is not 0, right ?
I'll add a check for the 0x10000 and 0x20000 bits, and will dispatch the call to either a VxD or a device handler. Is that ok ?Can I use the same VxD list as for (HIWORD(dwIoControlCode) == 0 ) ?
Laurent Pinchart