IoGetDiskDeviceObject function

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

Syntax

NTKERNELAPI NTSTATUS IoGetDiskDeviceObject(
  PDEVICE_OBJECT FileSystemDeviceObject,
  PDEVICE_OBJECT *DiskDeviceObject
);

Parameters

FileSystemDeviceObject

A pointer to the file system device object.

DiskDeviceObject

TBD

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

   
Windows version This routine is available on Update Rollup for Windows 2000 Service Pack 4 (SP4) and on Windows XP and later.
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