The DispatchRead routine services IRPs containing the IRP_MJ_READ I/O function code.
NTSTATUS
XxxDispatchRead(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
If the routine succeeds, it must return STATUS_SUCCESS. Otherwise, it must return one of the error status values defined in ntstatus.h.
A driver's DispatchRead routine should be named XxxDispatchRead, where Xxx is a driver-specific prefix. The driver's DriverEntry routine must store the DispatchRead routine's address in DriverObject->MajorFunction[IRP_MJ_READ].
Input parameters for all Dispatch routines are supplied in the IRP structure pointed to by Irp. Additional parameters are supplied in the driver's associated I/O stack location, which is described by the IO_STACK_LOCATION structure and can be obtained by calling IoGetCurrentIrpStackLocation.
Generally, all Dispatch routines execute in an arbitrary thread context at IRQL = PASSIVE_LEVEL, but there are exceptions. For more information, see Dispatch Routines and IRQLs.
For more information about DispatchRead routines, see Writing Dispatch Routines. For more information about IRPs, see Handling IRPs.