最近在看东辉主防和A盾代码,有一些手动下发IRP的代码,不是很懂,就翻开WDK看了下处理IRP的相关章节,顺便做了翻译。
翻译的应该还是比较通顺的,但我也是内核新手,有些地方不是很明白。对于有可能翻译错误的地方,译文后都备有原文,这些地方推荐读原文,以免被误导了。另外,我把翻译过程中的疑问整理如下,希望有大牛可以解答,然后我会更新一下文档。
Handling IRPs
The Life of an I/O Request
Example I/O Request - The Details
原句:If they are, the driver usually calls I/O support routines to tell the I/O manager that a device operation is pending on the IRP
疑问:"a device operation is pending on the IRP",这句该如何翻译?
原句:Each driver-created device object represents a physical, logical, or virtual device for which a particular driver carries out I/O requests.
疑问:“for which a particular driver carries out I/O requests”,这句该如何翻译?
Completing IRPs
Using IoCompletion Routines
Implementing an IoCompletion Routine
原句:When the IoCompletion routine has processed and freed the driver-allocated IRP, the routine must return control with STATUS_MORE_PROCESSING_REQUIRED.
疑问:“return control”,是把控制权返回给谁了?是指通过设置事件,然后返回STATUS_MORE_PROCESSING_REQUIRED,把控制权返回给派遣例程?
Using I/O Control Codes
Creating IOCTL Requests in Drivers
原句:With the exception of certain SCSI requests, the buffers at Irp->AssociatedIrp.SystemBuffer, at Irp->MdlAddress, and at Parameters.DeviceIoControl.Type3InputBuffer in a driver's I/O stack location do not contain pointers to other data buffers, nor do they contain structures that contain pointers, for system-defined I/O control codes
疑问:"do not contain pointers to other data buffers",原意是不包含指向其他数据缓冲区的指针。但是,上面列举的几个属性,不都是(直接或间接)指向数据缓冲区的指针么?还是说“其他数据缓冲区”有什么具体的含义?
Defining I/O Control Codes
原句:Note that the vendor-assigned values set the Common bit. / Note that the vendor-assigned values set the Custom bit.
疑问:是指,根据是系统定义的,还是供应商提供的,来设置Common/Custom位为0或者1吗?
IRP Processing Examples
Processing IRPs in an Intermediate-Level Driver
原句:because the IRP is not associated with a thread, its completion processing should end with the driver that created it.
疑问:"completion processing should end with the driver that created it",completion processing,是IO管理器来做的吧?这句是啥意思?