9.1.3 Basic CustomDpc Routine Requirements
On entry, any context information passed to a CustomDpc routine is driver-determined. That is, the ISR can pass pointers to any relevant context it has set up at SystemArgument1 and/or SystemArgument2 when it calls KeInsertQueueDpc with the Dpc object pointer representing the driver’s CustomDpc routine. Note that a driver must specify a DeferredContext pointer for its CustomDpc routine when it initializes its DPC object, so such a driver’s ISR also can set up context for the CustomDpc routine at DeferredContext.
Frequently, an ISR passes pointers to the device extension of the target device object for each interrupt-driven I/O operation and a pointer to the current IRP to its CustomDpc routines. Each CustomDpc routine is responsible for completing some task, associated with an interrupt-driven I/O operation, of the driver designer’s choice.
If an NT device driver has no DpcForIsr routine, its CustomDpc routine(s) are responsible for carrying out the same basic operations as a DpcForIsr routine. That is, the driver’s CustomDpc routine(s) are responsible, in general, for the following:
·Completing the I/O processing requested by the current IRP for the target device object that caused the interrupt on the device, using context set up by the ISR
·Seeing that the next IRP is processed as soon as possible, possibly by calling IoStartNextPacket or IoStartNextPacketByKey so the driver’s StartIo routine will start the next requested I/O operation on the target device
If an NT device driver manages its own queueing, a CustomDpc routine must have some way of notifying the driver to dequeue the next IRP and begin device I/O processing for the next request.
·Setting the I/O status block in the current IRP and calling IoCompleteRequest with this just completed request
For more information about the functionality of CustomDpc routines, see also Section 9.2.