Dispatch Routine Functionality
The required functionality of a particular dispatch routine varies, depending on the I/O function code it handles, on the individual driver's position in a chain of drivers, and on the type of underlying physical device.
Most dispatch routines process incoming I/O request packets (IRPs) as follows:
Check the driver's I/O stack location in the IRP to determine what to do and check the parameters, if any, for validity.
Whether a driver must check its I/O stack location to determine what to do and to check parameters depends on the given IRP_MJ_XXX, as well as on whether that driver set up a separate Dispatch routine for each IRP_MJ_XXX that the driver handles.
Satisfy the request and complete the IRP if possible; otherwise, pass it on for further processing by lower-level drivers or by other device driver routines.
Whether a driver must pass on an IRP for further processing depends on the validity of the parameters, if any, as well as on the IRP_MJ_XXX and on the driver's level, if any, in a chain of layered drivers.
For more information about IRPs, see Handling IRPs.