6. Create the driver event log registry key at HKLMSYSTEMCurrentControlSetServicesEventLogSystemAbcDriver.
Set the TypesSupported and EventMessageFile values.
7. Start the driver — see the following.
Creating or Stopping a Driver Service
1. Open the Service Control Manager using
2. Try to open your driver service using
If
If
Give the driver 10 seconds to stop, checking every second with
Close the driver service handle using
3. Create the driver service using
4. Close the Service Control Manager using
Starting a Driver
1. Open the Service Control Manager using
2. Open your driver service using
3. Get the driver run state using
4. If need be, call
Give it 10 seconds to start, checking every second with ControlService SERVICE_CONTROL_INTERROGATE.
5. Close the driver service and Service Control Manager using
In NT 3.51, NT 4, and Windows 2000 various registry entries affect the load order of drivers. While these entries can be used for WDM device drivers, the Plug and Plug enumeration process usually ensures that drivers are loaded in the right order.
Each driver can be put in a
The DependOnGroup entry in a driver's service registry key is a REG_MULTI_SZ stating which groups must be loaded before this driver. Similarly, DependOnService is a REG_MULTI_SZ listing the drivers and services that must be loaded before this driver.
The Group entry is a REG_SZ giving the driver's group name. Tag is a REG_DWORD giving the driver tag number. The HKLMSYSTEMCurrentControlSetControlGroupOrderList registry key has a REG_BINARY entry for each group. The first byte of this binary data is the tag count. The following DWORDs contain the tags of the drivers in the order that they should be loaded. Three NULL bytes pad out the binary data.
The HKLMSYSTEMCurrentControlSetControlServiceOrderList registry key has a REG_ MULTI_SZ entry called List. The strings in the list are the driver group names in the order that they should be loaded.
A driver's Start setting, shown in Table 11.4, will override all these driver loading rules.
In NT 4 and NT 3.51, the Control Panel
Figure 11.2 NT 4 Control Panel
In Windows 2000, the recommended tool for most device management tasks is the Computer Management console. This is found in the Start menu
Figure 11.3 shows the Computer Management console running on my computer with the Device Manager Devices selected. You can get this same view from the Control Panel System applet; select the Hardware tab and click on Device Manager.
You can see Wdm1 and Wdm2 devices in the 'Other Devices' (Unknown) category, along with the DebugPrint driver. Right-click on the driver name to uninstall it or update the driver from its properties box.
You can see any non-WDM drivers by right-clicking on Devices. Select View in the pop up menu. Check the 'Show hidden devices' option. The devices display now includes a 'Non-Plug and Play Drivers' category. You can start and stop the NT style drivers and change their startup options.
Figure 11.3 W2000 Computer Management console
The book software includes a small tool called
Do not try to stop a WDM driver that has a device attached. It will not work.
Figure 11.4
The familiar
The Control Panel
A quick and dirty way of installing a series of registry settings is to use .REG files. Use
Two other Windows 2000 command line tools also do the same job.
REG files help when you only have to do one or two driver installations and you do not want to write a complete installation program. Another possible use is in product support; ask a customer to use
Installing NT Style Drivers in Windows 98
It is often possible to use an NT style driver in Windows 98. The NT style PHDIo driver described in Chapters 1.5-19 can be run in Windows 98 as well as the NT and Windows 2000 x86 platforms. PHDIo is a generic driver for handling simple devices and it is useful to be able to install it in Windows 98.
The DebugPrint driver described in Chapter 14 is currently installed as a WDM Plug and Play device. However, it would be perfectly sensible for it to be installed as an NT style driver. Quite a bit of its infrastructure would change. It would not have an
Contrary to my expectations, an NT style driver can use various kernel calls that are not supposed to be available to it (e.g.,
An NT style driver can use other techniques to talk to hardware. It could attach itself to another driver device and interact with hardware that way. Alternatively, I assume that it could use the available VxDs to interact with hardware.
You have to install an NT style driver 'by hand' in Windows 98. In other words, the Add New Hardware wizard will not process an INF file nicely for you. Instead, a relatively straightforward program will be needed to copy the driver executable, set some registry values, and reboot the computer. For example, if you were trying to install a driver called
• Copy the driver executable, AbcXyz.sys, to the Windows System32Drivers directory.
• Make a new registry key HKLMSystemCurrentControl SetServicesAbcXyz, replacing AbcXyz with your driver name.
• In this registry key, set the values according to Table 11.6.
• Restart Windows 98.
Table 11.6 Windows 98 registry values