6.1 Dispatch Routine Requirements

Processing any IRP begins in the Dispatch routine that the DriverEntry routine set up to handle the given major function code (IRP_MJ_XXX), which is set in the driver’s I/O stack location of each incoming IRP.

Most NT drivers’ Dispatch routines are called in an arbitrary thread context at IRQL PASSIVE_LEVEL, with the following exceptions:

The driver writer determines how many Dispatch routines any NT driver has. An NT driver can have as many Dispatch routines as the IRP_MJ_XXX  function codes the driver handles, as already mentioned in Chapter 4.