WdfDeviceInitSetPnpPowerEventCallbacks function (wdfdevice.h)

[Applies to KMDF and UMDF]

The WdfDeviceInitSetPnpPowerEventCallbacks method registers a driver's Plug and Play and power management event callback functions.

Syntax

void WdfDeviceInitSetPnpPowerEventCallbacks(
  [in] PWDFDEVICE_INIT               DeviceInit,
  [in] PWDF_PNPPOWER_EVENT_CALLBACKS PnpPowerEventCallbacks
);

Parameters

[in] DeviceInit

A caller-supplied pointer to a WDFDEVICE_INIT structure.

[in] PnpPowerEventCallbacks

A pointer to a caller-initialized WDF_PNPPOWER_EVENT_CALLBACKS structure.

Return value

None

Remarks

If your driver calls WdfDeviceInitSetPnpPowerEventCallbacks, it must do so before it calls WdfDeviceCreate.

For more information about calling WdfDeviceCreate, see Creating a Framework Device Object.

Examples

The following code example initializes a WDF_PNPPOWER_EVENT_CALLBACKS structure and then calls WdfDeviceInitSetPnpPowerEventCallbacks.

WDF_PNPPOWER_EVENT_CALLBACKS  pnpPowerCallbacks;

WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
pnpPowerCallbacks.EvtDevicePrepareHardware = SerialEvtPrepareHardware;
pnpPowerCallbacks.EvtDeviceReleaseHardware = SerialEvtReleaseHardware;
pnpPowerCallbacks.EvtDeviceD0Entry = SerialEvtDeviceD0Entry;
pnpPowerCallbacks.EvtDeviceD0Exit = SerialEvtDeviceD0Exit;
WdfDeviceInitSetPnpPowerEventCallbacks(
                                       DeviceInit,
                                       &pnpPowerCallbacks
                                       );

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), DrvAckIoStop(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf), PdoDeviceInitAPI(kmdf)

See also

WDF_PNPPOWER_EVENT_CALLBACKS_INIT

WdfDeviceInitSetPowerPolicyEventCallbacks