WdfDeviceInitSetPowerPolicyEventCallbacks function (wdfdevice.h)

[Applies to KMDF and UMDF]

The WdfDeviceInitSetPowerPolicyEventCallbacks method registers a driver's power policy event callback functions.

Syntax

void WdfDeviceInitSetPowerPolicyEventCallbacks(
  [in] PWDFDEVICE_INIT                   DeviceInit,
  [in] PWDF_POWER_POLICY_EVENT_CALLBACKS PowerPolicyEventCallbacks
);

Parameters

[in] DeviceInit

A caller-supplied pointer to a WDFDEVICE_INIT structure.

[in] PowerPolicyEventCallbacks

A pointer to a caller-initialized WDF_POWER_POLICY_EVENT_CALLBACKS structure.

Return value

None

Remarks

If your driver calls WdfDeviceInitSetPowerPolicyEventCallbacks, it must do so before it calls WdfDeviceCreate. For more information, see Creating a Framework Device Object.

For more information about WdfDeviceInitSetPowerPolicyEventCallbacks, see Power Policy Ownership.

Examples

The following code example initializes a WDF_POWER_POLICY_EVENT_CALLBACKS structure and then calls WdfDeviceInitSetPowerPolicyEventCallbacks.

WDF_POWER_POLICY_EVENT_CALLBACKS powerPolicyCallbacks;

WDF_POWER_POLICY_EVENT_CALLBACKS_INIT(&powerPolicyCallbacks);
powerPolicyCallbacks.EvtDeviceArmWakeFromS0 = PciDrvEvtDeviceWakeArmS0;
powerPolicyCallbacks.EvtDeviceDisarmWakeFromS0 = PciDrvEvtDeviceWakeDisarmS0;
powerPolicyCallbacks.EvtDeviceWakeFromS0Triggered = PciDrvEvtDeviceWakeTriggeredS0;
powerPolicyCallbacks.EvtDeviceArmWakeFromSx = PciDrvEvtDeviceWakeArmSx;
powerPolicyCallbacks.EvtDeviceDisarmWakeFromSx = PciDrvEvtDeviceWakeDisarmSx;
powerPolicyCallbacks.EvtDeviceWakeFromSxTriggered = PciDrvEvtDeviceWakeTriggeredSx;
WdfDeviceInitSetPowerPolicyEventCallbacks(
                                          DeviceInit,
                                          &powerPolicyCallbacks
                                          );

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Minimum UMDF version 2.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (KMDF); WUDFx02000.dll (UMDF)
IRQL <= DISPATCH_LEVEL
DDI compliance rules ChildDeviceInitAPI(kmdf), DeviceInitAPI(kmdf), DriverCreate(kmdf), FDOPowerPolicyOwnerAPI(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), NonFDONotPowerPolicyOwnerAPI(kmdf), PdoDeviceInitAPI(kmdf)

See also

WDF_POWER_POLICY_EVENT_CALLBACKS_INIT

WdfDeviceInitSetPnpPowerEventCallbacks