Each driver-specific I/O stack location (IO_STACK_LOCATION) for every IRP contains a major function code (IRP_MJ_XXX), which tells the driver what operation it or the underlying device driver should carry out to satisfy the I/O request. 每个内核模式驱动程序必须为它必须支持的主要函数代码提供调度例程。
The specific operations a driver carries out for a given IRP_MJ_XXX code depend somewhat on the underlying device, particularly for IRP_MJ_DEVICE_CONTROL and IRP_MJ_INTERNAL_DEVICE_CONTROL requests. 例如,发送到键盘驱动程序的请求与发送到磁盘驱动程序的请求一定有些不同。 但是,I/O 管理器为每个系统定义的主要函数代码定义参数和 I/O 堆栈位置内容。
Every higher-level driver must set up the appropriate I/O stack location in IRPs for the next-lower-level driver and call IoCallDriver, either with each input IRP, or with a driver-created IRP (if the higher-level driver holds on to the input IRP). 因此,每个中间驱动程序必须为基础设备驱动程序处理的每个主要函数代码提供调度例程。 否则,每当应用程序或更高级别的驱动程序尝试将 I/O 请求向下发送到基础设备驱动程序时,新的中间驱动程序都会“中断链”。
File system drivers and legacy file system filter drivers also handle a required subset of system-defined IRP_MJ_XXX function codes, some with subordinate IRP_MN_XXX function codes. 有关如何处理这些 IRP 的详细信息,请参阅 文件系统驱动程序和旧版 FS 筛选器驱动程序的 IRP 主要函数代码。
驱动程序处理使用以下部分或全部主要函数代码设置的 IRP:
IRP_MJ_INTERNAL_DEVICE_CONTROL
本节中所述的输入和输出参数是 IRP 中特定于函数的参数。
For more information about IRPs, see Handling IRPs.