IoGetAttachedDeviceReference - NtDoc

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

PDEVICE_OBJECT IoGetAttachedDeviceReference(
  [in] PDEVICE_OBJECT DeviceObject
);

View the official Windows Driver Kit DDI reference
// wdm.h

PDEVICE_OBJECT IoGetAttachedDeviceReference(
  [in] PDEVICE_OBJECT DeviceObject
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-ntifs-iogetattacheddevicereference)

IoGetAttachedDeviceReference function (ntifs.h)

Description

The IoGetAttachedDeviceReference routine returns a pointer to the highest level device object in a driver stack and increments the reference count on that object.

Parameters

DeviceObject [in]

Pointer to the device object for which the topmost attached device object is retrieved.

Return value

IoGetAttachedDeviceReference returns a pointer to the highest level device object in a stack of attached device objects after incrementing the reference count on the object.

Remarks

If the device object at DeviceObject has no device objects attached to it, DeviceObject and the returned pointer are equal.

Device driver writers must ensure that when they have completed all operations that required them to make this call, that they call ObDereferenceObject with the device object pointer returned by this routine. Failure to do so will prevent the system from freeing or deleting the device object because of an outstanding reference count.

See also

ObDereferenceObject


Windows Driver Kit DDI reference (nf-wdm-iogetattacheddevicereference)

IoGetAttachedDeviceReference function (wdm.h)

Description

The IoGetAttachedDeviceReference routine returns a pointer to the highest level device object in a driver stack and increments the reference count on that object.

Parameters

DeviceObject [in]

Pointer to the device object for which the topmost attached device object is retrieved.

Return value

IoGetAttachedDeviceReference returns a pointer to the highest level device object in a stack of attached device objects after incrementing the reference count on the object.

Remarks

If the device object at DeviceObject has no device objects attached to it, DeviceObject and the returned pointer are equal.

Device driver writers must ensure that when they have completed all operations that required them to make this call, that they call ObDereferenceObject with the device object pointer returned by this routine. Failure to do so will prevent the system from freeing or deleting the device object because of an outstanding reference count.

See also

ObDereferenceObject