Starting a Device
The PnP manager sends an IRP_MN_START_DEVICE request to drivers either to start a newly enumerated device or to restart an existing device that was stopped for resource rebalancing.
Function and filter drivers must set an IoCompletion routine, pass the IRP_MN_START_DEVICE request down the device stack, and postpone their start operations until all lower drivers have finished with the IRP. The parent bus driver, the bottom driver in the device stack, must be the first driver to perform its start operations on a device before the device is accessed by other drivers.
To ensure proper sequencing of start operations, the PnP manager on Windows 2000 and later versions of Windows postpones exposing device interfaces and blocks create requests for the device until the start IRP succeeds.
If a driver for a device fails the IRP_MN_START_DEVICE request, the PnP manager sends an IRP_MN_REMOVE_DEVICE request to the device stack (on Windows 2000 and later versions of Windows). In response to this IRP, the drivers for the device undo their start operations (if they succeeded the start IRP), undo their AddDevice operations, and detach from the device stack. The PnP manager marks such a device "failed start."
This section covers the following topics: