FltGetVolumeName - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// fltkernel.h

NTSTATUS FLTAPI FltGetVolumeName(
  [in]                PFLT_VOLUME     Volume,
  [in, out, optional] PUNICODE_STRING VolumeName,
  [out, optional]     PULONG          BufferSizeNeeded
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-fltkernel-fltgetvolumename)

FltGetVolumeName function

Description

The FltGetVolumeName routine gets the volume name for a given volume.

Parameters

Volume [in]

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

VolumeName [in, out, optional]

Pointer to a caller-allocated UNICODE_STRING structure that contains the volume's non-persistent device object name (for example, "\Device\HarddiskVolume1") when STATUS_SUCCESS is returned. Be aware that pool for VolumeName->Buffer is also caller-allocated.

This parameter is optional and can be NULL; however it must be non-NULL if BufferSizeNeeded is NULL. If this parameter is NULL and BufferSizeNeeded is not NULL, FltGetVolumeName stores the buffer size needed for the requested volume name in the BufferSizeNeeded parameter and returns STATUS_BUFFER_TOO_SMALL. See Remarks.

BufferSizeNeeded [out, optional]

Pointer to a caller-allocated variable that receives the size, in bytes, of the requested volume name. This parameter is optional and can be NULL; however, it must be non-NULL if VolumeName is NULL so that FltGetVolumeName can store the buffer size needed for the requested volume name.

Return value

FltGetVolumeName returns one of the following NTSTATUS values:

Return code Description
STATUS_SUCCESS The UNICODE_STRING structure, pointed to by VolumeName, contains the name of the volume in the Buffer member for the structure and the length of the name, in bytes, in the Length member.
STATUS_BUFFER_TOO_SMALL The Buffer member of the UNICODE_STRING structure, pointed to by VolumeName, is too small (as indicated by its MaximumLength member) to contain the entire volume name. This is an error code.
STATUS_INVALID_PARAMETER VolumeName and BufferSizeNeeded are both NULL. This is an error code.

Remarks

For this routine to succeed, the Buffer member of the UNICODE_STRING structure (pointed to by VolumeName) must be large enough, as indicated by its MaximumLength member, to contain the entire volume name string.

The following pseudocode shows one possible method to successfully acquire a volume name if BufferSizeNeeded is unknown:

VolumeNameStruct.Buffer contains the Unicode volume name string, which is VolumeNameStruct.Length bytes in length.

To get the volume GUID name for a given volume, call FltGetVolumeGuidName.

To get an opaque volume pointer for a volume with a given name, call FltGetVolumeFromName.

For more information about how to name a volume, see Supporting Mount Manager Requests in a Storage Class Driver**.

See also

FilterGetDosName

FltGetVolumeFromName

FltGetVolumeGuidName

UNICODE_STRING