WdfDeviceGetSystemPowerAction - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfdevice.h

POWER_ACTION WdfDeviceGetSystemPowerAction(
  [in] WDFDEVICE Device
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdevice-wdfdevicegetsystempoweraction)

WdfDeviceGetSystemPowerAction function

Description

[Applies to KMDF and UMDF]

The WdfDeviceGetSystemPowerAction method returns the system power action, if any, that is currently occurring for the computer.

Parameters

Device [in]

A handle to a framework device object.

Return value

WdfDeviceGetSystemPowerAction returns a POWER_ACTION-typed enumerator value. The value indicates the system power action that is currently occurring for the computer. For more information, see the following Remarks section. The POWER_ACTION enumeration is defined in wdm.h.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

Starting in WDF version 1.31/2.31 (referred to as "v31"), WdfDeviceGetSystemPowerAction has been updated to more accurately report system power action when the device is the power policy owner. Drivers need to be recompiled with v31 or later to get the following new behavior:

The WdfDeviceGetSystemPowerAction method enables a driver to determine whether a device's power transition is occurring because the device is idle (or waking up), or because the entire computer is entering (or leaving) a low-power state.

The driver must call WdfDeviceGetSystemPowerAction only from the event callback functions that the framework calls when the device is entering a low-power state or returning to its working state.

The value that WdfDeviceGetSystemPowerAction returns depends on the following situations:

For more information about low-power states, see A Device Enters a Low-Power State.

Examples

The following code example obtains the power transition activity that is currently occurring for the computer.

POWER_ACTION SysPowerAction;

SysPowerAction = WdfDeviceGetSystemPowerAction(device);