#ifndef _NTIOAPI_H
/**
* The NtSetVolumeInformationFile routine modifies information about the volume associated with a given file, directory, storage device, or volume.
*
* \param[in] FileHandle A handle to the file, directory, storage device, or volume for which volume information is being requested.
* \param[out] IoStatusBlock A pointer to an IO_STATUS_BLOCK structure that receives the final completion status, and the number of bytes written to the buffer pointed to by FsInformation.
* \param[in] FsInformation A pointer to a caller-allocated buffer containing the volume information to be modified.
* \param[in] Length The size, in bytes, of the buffer pointed to by FsInformation.
* \param[in] FsInformationClass The type of information to set about the volume.
* \return NTSTATUS Successful or errant status.
* \sa https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-zwsetvolumeinformationfile
*/
NTSYSCALLAPI
NTSTATUS
NTAPI
NtSetVolumeInformationFile(
_In_ HANDLE FileHandle,
_Out_ PIO_STATUS_BLOCK IoStatusBlock,
_In_reads_bytes_(Length) PVOID FsInformation,
_In_ ULONG Length,
_In_ FSINFOCLASS FsInformationClass
);
View code on GitHub
#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwSetVolumeInformationFile(
_In_ HANDLE FileHandle,
_Out_ PIO_STATUS_BLOCK IoStatusBlock,
_In_reads_bytes_(Length) PVOID FsInformation,
_In_ ULONG Length,
_In_ FSINFOCLASS FsInformationClass
);
View code on GitHub
// ntifs.h
NTSYSAPI NTSTATUS ZwSetVolumeInformationFile(
[in] HANDLE FileHandle,
[out] PIO_STATUS_BLOCK IoStatusBlock,
[in] PVOID FsInformation,
[in] ULONG Length,
[in] FS_INFORMATION_CLASS FsInformationClass
);
View the official Windows Driver Kit DDI reference
No description available.
The ZwSetVolumeInformationFile routine modifies information about the volume associated with a given file, directory, storage device, or volume.
FileHandle
[in]Handle to a file object for an open file, directory, storage device, or volume whose volume information is to be modified.
IoStatusBlock
[out]Pointer to an IO_STATUS_BLOCK structure that receives the final completion status and information about the operation.
FsInformation
[in]Pointer to a caller-allocated buffer containing the volume information to be modified. The structure of the information in this buffer depends on the value of FsInformationClass, as shown in the following table.
Length
[in]Size in bytes of the buffer pointed to by FsInformation. The caller should set this parameter according to the given FsInformationClass.
FsInformationClass
[in]Type of volume information to be set. One of the following:
Value | Meaning |
---|---|
FileFsControlInformation | Set FILE_FS_CONTROL_INFORMATION for the volume. |
FileFsLabelInformation | Set FILE_FS_LABEL_INFORMATION for the volume. |
FileFsObjectIdInformation | Set FILE_FS_OBJECTID_INFORMATION for the volume. |
ZwSetVolumeInformationFile returns STATUS_SUCCESS or an appropriate NTSTATUS value such as one of the following:
Return code | Description |
---|---|
STATUS_INFO_LENGTH_MISMATCH | An invalid value was specified for Length. This is an error code. |
STATUS_INSUFFICIENT_RESOURCES | ZwSetVolumeInformationFile encountered a pool allocation failure. This is an error code. |
STATUS_INVALID_INFO_CLASS | An invalid value was specified for FsInformationClass. This is an error code. |
To query volume information, call ZwQueryVolumeInformationFile.
To change information about a file, call ZwSetVolumeInformationFile.
Minifilters should use FltSetInformationFile instead of ZwSetVolumeInformationFile.
Note If the call to the ZwSetVolumeInformationFilefunction occurs in user mode, you should use the name "NtSetInformationFile" instead of "ZwSetVolumeInformationFile".
For calls from kernel-mode drivers, the Nt*Xxx* and Zw*Xxx* versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the Nt*Xxx* and Zw*Xxx* versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.
Using Nt and Zw Versions of the Native System Services Routines
This function is documented in Windows Driver Kit.
HANDLE
to File Object.
IO result of call.
Buffer containing information to set, depending on FileSystemInformationClass
parameter.
Length of FileSystemInformation
buffer, in bytes.
Class of information to set. See FS_INFORMATION_CLASS
for valid information classes.
NtSetVolumeInformationFile
sets information to volume (device) containing file specified in FileHandle
parameter.