Expand Minimize

WdfDeviceInitRegisterPnpStateChangeCallback method

[Applies to KMDF only]

The WdfDeviceInitRegisterPnpStateChangeCallback method registers a driver-supplied event callback function that the framework calls when a device's Plug and Play state machine changes state.

Syntax


NTSTATUS WdfDeviceInitRegisterPnpStateChangeCallback(
  [in]  PWDFDEVICE_INIT DeviceInit,
  [in]  WDF_DEVICE_PNP_STATE PnpState,
  [in]  PFN_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION EvtDevicePnpStateChange,
  [in]  ULONG CallbackTypes
);

Parameters

DeviceInit [in]

A caller-supplied pointer to a WDFDEVICE_INIT structure.

PnpState [in]

A WDF_DEVICE_PNP_STATE enumerator that identifies the Plug and Play machine state for which the driver is requesting notification.

EvtDevicePnpStateChange [in]

A caller-supplied pointer to the driver's EvtDevicePnpStateChange event callback function.

CallbackTypes [in]

An ORed combination of WDF_STATE_NOTIFICATION_TYPE-typed enumerators.

Return value

If the operation succeeds, WdfDeviceInitRegisterPnpStateChangeCallback returns STATUS_SUCCESS. Additional return values include:

Return codeDescription
STATUS_INVALID_PARAMETER

An invalid parameter was detected.

STATUS_INSUFFICIENT_RESOURCES

There is insufficient memory to complete the operation.

 

Remarks

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

For more information about WdfDeviceInitRegisterPnpStateChangeCallback, see State Machines in the Framework.

Examples

The following code example registers an event callback function that the framework will call when the device's Plug and Play state machine changes state.


status = WdfDeviceInitRegisterPnpStateChangeCallback(
                                                     DeviceInit,
                                                     WdfDevStatePnpEjectFailed,
                                                     MyDrvPnPStateChangeCallback,
                                                     StateNotificationAllStates
                                                     );

Requirements

Minimum KMDF version

1.0

Header

Wdfdevice.h (include Wdf.h)

Library

Wdf01000.sys (see Framework Library Versioning.)

IRQL

PASSIVE_LEVEL

DDI compliance rules

ChildDeviceInitAPI, DeviceInitAPI, DriverCreate, InitFreeDeviceCallback, InitFreeDeviceCreate, InitFreeNull, KmdfIrql, KmdfIrql2, PdoDeviceInitAPI, PdoInitFreeDeviceCallback, PdoInitFreeDeviceCreate

See also

WDFDEVICE_INIT
WDF_DEVICE_PNP_STATE
WDF_STATE_NOTIFICATION_TYPE
EvtDevicePnpStateChange

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft. All rights reserved.