Previous Next

Driver Entry Points in Driver Objects

A kernel-mode driver must specify the following entry points in its driver object:

These requirements do not apply to some miniport drivers, for which the corresponding class or port driver defines the entry points in the driver object. See the device-type-specific documentation for details.

The I/O Manager maintains information about driver-created device objects in the corresponding driver object.

When a driver is loaded, its DriverEntry routine is called with a pointer to the driver object. When a driver's DriverEntry routine is called, it sets Dispatch, StartIo (if any), and Unload (if any) entry points directly in the driver object as follows:

DriverObject->MajorFunction[IRP_MJ_xxx] = DDDispatchXxx; 
              :    : 
DriverObject->MajorFunction[IRP_MJ_yyy] = DDDispatchYyy; 
              :    : 
DriverObject->DriverStartIo = DDStartIo; 
DriverObject->DriverUnload = DDUnload; 
              :    : 

The DriverEntry routine also sets the entry point of its AddDevice routine, in the DriverExtension of its driver object, as follows:

DriverObject->DriverExtension->AddDevice = DDAddDevice; 

A DriverEntry or optional Reinitialize routine also can use a field in the driver object (not shown in the Driver Object figure) to get information from and/or set information in the Configuration Manager's registry database. For more information, see Driver Information in the Registry.

The I/O Manager exports no support routines to manipulate driver objects, which are DRIVER_OBJECT structures. Driver objects are used by the I/O Manager to keep track of currently loaded drivers. Some members of a driver object are used only by the I/O Manager. Others members are also used by driver writers; for example, you must know certain member names to define AddDevice, Dispatch, StartIo, and Unload entry points. You should neither attempt to use undocumented members within a DRIVER_OBJECT structure, nor make assumptions about the locations of any driver object members that are named in this documentation. Otherwise, you cannot maintain the portability of a driver from one Windows platform to another.