FltGetDiskDeviceObject routine

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

Syntax


NTSTATUS FltGetDiskDeviceObject(
  _In_  PFLT_VOLUME    Volume,
  _Out_ PDEVICE_OBJECT *DiskDeviceObject
);

Parameters

Volume [in]

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

DiskDeviceObject [out]

Pointer to a caller-allocated variable that receives the device object pointer. This parameter is required and cannot be NULL.

Return value

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

Return codeDescription
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

Target platform

Universal

Header

Fltkernel.h (include Fltkernel.h)

Library

Fltmgr.lib

DLL

Fltmgr.sys

IRQL

<= DISPATCH_LEVEL

See also

FltGetDeviceObject
FltGetVolumeFromDeviceObject
ObDereferenceObject

 

 

Send comments about this topic to Microsoft

Show: