Handling Power IRPs
Drivers handle power IRPs in a DispatchPower routine. All power management requests have the major IRP code IRP_MJ_POWER and one of the following minor codes:
IRP_MN_QUERY_POWER — Queries to determine whether changing power state is feasible
IRP_MN_SET_POWER — Requests a change from one power state to another
IRP_MN_WAIT_WAKE — Requests that a device be enabled to wake itself or the system
IRP_MN_POWER_SEQUENCE — Requests information to optimize power restoration to a particular device
Support for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER is required. All drivers must be prepared to handle these IRPs.
Support for IRP_MN_WAIT_WAKE is required for all drivers in the device stack for any device that can awaken in response to an external signal. A driver sends this IRP to enable the device for wake-up.
Support for IRP_MN_POWER_SEQUENCE is optional. This IRP provides an optimization for devices that take a long time to restore power.
A power IRP can specify a system power operation or a device power operation. Power IRPs for the system and power IRPs for individual devices take slightly different paths through a device stack, as explained in the following sections.