IoGetDiskDeviceObject function (ntifs.h)

The IoGetDiskDeviceObject routine retrieves a pointer to the disk device object associated with a given file system volume device object.

Syntax

NTSTATUS IoGetDiskDeviceObject(
  [in] PDEVICE_OBJECT FileSystemDeviceObject,
       PDEVICE_OBJECT *DiskDeviceObject
);

Parameters

[in] FileSystemDeviceObject

A pointer to the file system device object.

DiskDeviceObject

A pointer to a variable that receives the address of the device object for the disk device object.

Return value

IoGetDiskDeviceObject returns one of the following status values:

Return code Description
STATUS_INVALID_PARAMETER
One of the parameters passed to this function was invalid.
STATUS_VOLUME_DISMOUNTED
STATUS_SUCCESS

Remarks

IoGetDiskDeviceObject returns a pointer to the storage device object associated with the file system volume. The storage device need not be an actual disk

File system filter drivers typically call IoGetDiskDeviceObject for a file system volume device object to determine whether the volume is mounted.

IoGetDiskDeviceObject increments the reference count on the disk device object pointed to by DeviceObject. Thus every successful call to IoGetDiskDeviceObject must be matched by a subsequent call to ObDereferenceObject.

Requirements

Requirement Value
Minimum supported client Windows 2000 SP4 Update Rollup; Windows XP
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL

See also

IoEnumerateDeviceObjectList

IoGetAttachedDevice

IoGetAttachedDeviceReference

IoGetLowerDeviceObject

ObDereferenceObject