IoCancelIrp function (wdm.h)

The IoCancelIrp routine sets the cancel bit in a given IRP and calls the cancel routine for the IRP if there is one.

Syntax

BOOLEAN IoCancelIrp(
  [in] PIRP Irp
);

Parameters

[in] Irp

A pointer to the IRP to be canceled.

Return value

IoCancelIrp returns TRUE if the IRP had a cancel routine and this routine was called. Otherwise, it returns FALSE. In either case, the IRP's cancel bit is set to TRUE. For more information, see Remarks.

Remarks

If the IRP has a cancel routine, IoCancelIrp sets the cancel bit and calls the cancel routine.

If Irp->CancelRoutine is NULL, and therefore the IRP is not cancelable, IoCancelIrp sets the IRP's cancel bit and returns FALSE. The IRP should be canceled at a later time when it becomes cancelable.

If a driver that does not own the IRP calls IoCancelIrp, the results are unpredictable. The IRP might be completed with a successful status even though its cancel bit was set.

An intermediate driver should not arbitrarily call IoCancelIrp unless that driver created the IRP passed in the call. Otherwise, the intermediate driver might cancel an IRP that some higher-level driver is tracking for purposes of its own.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport)

See also

IoSetCancelRoutine