Design Guidelines for Starting Devices
The PnP manager fails create requests for the device until the IRP_MN_START_DEVICE IRP completes, indicating that all the drivers for the device have performed their start operations.
Because a DispatchPnP routine runs in the context of a system thread at IRQL PASSIVE_LEVEL, any memory allocated with ExAllocatePoolWithTag for use exclusively during initialization can be from paged pool as long as the driver does not control the device that holds a system page file. Such a memory allocation must be released with ExFreePool before the DispatchPnP routine returns control.
A WDM device driver's ISR should be capable of determining whether it has been called with a spurious interrupt even during device startup. On return from the call to IoConnectInterrupt in the code path that handles IRP_MN_START_DEVICE, the ISR can be called immediately if interrupts are enabled on the device.