FltGetDiskDeviceObject function (fltkernel.h)

The FltGetDiskDeviceObject routine returns a pointer to the disk device object associated with a given volume.

Syntax

NTSTATUS FLTAPI FltGetDiskDeviceObject(
  [in]  PFLT_VOLUME    Volume,
  [out] PDEVICE_OBJECT *DiskDeviceObject
);

Parameters

[in] Volume

Opaque pointer for the volume. This parameter is required and cannot be NULL.

[out] DiskDeviceObject

Pointer to a caller-allocated variable that receives the device object pointer. On any error, this parameter is not modified.

Return value

FltGetDiskDeviceObject returns STATUS_SUCCESS or an appropriate NTSTATUS value such as the following:

Return code Description
STATUS_FLT_NO_DEVICE_OBJECT The requested device object does not exist for the given volume. This is an error code.

Remarks

FltGetDiskDeviceObject retrieves a pointer to the storage device object for the physical disk where the volume resides. The storage device need not be an actual disk.

FltGetDiskDeviceObject increments the reference count on the device object pointer returned in DiskDeviceObject. When this pointer is no longer needed, the caller must decrement this reference count by calling ObDereferenceObject. Failure to do so prevents the system from freeing or deleting the device object because of the outstanding reference. Thus every successful call to FltGetDiskDeviceObject must be matched by a subsequent call to ObDereferenceObject.

A minifilter must call FltGetDiskDeviceObject only in an I/O related callback. Otherwise, the fields of the device object returned may not be valid. This the case in callback routines such as InstanceTeardownStartCallback and InstanceTeardownCompleteCallback.

To get a pointer to the Filter Manager's volume device object (VDO) for a given volume, call FltGetDeviceObject.

To get an opaque volume pointer for the volume represented by a volume device object, call FltGetVolumeFromDeviceObject.

For more information about volume device objects, see File System Stacks.

Requirements

Requirement Value
Target Platform Universal
Header fltkernel.h (include Fltkernel.h)
Library Fltmgr.lib
DLL Fltmgr.sys
IRQL <= DISPATCH_LEVEL

See also

FltGetDeviceObject

FltGetVolumeFromDeviceObject

ObDereferenceObject

ObReferenceObject