13.1 Using IoCompletion Routines

At the discretion of the driver designer, any higher-level NT driver can have as many IoCompletion routines as the driver needs to complete IRPs for various kinds of operations.

An IoCompletion routine is run at IRQL <= DISPATCH_LEVEL and in an arbitrary thread context. A driver writer cannot make assumptions about the IRQL at which an IoCompletion routine will be called.

    Consider the following a design guideline for IoCompletion routines 

Assume that every IoCompletion routine always runs at IRQL DISPATCH_LEVEL.

Running at IRQL DISPATCH_LEVEL restricts the set of support routines an IoCompletion routine can call.

For more information about managing IRQLs in NT drivers, see Chapter 16. For specific information about the IRQL(s) at which any particular support routine can be called, see the Kernel-mode Driver Reference.