HOWTO: Control Device Driver Load OrderLast reviewed: February 17, 1998Article ID: Q115486 |
The information in this article applies to:
SUMMARYWindows NT is designed around the concept that the first driver to claim a device obtains ownership of that device. This ownership can be shared or it can be exclusive; this is up to the claiming device driver. If the device is exclusively claimed by a device driver, any further attempts to claim the device by subsequently loaded device drivers fail. Because of this, it is imperative that the order in which device drivers load can be modified by device driver authors. This article describes the two methods that you can use to control the order in which device drivers load.
MORE INFORMATIONThere are two methods that you can use to control the order in which device drivers load. Both methods take advantage of entries in the registry that can be found at \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control. The first 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. These two methods only work for device drivers that have a start value of 0 (SERVICE_BOOT_START) or 1 (SERVICE_SYSTEM_START). In all cases, device drivers with a start value of 0 load before any device drivers with a start value of 1 attempt to load.
Method 1: ServiceGroupOrderThe ServiceGroupOrder contains a list of group names in the order that they will be loaded. Here are the unmodified contents of ServiceGroupOrder:
SCSI miniport
port
Primary disk
SCSI class
SCSI CDROM class
filter
boot file system
Base
Pointer Port
Keyboard Port
Pointer Class
Keyboard Class
Video Init
Video
Video Save
file system
Event log
Streams Drivers
NDIS
TDI
NetBIOSGroup
SpoolerGroup
According to the ServiceGroupOrder, device drivers in the group "SCSI
class" load after all device drivers in the group "Primary disk" and before
device drivers in the group "SCSI CDROM class" load. The higher a device
driver's group is in the list, the sooner it loads. The ServiceGroupOrder
list is scanned twice. First, all device drivers with a start value of 0
load; then, all device drivers with a start value of 1 load. Thus, a device
driver with a start value of 0 loads before any device driver with a start
value 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 good example might be an SCSI class device driver called "SAMPLDRV" needing to load before "SCSIDISK" because SCSIDISK is claiming a device that SAMPLDRV needs to claim. Here is 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 Me
First" and SAMPLDRV can have its group set to Load Me First. Here is
the modified ServiceGroupOrder:
SCSI miniport
port
Primary disk
Load Me First
SCSI class
SCSI CDROM class
filter
boot file system
.
.
.
Here is 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 ValuesAn 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 device drivers within a group. The loading order is not necessarily in numerical order; rather, it is in the order defined by the GroupOrderList. The first entry per group in the GroupOrderList is the number of Tag values. This is followed by the numerical sequence in which the Tag values are to be loaded. Device drivers in a group are first loaded according to their Tag value as defined by the GroupOrderList. If the device driver does not have a Tag value or if the Tag value is not in the GroupOrderList, then these device drivers load after the device drivers with valid Tag values load. For these device drivers, the order of loading is not guaranteed, other than 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 in
the GroupOrderList. When a group is not in the GroupOrderList, the order in
which device drivers load within the group cannot be guaranteed.
As with the ServiceGroupOrder, the GroupOrderList can be modified. Using the 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, 00000001
and 00000002. The order in which the Tag values load is 00000002 first,
followed by 00000001. If SAMPLDRV is in the SCSI class group, which is
the same as SCSIDISK, either Tag value guarantees that SAMPLDRV loads
before SCSIDISK because SCSIDISK has no Tag value and non-Tagged
drivers 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 value of 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
Keywords : NTDDKKMode Version : WINNT:3.5,3.51; Platform : winnt Issue type : kbhowto |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |