Windows Driver Kit: Kernel-Mode Driver Framework
WdfDeviceWdmGetDeviceObject

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

PDEVICE_OBJECT
  WdfDeviceWdmGetDeviceObject(
    IN WDFDEVICE hDevice
    );

Parameters

hDevice
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.

Comments

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.

Example

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)
            );

Requirements

Versions: The WdfDeviceWdmGetDeviceObject method is available in version 1.0 and later versions of KMDF.

IRQL: <=DISPATCH_LEVEL

Headers: Declared in wdfdevice.h. Include wdf.h.

Library: See Framework Library Versions.

See Also

WdfDeviceWdmGetPhysicalDevice


Send feedback on this topic
Built on November 19, 2009
Page view tracker