DeviceIoControl

Eric Pouech eric.pouech at wanadoo.fr
Wed Apr 3 20:42:11 CST 2002


Laurent Pinchart a écrit :
> 
> Hi everybody,
> 
> I need to add support for a currently unsupported VxD, and I'm quite puzzled
> by the way that DeviceIoControl currently processes the device control
> requests.
> 
> DeviceIoControl starts by checking the high word of dwIoControlCode, which is
> the device type. If the device type is 0, it gets a client ID by sending a
> get_file_info request to the server, and uses the client ID as the device
> type. It then looks in the VxD table for a handler for the device type, and
> calls it if it exists. No problem with that.
> 
> If the high word of dwIoControlCode is not 0, it checks if the device is a
> CDROM (by calling GetDriveTypeA). If so, it calls CDROM_DeviceIoControl, and
> if not is just fails.

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.

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.

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)

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.

A+



More information about the wine-devel mailing list