WdfIoTargetWdmGetTargetPhysicalDevice - NtDoc

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

PDEVICE_OBJECT WdfIoTargetWdmGetTargetPhysicalDevice(
  [in] WDFIOTARGET IoTarget
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdfiotarget-wdfiotargetwdmgettargetphysicaldevice)

WdfIoTargetWdmGetTargetPhysicalDevice function

Description

[Applies to KMDF only]

The WdfIoTargetWdmGetTargetPhysicalDevice method returns a pointer to the Windows Driver Model (WDM) physical device object (PDO) that represents a remote I/O target's device.

Parameters

IoTarget [in]

A handle to a remote I/O target object. This handle was obtained from a previous call to WdfIoTargetCreate.

Return value

If the I/O target represents a PnP device, WdfIoTargetWdmGetTargetPhysicalDevice returns a pointer to a DEVICE_OBJECT structure that represents a remote I/O target's PDO. Otherwise the method returns NULL.

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

Remarks

The pointer that the WdfIoTargetWdmGetTargetPhysicalDevice method returns is valid until the driver calls WdfIoTargetClose or WdfIoTargetCloseForQueryRemove, or until the remote I/O target object is deleted. If the driver provides an EvtCleanupCallback function for the remote I/O target object, and if the object is deleted before the remote I/O target is closed, the pointer is valid until the EvtCleanupCallback function returns.

If the driver attempts to access the WDM device object after it has been removed, the driver can cause the system to crash. The toastmon sample demonstrates how the driver can provide an EvtIoTargetQueryRemove callback function so that it is notified if the I/O target is removed.

For more information about WdfIoTargetWdmGetTargetPhysicalDevice, see Obtaining Information About a General I/O Target.

For more information about I/O targets, see Using I/O Targets.

Examples

The following code example obtains a pointer to a DEVICE_OBJECT structure that represents the PDO of a remote I/O target's device.

PDEVICE_OBJECT  pTargetDO;

pTargetDO = WdfIoTargetWdmGetTargetPhysicalDevice(IoTarget);

See also

DEVICE_OBJECT

WdfIoTargetCreate