13.1.2 Calling IoSetCompletionRoutine

The most common uses for higher-level drivers’ IoCompletion routines are the following:

In other words, an NT highest-level or intermediate driver’s DispatchReadWrite routine usually determines whether a given IRP requires the driver to set up an IoCompletion routine. At the discretion of the driver designer, such a driver’s DispatchDeviceControl or other Dispatch routine(s) also can set up an IoCompletion routine for any given IRP that is passed on to lower drivers.

For driver-allocated and reused IRPs, the Dispatch routine must call IoSetCompletionRoutine with the following Boolean parameters: