The DispatchReadWrite routine services IRPs containing the IRP_MJ_READ or IRP_MJ_WRITE I/O function code.
NTSTATUS
XxxDispatchReadWrite(
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 can provide a single DispatchReadWrite routine instead of separate DispatchRead and DispatchWrite routines.
A driver's DispatchReadWrite routine should be named XxxDispatchReadWrite, where Xxx is a driver-specific prefix. The driver's DriverEntry routine must store the DispatchReadWrite routine's address in DriverObject->MajorFunction[IRP_MJ_READ] and in DriverObject->MajorFunction[IRP_MJ_WRITE].
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 DispatchReadWrite routines, see Writing Dispatch Routines. For more information about IRPs, see Handling IRPs.