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.
I was wondering why the same VxD table as for (HIWORD(dwIoControlCode) == 0)
wasn't used when the device type in dwIoControlCode is not 0. It seems to be
a mistake to me. I was thinking about implementing the following algorithm:
- check HIWORD(dwIoControlCode)
- if 0, deviceType = GetCliendID( Device )
- if ! 0, deviceType = HIWORD(dwIoControlCode)
- look for a VxD handler in the VxD table using the deviceType.
- call the handler if it exists, fails otherwise
This leaves out the special case for CDROM_DeviceIoControl. Could anyone
explain to me why that special check is needed, if it is ?
Thanks in advance.
Laurent Pinchart