WdfDeviceInitSetPnpPowerEventCallbacks function

[Applies to KMDF and UMDF]

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

Syntax

void WdfDeviceInitSetPnpPowerEventCallbacks(
  PWDFDEVICE_INIT               DeviceInit,
  PWDF_PNPPOWER_EVENT_CALLBACKS PnpPowerEventCallbacks
);

Parameters

DeviceInit

A caller-supplied pointer to a WDFDEVICE_INIT structure.

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

   
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, DeviceInitAPI, DriverCreate, DrvAckIoStop, KmdfIrql, KmdfIrql2, PdoDeviceInitAPI

See Also

WDF_PNPPOWER_EVENT_CALLBACKS_INIT

WdfDeviceInitSetPowerPolicyEventCallbacks