The IRP_MJ_QUERY_VOLUME_INFORMATION request is sent by the I/O Manager. It can be sent, for example, when a user-mode application has called a Microsoft Win32 function such as GetDiskFreeSpace or GetFileType.
The file system driver should extract and decode the file object to determine whether the target device object is the file system's control device object. If it is, and if the request has been issued on a handle that is a volume open (or an open of an object on the volume), the file system driver should process the request and complete the IRP.
Otherwise, the file system driver should fail the query and complete the IRP.
The types of volume information that can be queried are file-system-dependent, but generally include the following:
For a list of all possible information types, see IrpSp->Parameters.QueryVolume.FsInformationClass below.
A network redirector that receives a request for FileFsDeviceInformation, must include FILE_REMOTE_DEVICE as one of the options for the DeviceCharacteristics member of the FILE_FS_DEVICE_INFORMATION structure returned.
The filter driver should pass this IRP down to the next-lower driver on the stack.
A file system or filter driver calls IoGetCurrentIrpStackLocation with the given IRP to get a pointer to its own stack location in the IRP, shown in the following list as IrpSp. (The IRP is shown as Irp.) The driver can use the information that is set in the following members of the IRP and the IRP stack location in processing a query volume information request:
Pointer to the target device object.
Pointer to a system-supplied output buffer where the volume information is to be returned. This information is stored in one of the following structures:
The FileFsVolumeFlagsInformation class and the associated FILE_FS_VOLUME_INFORMATION structure are available on Windows Vista and later versions.
Pointer to an IO_STATUS_BLOCK structure that receives the final completion status and information about the requested operation.
Optional pointer to a caller-supplied output buffer into which the contents of Irp->AssociatedIrp.SystemBuffer are copied during I/O completion by the I/O manager. Drivers do not use this buffer to return any data for the request.
Pointer to the file object that is associated with DeviceObject.
The IrpSp->FileObject parameter contains a pointer to the RelatedFileObject field, which is also a FILE_OBECT structure. The RelatedFileObject field of the FILE_OBJECT structure is not valid during the processing of IRP_MJ_QUERY_VOLUME_INFORMATION and should not be used.
Specifies the type of volume information to be returned by the file system. This member can be one of the following:
Return a FILE_FS_ATTRIBUTE_INFORMATION structure that contains attribute information about the file system responsible for the volume.
Return a FILE_FS_CONTROL_INFORMATION structure that contains file system control information about the volume.
Return a FILE_FS_DEVICE_INFORMATION structure that contains device information for the volume.
Return a FILE_FS_DRIVER_PATH_INFORMATION structure that contains information about whether a specified driver is in the I/O path for the volume. The originator of the IRP_MJ_QUERY_VOLUME_INFORMATION request must store the name of the driver into the FILE_FS_DRIVER_PATH_INFORMATION structure before sending the IRP to the file system volume device stack.
Return a FILE_FS_FULL_SIZE_INFORMATION structure that contains information about the total amount of space available on the volume.
Return a FILE_FS_OBJECTID_INFORMATION structure that contains file-system-specific object ID information for the volume. Note that this is not the same as the (GUID-based) unique volume name that is assigned by the operating system.
Return a FILE_FS_SIZE_INFORMATION structure containing information about the amount of space on the volume that is available to the user associated with the thread which originated the IRP_MJ_QUERY_VOLUME_INFORMATION request.
Return a FILE_FS_VOLUME_INFORMATION that contains information about the volume such as the volume label, serial number, and creation time.
Return a FILE_FS_SECTOR_SIZE_INFORMATION structure that contains information about the physical and logical sector sizes of a volume.
Length, in bytes, of the buffer pointed to by Irp->UserBuffer. On return, this variable receives the number of bytes written to the buffer.