The New WDM IRP Dispatch Functions
The AddDevice function, called by the PnP Manager, merely initializes the device (and its extension) object. It is apparent from the AddDevice code that hardware is not yet touched. In fact, two general responsibilities remain for a driver.
Reserve and configure hardware resource requirements for the device
Initialize the hardware to prepare it for use
Both tasks are performed by a driver upon receipt of a special IRP function (and subfunction) code that is new for WDM drivers: IRP_MJ_PNP. PnP IRP codes are sent by the PnP Manager when a variety of events occur, including
Device initialization (perhaps due to insertion)
Device shutdown (perhaps due to removal)
As described in chapter 6, IRP ...