The PoSetPowerState routine notifies the system of a change in the device power state for a device.
POWER_STATE
PoSetPowerState(
IN PDEVICE_OBJECT DeviceObject,
IN POWER_STATE_TYPE Type,
IN POWER_STATE State
);
On Windows 2000 and later versions of the operating system, PoSetPowerState returns the previous power state. On Windows 98/Me, PoSetPowerState returns the state passed in State.
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
PoSetPowerState notifies the Power Manager of the new power state for a device. Each driver in a device stack (filter, function, and bus drivers) must call PoSetPowerState to inform the Power Manager of a change in the power state of its corresponding device object. For example:
For more information about powering a device up and down, see Handling IRP_MN_SET_POWER for Device Power States.
Callers of PoSetPowerState must be running at IRQL < DISPATCH_LEVEL except when setting state to D0. When setting state to D0, callers can be running at IRQL <= DISPATCH_LEVEL.