Bewerken

Delen via


FltOpenVolume function (fltkernel.h)

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.

Syntax

NTSTATUS FLTAPI FltOpenVolume(
  [in]  PFLT_INSTANCE Instance,
  [out] PHANDLE       VolumeHandle,
  [out] PFILE_OBJECT  *VolumeFileObject
);

Parameters

[in] Instance

Opaque instance pointer for the instance. This instance must be attached to a local volume.

[out] VolumeHandle

Handle for the file system volume.

[out] VolumeFileObject

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.

Return value

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.

Remarks

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.

Requirements

Requirement Value
Minimum supported client Available in Microsoft Windows 2000 Update Rollup 1 for SP4, Windows XP SP3, Windows Server 2003 SP1, and later versions of the Windows operating system.
Target Platform Universal
Header fltkernel.h (include Fltkernel.h)
Library FltMgr.lib
DLL Fltmgr.sys
IRQL PASSIVE_LEVEL

See also

FltClose

FltGetDeviceObject

FltGetFilterFromInstance

FltObjectDereference

FltQueryVolumeInformation

ObDereferenceObject