Writing an AddDevice Routine

Any driver that supports PnP must have an AddDevice routine. The AddDevice routine creates one or more device objects representing the physical, logical, or virtual devices for which the driver carries out I/O requests. It also attaches the device object to the device stack, so the device stack will contain a device object for each driver associated with the device.

The PnP manager calls a driver's AddDevice routine for each device controlled by the driver. AddDevice routines are called during system initialization (when devices are first enumerated), and any time a new device is enumerated while the system is running.

This section contains the following topics:

AddDevice Routines in Function or Filter Drivers

AddDevice Routines in Bus Drivers

Guidelines for Writing AddDevice Routines

Send comments about this topic to Microsoft