This chapter contains the following information:
6.1 Dispatch Routine Requirements
6.1.1 Commonly Implemented Dispatch Routines
6.1.2 Conditionally Implemented Dispatch Routines
6.2 Basic Dispatch Routine Functionality
6.2.1 When to Check the I/O Stack Location
6.2.2 How to Complete an IRP in a Dispatch Routine
6.2.3 When to Complete an IRP in the Dispatch Routine
6.2.4 How to Pass IRPs with Valid Parameters on from a Dispatch Routine
6.2.5 Allocating IRPs for Lower-Level Drivers
6.2.6 Handling Asynchronous Transfer Requests
6.3 Designing Dispatch Routines
6.3.1 DispatchCreate and DispatchClose Functionality
6.3.1.1 Basic DispatchCreateClose Routines
6.3.1.2 Points to Consider in Implementing DispatchCreateClose
6.3.2 DispatchCleanup Functionality
6.3.3 DispatchRead and/or DispatchWrite Functionality
6.3.3.1 DispatchReadWrite Using Buffered I/O
6.3.3.2 DispatchReadWrite Using Direct I/O
6.3.3.3 DispatchReadWrite in Higher-Level Drivers
6.3.3.4 Points to Consider in Implementing DispatchReadWrite
6.3.4 Dispatch(Internal)DeviceControl Functionality
6.3.4.1 DispatchDeviceControl in Lowest-Level Drivers
6.3.4.2 DispatchDeviceControl in Higher-Level Drivers
6.3.4.3 Dispatch(Internal)DeviceControl in Class/Port Drivers
6.3.4.4 Points to Consider in Implementing Dispatch(Internal)DeviceControl
The Dispatch routine is defined by the I/O Manager as follows:
NTSTATUS
(*PDRIVER_DISPATCH) (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
This chapter summarizes the required functionality of NT drivers’ standard Dispatch routines and some guidelines for the most commonly implemented Dispatch routines.