The PoSetPowerState routine notifies the system of a change in the device power state for a device.
POWER_STATE PoSetPowerState( PDEVICE_OBJECT DeviceObject, POWER_STATE_TYPE Type, POWER_STATE State );
A pointer to the target DEVICE_OBJECT.
Indicates a POWER_STATE_TYPE value. Drivers must specify DevicePowerState.
Specifies the power state to be set. Drivers must specify a DEVICE_POWER_STATE value.
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.
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:
- A driver calls this routine after receiving a device set-power request and before calling PoStartNextPowerIrp. When handling a PnP IRP_MN_START_DEVICE request, the driver should call PoSetPowerState to notify the power manager that the device is in the D0 state.
- If the device is powering down, the driver must call PoSetPowerState before leaving the D0 state. In addition, the driver must be able to process client requests before PoSetPowerState returns.
- If the device is powering up, the driver must call PoSetPowerState after the device is successfully put into the D0 state.
Callers of PoSetPowerState must be running at IRQL <= APC_LEVEL except when setting state to D0. When setting state to D0, callers can be running at IRQL <= DISPATCH_LEVEL.
|Minimum supported client||Available starting with Windows 2000.|
|Header||ntifs.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|IRQL||See Remarks section.|