Programming the Microsoft Windows Driver Model

Windows 98/Me Compatibility Notes

Windows 98/Me uses completely different technology for installing and maintaining devices than does Windows XP. In this section, I ll describe some of the ways this might affect you.

Property Page Providers

A property page provider for a new device class must be a 16-bit DLL. Look at SAMCLS16 in the companion content if you want to see an example, and don t discard your 16-bit compiler just yet!

Installers and Co-installers

A class installer for Windows 98/Me is a 16-bit DLL and uses functions from SETUPX.DLL, which are documented in MSDN rather than in the DDK. I know of no samples to give guidance in writing one. Windows 98/Me doesn t support co-installer DLLs.

Preinstalled Driver Packages

SetupCopyOEMInf isn t implemented in Windows 98 or Windows Me. To preinstall a driver package on these platforms, simply copy the files to the correct locations and design the INF file not to require any file copies.

Digital Signatures

Windows 98 doesn t use digital signatures. Windows Me won t install an unsigned driver to replace a signed driver for audio and certain other multimedia devices or for a display adapter. The DDK describes other rules for when Windows Me uses digital signatures. I confess I couldn t understand all the qualifications and special cases, so I can t explain them to you.

Installing Drivers Programmatically

Because the Windows 98/Me setup program is 16-bit, and because Update Driver ForPlugAndPlayDevices isn t implemented in those systems, relatively heroic means are required to programmatically install a driver for a non-PnP device. I cobbled together the Windows 98/Me version of FASTINST in the companion content by trial and error because the documentation of the 16-bit setup functions is pretty sparse. The basic trick is to construct a Device Information structure for the INF file, restrict it to the driver for the decided-upon device identifier, and call DiInstallDevice. Needless to say, you ll need to get a bunch of details just right to make this process work.

CONFIGMG API

In Windows 98/Me, you often need to call entry points in the protected-mode API exported by CONFIGMG.VXD. The functions you call are documented in the Windows 95 DDK as ring-0 service calls whose names begin with CONFIGMG_. The API functions you call from ring 3 have the same names and arguments except with the prefix CM_. The SAMCLS16.DLL sample in the companion content contains a few CONFIGMG calls that illustrate the mechanics of making these calls.

INF Incompatibilities

Windows 98/Me uses parsing technology and setup libraries that are completely different from those of Windows 2000 and later systems. Consequently, there are many restrictions on how you write an INF file that will be used in both environments. Here s a partial list of them:

Registry Usage

Windows 98/Me uses a registry structure that s completely different from that of Windows XP:

To initialize the driver key, your Windows 98/Me install section should have an AddReg directive similar to this example:

[DriverInstall] AddReg=DriverAddReg <other install directives> [DriverAddReg] HKR,,DevLoader,,*ntkern HKR,,NTMPDriver,,pktdma.sys

That is, you designate NTKERN.VXD as the device loader for your device, and you designate your WDM driver as the NTMPDriver for which NTKERN looks.

Getting Device Properties

Windows 98/Me incorrectly implements IoGetDeviceProperty for the FriendlyName property. To retrieve the friendly name in a WDM driver, you should use IoOpenDeviceRegistryKey and interrogate the property by name. The DEVPROP sample illustrates how to do this.

Категории