Windows NT is designed around the concept that the first driver to claim adevice obtains ownership of that device. This ownership can be shared or itcan be exclusive; this is up to the claiming device driver. If the deviceis exclusively claimed by a device driver, any further attempts to claimthe device by subsequently loaded device drivers fail. Because of this, itis imperative that the order in which device drivers load can be modifiedby device driver authors. This article describes the two methods that youcan use to control the order in which device drivers load.
There are two methods that you can use to control the order in which devicedrivers load. Both methods take advantage of entries in the registry thatcan be found at \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control. Thefirst method is to modify the ServiceGroupOrder. The second method is to assign Tag values that determine the order of driver loading according to the GroupOrderList. The tag values start type and Group names are in the HKLM\SYSTEM\CurrentControlSet\Services\<drivername> key which must be added before the values can be listed in the Group Order List.
These two methods only work for device drivers that have a start value of0 (SERVICE_BOOT_START) or 1 (SERVICE_SYSTEM_START). In all cases, devicedrivers with a start value of 0 load before any device drivers with a startvalue of 1 attempt to load.
Method 1: ServiceGroupOrder
The ServiceGroupOrder contains a list of group names in the order that theywill be loaded. Here are the unmodified contents of ServiceGroupOrder:
SCSI CDROM class
boot file system
According to the ServiceGroupOrder, device drivers in the group "SCSIclass" load after all device drivers in the group "Primary disk" and beforedevice drivers in the group "SCSI CDROM class" load. The higher a devicedriver's group is in the list, the sooner it loads. The ServiceGroupOrderlist is scanned twice. First, all device drivers with a start value of 0load; then, all device drivers with a start value of 1 load. Thus, a devicedriver with a start value of 0 loads before any device driver with a startvalue of 1, no matter what its position on the ServiceGroupOrder list.
It is possible for the device driver author to edit the ServiceGroupOrder.By doing this, a new group can be created at any place in the list. A goodexample might be a SCSI class device driver called "SAMPLDRV" needing toload before "SCSIDISK" because SCSIDISK is claiming a device thatSAMPLDRV needs to claim. Here are SCSIDISK's registry entries:
\registry\machine\system\currentcontrolset\services\scsidisk Type = REG_DWORD 0x00000001 Start = REG_DWORD 0x00000000 Group = SCSI class ErrorControl = REG_DWORD 0x00000000 DependOnGroup = REG_MULTI_SZ "SCSI miniport"
A new group can be added to the ServiceGroupOrder called "Load MeFirst" and SAMPLDRV can have its group set to Load Me First. Here isthe modified ServiceGroupOrder:
Load Me First
SCSI CDROM class
boot file system
Here are SAMPLDRV's registry entries:
\registry\machine\system\currentcontrolset\services\sampldrv Type = REG_DWORD 0x00000001 Start = REG_DWORD 0x00000000 Group = Load Me First ErrorControl = REG_DWORD 0x00000000 DependOnGroup = REG_MULTI_SZ "SCSI miniport"
With this configuration, SAMPLDRV loads before SCSIDISK.
Method #2: GroupOrderList and Tag Values
An optional key called Tag can be included in a device driver's registry.The value of the Tag helps determine the loading order of the devicedrivers within a group. The loading order is not necessarily in numericalorder; rather, it is in the order defined by the GroupOrderList. The firstentry per group in the GroupOrderList is the number of Tag values. This isfollowed by the numerical sequence in which the Tag values are to beloaded. Device drivers in a group are first loaded according to their Tagvalue as defined by the GroupOrderList. If the device driver does not havea Tag value or if the Tag value is not in the GroupOrderList, then thesedevice drivers load after the device drivers with valid Tag values load.For these device drivers, the order of loading is not guaranteed, otherthan that all device drivers in a group load before the next group loads.
Here is a partial output of the GroupOrderList:
\registry\machine\system\currentcontrolset\control\grouporderlist Base = REG_BINARY 0d 00 00 00 01 00... Extended base = REG_BINARY 04 00 00 00 01 00... Filter = REG_BINARY 05 00 00 00 01 00... Keyboard Class = REG_BINARY 01 00 00 00 01 00... Keyboard Port = REG_BINARY 01 00 00 00 01 00... Ndis = REG_BINARY 09 00 00 00 01 00... Pointer Class = REG_BINARY 01 00 00 00 01 00... Pointer Port = REG_BINARY 03 00 00 00 01 00... . . .
NOTE: There is no value for SCSI class. Not every group is represented inthe GroupOrderList. When a group is not in the GroupOrderList, the order inwhich device drivers load within the group cannot be guaranteed.
As with the ServiceGroupOrder, the GroupOrderList can be modified. Usingthe same example as above, Tag entries for SCSI class can be added:
\registry\machine\system\currentcontrolset\control\grouporderlist SCSI class = REG_BINARY 02 00 00 00 02 00 00 00 01 00 00 00 Base = REG_BINARY 0d 00 00 00 01 00... Extended base = REG_BINARY 04 00 00 00 01 00... . . .
In this example, the group SCSI class recognizes two Tag values, 00000001and 00000002. The order in which the Tag values load is 00000002 first,followed by 00000001. If SAMPLDRV is in the SCSI class group, which isthe same as SCSIDISK, either Tag value guarantees that SAMPLDRV loadsbefore SCSIDISK because SCSIDISK has no Tag value and non-Taggeddrivers load last in a group.
If for some reason SCSIDISK is assigned a Tag value of 0x00000001,SAMPLDRV loads before SCSIDISK when SAMPLDRV is assigned a Tag valueof 00000002:
\registry\machine\system\currentcontrolset\services\sampldrv Type = REG_DWORD 0x00000001 Start = REG_DWORD 0x00000000 Group = SCSI class ErrorControl = REG_DWORD 0x00000000 DependOnGroup = REG_MULTI_SZ "SCSI miniport" Tag = REG_DWORD 0x00000002