The IRP_MJ_FILE_SYSTEM_CONTROL request is sent by the I/O Manager and other operating system components, as well as other kernel-mode drivers. It can be sent, for example, when a user-mode application has called the Microsoft Win32 DeviceIoControl function to send a file system I/O control (FSCTL) request.
Operation: File System Drivers
The file system driver or recognizer should check the minor function code to determine which file system control operation is requested.
File system drivers should handle the following minor function codes:
This request is the same as IRP_MN_USER_FS_REQUEST (described following), except that the source of the request is a trusted kernel component.
Indicates a volume mount request. If a file system driver receives this IRP for a volume whose format does not match that of the file system, the file system driver should return STATUS_UNRECOGNIZED_VOLUME.
Indicates an FSCTL request, possibly on behalf of a user-mode application that has called the Microsoft Win32 DeviceIoControl function or on behalf of a kernel-mode component that has called ZwDeviceIoControlFile or IoBuildDeviceIoControlRequest.
For detailed information about FSCTL requests, see "Device Input and Output Control Codes" in the Microsoft Windows SDK documentation.
Indicates a volume verification request. For removable media, the file system must verify the volume when it detects that the media has been removed and returned to ensure that it is still the same volume that the file system was previously working with. If the volume has changed, the file system should invalidate all outstanding handles. It will also return an error if the file system on this new media has changed. This request is most often used for floppy drives.
File system recognizers must handle the following minor function code:
Indicates a load-file system request.
After performing the requested operation, the file system driver or recognizer should complete the IRP.
Operation: Files System Filter Drivers
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 file system control request:
Pointer to a system-supplied input buffer to be passed to the file system or file system filter driver for the target volume. Used for METHOD_BUFFERED or METHOD_DIRECT I/O. Whether this parameter is required depends on the specific file system control code.
Pointer to an IO_STATUS_BLOCK structure that receives the final completion status and information about the requested operation.
Address of a memory descriptor list (MDL) describing an output buffer to be passed to the file system or file system filter driver for the target volume. Used for METHOD_DIRECT I/O. Whether this parameter is required depends on the specific I/O control code.
Pointer to a caller-supplied output buffer to be passed to the file system or file system filter driver for the target volume. Used for METHOD_BUFFERED or METHOD_NEITHER I/O. Whether this parameter is optional or required depends on the specific I/O control code.
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_FILE_SYSTEM_CONTROL and should not be used.
For detailed information about IOCTL and FSCTL requests, see Using I/O Control Codes in the Kernel Mode Architecture Guide and "Device Input and Output Control Codes" in the Microsoft Windows SDK documentation.
Pointer to the volume parameter block (VPB) for the volume to be mounted. File systems that support removable media might substitute a previously used VPB for the one passed in this parameter. On such file systems, after the volume is mounted, this pointer can no longer be assumed to be valid. File system filter drivers that filter these file systems should use this parameter as follows: Before sending the IRP down to lower-level drivers, the filter should save the value of IrpSp->Parameters.MountVolume.Vpb->RealDevice. After the volume is successfully mounted, the filter can use this pointer to the storage device object to obtain the correct VPB pointer.
Send feedback about: