WdfDeviceWdmGetDeviceObject - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// wdfdevice.h

PDEVICE_OBJECT WdfDeviceWdmGetDeviceObject(
  WDFDEVICE Device
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfdevice-wdfdevicewdmgetdeviceobject)

WdfDeviceWdmGetDeviceObject function

Description

[Applies to KMDF only]

The WdfDeviceWdmGetDeviceObject method returns the Windows Driver Model (WDM) device object that is associated with a specified framework device object.

Parameters

Device

A handle to a framework device object.

Return value

WdfDeviceWdmGetDeviceObject returns a pointer to a DEVICE_OBJECT structure.

A bug check occurs if the driver supplies an invalid object handle.

Remarks

The pointer that the WdfDeviceWdmGetDeviceObject method returns is valid until the framework device object is deleted. If the driver provides an EvtCleanupCallback function for the framework device object, the pointer is valid until the callback function returns.

Examples

The following code example creates a tracing message that contains pointers to the WDM device objects that represent a device's PDO and FDO.

TraceEvents(
            TRACE_LEVEL_INFORMATION,
            AMCC_TRACE_INIT,
            "PDO 0x%p, FDO 0x%p",
            WdfDeviceWdmGetPhysicalDevice(device),
            WdfDeviceWdmGetDeviceObject(device)
            );

See also

WdfDeviceWdmGetPhysicalDevice