Storage I/O Requests

The list that follows contains the major IRPs that storage drivers must handle. The list provides a brief description of each major IRP. For more information about these IRPs, see IRP Major Function Codes.

  • IRP_MJ_CLOSE
    • Drivers Required to Handle this IRP - All mass storage drivers must handle this request. For more information, see IRP_MJ_CLOSE.
    • General Description - Returns STATUS_SUCCESS to indicate that the driver has completed the request.
    • When Called - The handle to the file object that represents that the target device object was released.
  • IRP_MJ_CREATE
    • Drivers Required to Handle this IRP - All mass storage drivers must handle this request. For more information, see IRP_MJ_CREATE.
    • General Description - Returns STATUS_SUCCESS to indicate that the device or partition exists. For a disk or CD-ROM device, this request opens the device as the target of I/O requests from the caller.
    • When Called - A higher-level driver tries to connect or attach one of its device objects to the target device object, or a user-mode process has tried to open a file that is stored on the physical device. This causes a file system to perform a mount operation.
  • IRP_MJ_DEVICE_CONTROL
    • Drivers Required to Handle this IRP - All mass storage drivers must handle this request. For more information, see IRP_MJ_DEVICE_CONTROL.
    • General Description - Determined by the I/O control code set at Parameters.DeviceIoControl.IoControlCode in the driver's I/O stack location of the IRP. An IoControlCode value of IOCTL_SCSI_PASS_THROUGH together with a MinorFunction value of IRP_MN_SCSI_CLASS indicates that the pass-through IOCTL request was processed by a storage class driver before it was forwarded to the port driver. For more information about SCSI pass-through requests, see Handling SCSI Pass-Through Requests.
    • When Called - A Win32 application has called DeviceIoControl, or a higher-level driver has set up such a request.
  • IRP_MJ_FLUSH_BUFFERS
    • Drivers Required to Handle this IRP - Drivers of devices with internal caches for data and drivers that maintain internal buffers for data must handle this request. For more information, see IRP_MJ_FLUSH_BUFFERS.
    • General Description - Transfers any data that was 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.
  • IRP_MJ_INTERNAL_DEVICE_CONTROL
    • Drivers Required to Handle this IRP - This IRP is equivalent to IRP_MJ_SCSI. Only the port driver must handle this IRP. For more information, see IRP_MJ_INTERNAL_DEVICE_CONTROL
    • General Description - Sends queue control commands to the port driver.
    • When Called - A storage class driver or an application can use this driver to issue queue control commands to the port driver.
  • IRP_MJ_PNP
    • Drivers Required to Handle this IRP - Storage drivers that support Plug and Play (PnP) must handle this request. For more information, see IRP_MJ_PNP.
    • General Description - Determined by the minor function code that is set in the I/O stack location of the IRP.
    • When Called - The PnP manager sends this request to initiate a PnP operation, such as starting or stopping a device.
  • IRP_MJ_POWER
    • Drivers Required to Handle this IRP - Storage drivers that support power management must handle this request. For more information, see IRP_MJ_POWER.
  • IRP_MJ_READ
    • Drivers Required to Handle this IRP - Disk, CD-ROM, DVD, and tape drivers must handle this request. For more information, see IRP_MJ_READ.
    • General Description - Transfers data from the device to system memory.
    • When Called - A user-mode application that has a handle for an opened file or a handle for the opened file object that represents that the device has requested data. This request can also be issued by a higher-level driver.
  • IRP_MJ_SCSI
    • Drivers Required to Handle this IRP - Port drivers must handle this request.
    • General Description - Storage class drivers, or possibly applications, can use this request to send queue control commands to the port driver.
    • When Called - The storage class driver calls this routine to lock or unlock the port driver's request queue or to issue a request to change to the power state of a device.
  • IRP_MJ_SHUTDOWN
    • Drivers Required to Handle this IRP - Disk and tape drivers must handle this request. For more information, see IRP_MJ_SHUTDOWN.
    • General Description - Transfers any data that is 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. The Status field of the I/O Status Block is set to STATUS_SUCCESS when the data was transferred.
    • When Called - The user has decided to shut down the system.
  • IRP_MJ_SYSTEM_CONTROL
    • Drivers Required to Handle this IRP - All storage drivers must support this request. For more information, see IRP_MJ_SYSTEM_CONTROL.
  • IRP_MJ_WRITE
    • Drivers Required to Handle this IRP - Disk and tape drivers must handle this request. For more information, see IRP_MJ_WRITE.
    • General Description - Transfers data from system memory to the underlying device. The Information field of the I/O Status Block is set to the number of bytes that are transferred, whatever the Status field's value. Possible values are any of those returned for read requests, STATUS_MEDIA_WRITE_PROTECTED returned by drivers of removable-media devices, and STATUS_NOT_SUPPORTED returns by the system for drivers that have no DispatchWrite routine.
    • Input - Drivers of disk and tape devices generally use direct I/O, so the lowest-level driver transfers data by 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 handle for the opened file object that represents that the device has requested data be written to the device. This request can also be issued by a higher-level driver.

Errors returned by these IRPs vary according to the device, the minor IRP number, and for device control IRPs, the IOCTL value. The following list identifies some common errors:

Device Errors

STATUS_INVALID_DEVICE_REQUEST
STATUS_NO_SUCH_DEVICE
STATUS_IO_TIMEOUT
STATUS_DEVICE_NOT_CONNECTED 
STATUS_IO_DEVICE_ERROR 
STATUS_DEVICE_NOT_READY 
STATUS_DEVICE_BUSY 

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

 

 

Send comments about this topic to Microsoft

Show: