Download EaseFilter Filter Driver SDK Setup File Download EaseFilter Filter Driver SDK Zip File
The IRP_MJ_DEVICE_CONTROL request is sent by the I/O Manager and other operating system components, as well as other kernel-mode drivers. Normally this IRP is sent 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.
The file system driver should extract and decode the file object to determine whether the request has been issued on a handle that is a volume open. If this is the case, the file system driver should pass the IRP to the device driver for the storage device on which the volume is mounted. If not, the driver should fail the IRP.
The filter driver should perform any needed processing and, depending on the nature of the filter, either complete the IRP or pass it down to the next-lower driver on the stack.
A file system or filter driver calls IoGetCurrentIrpStackLocation for 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 device control request:
Pointer to a system-supplied input buffer to be passed to the device driver for the target device. Used for METHOD_BUFFERED or METHOD_DIRECT I/O. Whether this parameter is required depends on the specific I/O control code.
Pointer to an IO_STATUS_BLOCK structure that receives the final completion status and information about the requested operation. For more information, see the description of the IoStatusBlock parameter to ZwDeviceIoControlFile.
Address of a memory descriptor list (MDL) describing an output buffer to be passed to the device driver for the target device. 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 device driver for the target device. 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_OBJECT structure. The RelatedFileObject field of the FILE_OBJECT structure is not valid during the processing of IRP_MJ_DEVICE_CONTROL and should not be used.
For detailed information about IOCTL 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.