Use the browse button to view these topics in sequence.
IRP_MJ_CREATE
Operation
Returns STATUS_SUCCESS, indicating that the device or partition exists. For the caller, this request opens the device for I/O.
When Called
A higher-level driver is attempting to connect or attach one of its device objects to the target device object, or a user-mode process has attempted to open a file stored on the physical device, thereby causing a file system to carry out a mount operation.
I/O Status Block
Returns STATUS_SUCCESS in the Status field and zero in the Information field.
IRP_MJ_FLUSH_BUFFERS
Operation
Transfers any data cached in the device or in the driver’s internal buffer(s) to system memory or out to the device. If the device or driver supports caching or buffering data, the driver must handle this request.
When Called
A file system or DTP application makes this request to ensure data integrity.
I/O Status Block
The Status field is set to STATUS_SUCCESS when the data has been transferred.
IRP_MJ_SHUTDOWN
Operation
Transfers any data cached in the device or in the driver’s internal buffer(s) to system memory or out to the device before the system is shut down. If the device or driver supports caching or buffering data, the driver must handle this request.
When Called
The user has decided to shut down the system.
I/O Status Block
The Status field is set to STATUS_SUCCESS when the data has been transferred.
IRP_MJ_READ
Operation
Transfers data from the device to system memory.
Output
Drivers of disk-type devices generally use direct I/O, so the lowest-level driver transfers data using DMA or PIO into the buffer described by the MDL at Irp->MdlAddress.
When Called
A user-mode application that has a handle for an opened file or a higher-level driver has requested data.
I/O Status Block
The Information field is set to the number of bytes transferred, whatever the Status field’s value. In addition to STATUS_SUCCESS, possible values are any of the following:
Device Errors
STATUS_INVALID_DEVICE_REQUEST
STATUS_NO_SUCH_DEVICE
STATUS_IO_TIMEOUT
STATUS_DEVICE_NOT_CONNECTED
Sector/Data Errors
STATUS_DEVICE_DATA_ERROR
STATUS_CRC_ERROR
and, by drivers of removable-media devices:
STATUS_NO_MEDIA_IN_DEVICE
STATUS_VERIFY_REQUIRED
IRP_MJ_WRITE
Operation
Transfers data from system memory to the device.
Input
Drivers of disk-type devices generally use direct I/O, so the lowest-level driver transfers data using DMA or PIO from the buffer described by the MDL at Irp->MdlAddress.
When Called
A user-mode application that has a handle for an opened file or a higher-level driver has requested a data transfer.
I/O Status Block
The Information field is set to the number of bytes transferred, whatever the Status field’s value. Possible values are any of those returned for read requests and STATUS_MEDIA_WRITE_PROTECTED returned by drivers of removable-media devices.
IRP_MJ_DEVICE_CONTROL
Operation
Determined by the I/O control code set at Parameters.DeviceIoControl.IoControlCode in the driver’s I/O stack location of the IRP.
When Called
A Win32 application has called DeviceIoControl, or a higher-level driver has set up such a request.
I/O Status Block
Also determined by the operation, either STATUS_SUCCESS or an appropriate STATUS_XXX value. For most operations, the set of possible STATUS_XXX values includes those propagated from a call to a support routine or lower-level driver and/or those chosen by the driver designer. In general, the Information field of the I/O status block is set to the number of bytes returned or transferred when the device driver completes the IRP.