Handling PnP Requests to Storage Peripherals
A storage class driver's DispatchPnP routine is responsible for the following in response to PnP requests:
Starting its device in response to a start request (IRP_MJ_PNP with IRP_MN_START_DEVICE). See Handling PnP Start in a Storage Class Driver.
Removing its device in response to a remove request (IRP_MJ_PNP with IRP_MN_REMOVE_DEVICE). See Storage Class Driver's RemoveDevice Routine.
If its device can contain the system paging file, maintaining a count of paging path notifications in its device extension in response to a paging-notification request (IRP_MJ_PNP with IRP_MN_DEVICE_USAGE_NOTIFICATION) and forwarding the request to the next-lower driver.
Handling query-remove and query-stop requests and, if the device contains the system paging file or hibernation file, failing such requests. A driver might also fail a query-remove request if its device is claimed for crash dump, because removing such a device disables crash dump.
The storage class driver forwards PnP query, cancel, and stop requests (except for failed query requests) to the next-lower driver.