9.2.1  Using Buffered I/O and Satisfying Device Control IRPs

As already mentioned in Chapter 7, NT device drivers that use buffered I/O usually have simpler StartIo routines than those that use direct I/O because the former transfer relatively small amounts of data per interrupt into or from a system-space buffer allocated by the I/O Manager. Most device drivers that use buffered I/O also have simpler DpcForIsr routines than those that use direct I/O.

Even drivers that set up their device objects for direct I/O use buffered I/O for IRP_MJ_DEVICE_CONTROL requests when the I/O control codes are defined with method buffered.

Using buffered I/O, drivers transfer data to or from a system-space buffer, allocated by the I/O Manager, at Irp->AssociatedIrp.SystemBuffer.

The DpcForIsr or CustomDpc routine of any NT device driver usually completes the I/O processing only for a subset of public I/O control codes that the driver must support. In particular, the DPC routine completes operations for device control requests with the following characteristics:

·Requests that change the state of the physical device

·Requests that require the return of inherently volatile information about the physical device

For more information about the system-defined and device-type-specific I/O control codes an NT device driver must support, see the Kernel-mode Driver Reference.