WdfWdmDeviceGetWdfDeviceHandle function (wdfdevice.h)

[Applies to KMDF only]

The WdfWdmDeviceGetWdfDeviceHandle method returns a handle to the framework device object that is associated with a specified WDM device object.

Syntax

WDFDEVICE WdfWdmDeviceGetWdfDeviceHandle(
  [in] PDEVICE_OBJECT DeviceObject
);

Parameters

[in] DeviceObject

A pointer to a WDM DEVICE_OBJECT structure that the calling driver created.

Return value

If the specified WDM device object is valid, WdfWdmDeviceGetWdfDeviceHandle returns a handle to the associated framework device object. Otherwise, the method returns NULL.

Remarks

The WDM DEVICE_OBJECT structure that the driver specifies for the DeviceObject parameter must represent a device object that the calling driver created. For example, the structure cannot represent any of the WDM device objects that the driver specified in a previous call to WdfDeviceMiniportCreate.

Examples

The following code example obtains a handle to the framework device object that is associated with a WDM device object that the calling driver created.

WDFDEVICE  device;

device = WdfWdmDeviceGetWdfDeviceHandle(pWdmDeviceObject);

Requirements

Requirement Value
Target Platform Universal
Minimum KMDF version 1.0
Header wdfdevice.h (include Wdf.h)
Library Wdf01000.sys (see Framework Library Versioning.)
IRQL <=DISPATCH_LEVEL
DDI compliance rules DriverCreate(kmdf), KmdfIrql(kmdf), KmdfIrql2(kmdf), KmdfIrqlExplicit(kmdf)

See also

WdfDeviceMiniportCreate