The DispatchWrite routine services IRPs containing the IRP_MJ_WRITE I/O function code.
NTSTATUS
XxxDispatchWrite(
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 DispatchWrite routine should be named XxxDispatchWrite, where Xxx is a driver-specific prefix. The driver's DriverEntry routine must store the DispatchWrite routine's address 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 DispatchWrite routines, see Writing Dispatch Routines. For more information about IRPs, see Handling IRPs.