// fltkernel.h
NTSTATUS FLTAPI FltOpenVolume(
[in] PFLT_INSTANCE Instance,
[out] PHANDLE VolumeHandle,
[out] PFILE_OBJECT *VolumeFileObject
);
View the official Windows Driver Kit DDI referenceNo description available.
The FltOpenVolume routine returns a handle and a file object pointer for the file system volume that a given minifilter driver instance is attached to.
Instance [in]Opaque instance pointer for the instance. This instance must be attached to a local volume.
VolumeHandle [out]Handle for the file system volume.
VolumeFileObject [out]Pointer to a caller-allocated variable that receives a file object pointer for the root directory of the volume. This parameter is optional and can be NULL.
FltOpenVolume returns STATUS_SUCCESS or an appropriate NTSTATUS value such as the following:
| Return code | Description |
|---|---|
| STATUS_FLT_DELETING_OBJECT | The instance or volume is being torn down. This is an error code. |
| STATUS_INVALID_PARAMETER | The instance is attached to a network volume. This is an error code. |
When the handle returned in the VolumeHandle parameter is no longer needed, the caller must release it by calling FltClose. Thus every successful call to FltOpenVolume must be matched by a subsequent call to FltClose.
If a file object pointer is returned in the VolumeFileObject parameter, the caller must release it when it is no longer needed by calling ObDereferenceObject.
The instance specified by the Instance parameter must be attached to a local volume. If it is attached to a network volume, FltOpenVolume returns STATUS_INVALID_PARAMETER.
To get a pointer to the device object for a given volume, call FltGetDeviceObject.
To get detailed information about the volume that a given instance is attached to, call FltQueryVolumeInformation.
NOTE: Do not call this routine with a non-NULL top level IRP value, as this can cause a system deadlock. To determine if the thread TopLevelIrp is set call IoGetTopLevelIrp.