This chapter contains the following information:
12.1 Cancel Routine Requirements
12.1.1 Cancel Routines in NT Drivers
12.1.2 Cancelable IRPs in Higher-Level Drivers without Cancel Routines
12.3 Cancel Routine Functionality
12.4 Points to Consider In Handling Cancelable IRPs
The Cancel routine is defined by the I/O Manager as follows:
VOID
(*PDRIVER_CANCEL) (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
);
This chapter summarizes the required functionality of an NT driver’s standard Cancel routine(s) and guidelines for managing cancelable IRPs in other driver routines.
Two members in the IRP contain key information concerning cancellation:
·Irp->Cancel indicates whether an IRP is being cancelled or should be cancelled.
·Irp->CancelRoutine indicates whether an IRP is cancelable. If this member contains a pointer to a cancel routine, then the IRP is cancelable. If this member is NULL, then the IRP is not cancelable. If this member is NULL, but Irp->Cancel is set, that indicates that the cancel routine is running and the IRP is in the process of being cancelled.