Programming the Microsoft Windows Driver Model

Windows 98/Me Compatibility Notes

Windows 98/Me handles some of the details surrounding device object creation and driver loading differently than Windows XP. This section explains the differences that might affect your driver. I ve already mentioned a few of these, but repetition can t hurt.

Differences in DriverEntry Call

As I indicated earlier, the DriverEntry routine receives a UNICODE_STRING argument naming the service key for the driver. In Windows XP, the string is a full registry path of the form \Registry\Machine\System\CurrentControlSet\Services\xxx (where xxx is the name of the service entry for your driver). In Windows 98/Me, however, the string is of the form System\CurrentControlSet\Services\<classname >\<instance#> (where <classname> is the class name of your device and <instance#> is an instance number such as 0000 indicating which device of that class you happen to be). You can open the key in either environment by calling ZwOpenKey, however.

DriverUnload

Windows 98/Me will call DriverUnload within a call to IoDeleteDevice that occurs within DriverEntry. You care about this only if (1) your DriverEntry function calls IoCreateDevice and then (2) decides to return an error status, whereupon it (3) cleans up by calling IoDeleteDevice.

The \GLOBAL?? Directory

Windows 98/Me doesn t understand the directory name \GLOBAL??. Consequently, you need to put symbolic link names in the \DosDevices directory. You can use \DosDevices in Windows XP also because it s a symbolic link to the \?? directory, whose (virtual) contents include \GLOBAL??.

Unimplemented Device Types

Windows 98 didn t support creating device objects for mass storage devices. These are devices with types FILE_DEVICE_DISK, FILE_DEVICE_TAPE, FILE_DEVICE_CD_ROM, and FILE_DEVICE_VIRTUAL_DISK. You can call IoCreateDevice, and it will even return with a status code of STATUS_SUCCESS, but it won t have actually created a device object or modified the PDEVICE_OBJECT variable whose address you gave as the last argument.

Категории