7.2.2.1 Device Driver’s StartIo Routine Using Buffered I/O

Assuming its DispatchRead, DispatchWrite, or DispatchDeviceControl routine determined that a request was valid and called IoStartPacket, a device driver’s StartIo routine is called to process the packet immediately if the device is not already busy. If the packet is queued by IoStartPacket, eventually a call to IoStartNextPacket from the driver’s DpcForIsr or CustomDpc routine causes the StartIo routine to be called with the dequeued IRP.

The StartIo routine calls IoGetCurrentIrpStackLocation and determines which operation must be performed to satisfy the request. It preprocesses the IRP in any way necessary before programming the physical device to carry out the I/O request.

The StartIo routine must call a device driver’s SynchCritSection routine to perform the necessary device programming if access to the physical device (and/or the device extension) must be synchronized with that driver’s ISR. For more information, see Section 7.2.3.

An NT device driver that uses buffered I/O either transfers data into (reads) or from (writes) a system-space buffer, allocated by the I/O Manager, that the driver finds in each IRP at Irp->AssociatedIrp.SystemBuffer.