6.1.1 Commonly Implemented Dispatch Routines
In general, most NT drivers must handle some or all of the following requests:
-
IRP_MJ_CREATE indicates either that a user-mode protected subsystem, possibly
on behalf of an application or subsystem-specific driver, has requested a
handle for the file object associated with the target device object, or that a
higher-level NT driver is connecting or attaching its device object to the
target device object.
-
IRP_MJ_CLEANUP indicates that the handle for the file object, representing the
target device object, is being closed, so any IRPs currently queued to the
target device for the given file object, found in the driver’s I/O stack
location of the cleanup IRP, should be cancelled.
-
IRP_MJ_CLOSE indicates that the handle of the file object that represents the
target device object or a pointer to the target device object has been closed
and that there are no outstanding references to the file object pointer.
-
IRP_MJ_READ indicates an I/O request to transfer data from the underlying
physical device to the system.
-
IRP_MJ_WRITE indicates an I/O request to transfer data from the system to the
underlying physical device.
-
IRP_MJ_DEVICE_CONTROL indicates a request with a system-defined,
device-type-specific I/O control code specifying a particular device operation
is being sent to a device driver.
For more information about the system-defined (sometimes called public)
I/O control codes that NT device drivers must support, see the Kernel-mode
Driver Reference. Note that higher-level NT drivers also must support
IRP_MJ_DEVICE_CONTROL to pass these IRPs on to their underlying device
drivers.
-
IRP_MJ_INTERNAL_DEVICE_CONTROL indicates a request sent to the device driver,
in most cases from a closely coupled higher-level driver, usually with a
privately defined, driver-specific and device-type-specific or device-specific
I/O control code requesting a device-type-specific or device-specific
operation.
Only certain kinds of NT drivers are required to handle system-defined
internal device I/O control requests, including certain SCSI drivers, keyboard
or mouse device drivers, and parallel drivers that interoperate with
system-supplied drivers.
The Dispatch routine entry points that any NT driver must set in its driver
object vary according to the type and functionality of the underlying physical
device. For device-type-specific information about IRP major function codes
that NT device drivers must handle, see the Kernel-Mode Driver Reference.
For information about SCSI and video miniport drivers, see Appendix
A and the Kernel-Mode Graphics Driver Guide, respectively. For more
information about other types of SCSI drivers, see also Appendix
A.