WdfDeviceWdmGetAttachedDevice - NtDoc

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

PDEVICE_OBJECT WdfDeviceWdmGetAttachedDevice(
  [in] WDFDEVICE Device
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

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

WdfDeviceWdmGetAttachedDevice function

Description

[Applies to KMDF only]

The WdfDeviceWdmGetAttachedDevice method returns the next-lower WDM device object in the device stack.

Parameters

Device [in]

A handle to a framework device object.

Return value

WdfDeviceWdmGetAttachedDevice returns a pointer to a WDM DEVICE_OBJECT structure. If the specified object handle represents a physical device object (PDO), the method returns NULL.

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

Remarks

The pointer that the WdfDeviceWdmGetAttachedDevice 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, FDO, and next-lower device.

TraceEvents(
            TRACE_LEVEL_INFORMATION,
            DBG_PNP,
            "PDO(0x%p) FDO(0x%p), Lower(0x%p)\n",
            WdfDeviceWdmGetPhysicalDevice(device),
            WdfDeviceWdmGetDeviceObject(device),
            WdfDeviceWdmGetAttachedDevice(device)
            );

See also

WdfDeviceWdmGetDeviceObject

WdfDeviceWdmGetPhysicalDevice