IoCsqRemoveIrp function (wdm.h)

The IoCsqRemoveIrp routine removes a particular IRP from the queue.

Syntax

PIRP IoCsqRemoveIrp(
  [in, out] PIO_CSQ             Csq,
  [in, out] PIO_CSQ_IRP_CONTEXT Context
);

Parameters

[in, out] Csq

Pointer to the IO_CSQ structure for the driver's cancel-safe IRP queue. This structure must have been initialized by IoCsqInitialize or IoCsqInitializeEx.

[in, out] Context

Pointer to the IO_CSQ_IRP_CONTEXT structure that identifies the IRP to remove. The IO_CSQ_IRP_CONTEXT structure is initialized by IoCsqInsertIrp or IoCsqInsertIrpEx when the IRP is first inserted in the queue.

Return value

This routine returns a pointer to the IRP that was removed from the queue, or NULL if that IRP has been canceled.

Remarks

IoCsqRemoveIrp uses the queue's dispatch routines to remove the IRP. The IoCsqRemoveIrp routine:

  1. Calls the queue's CsqAcquireLock routine to lock the queue.
  2. Uses the IrpContext parameter to determine which IRP to remove, and calls the queue's CsqRemoveIrp routine to remove that IRP.
  3. Calls the queue's CsqReleaseLock routine to unlock the queue.
Drivers can use the IoCsqRemoveNextIrp routine to remove an IRP that matches a specific criterion. For more information, see Cancel-Safe IRP Queues.

Note that IoCsqXxx routines use the DriverContext[3] member of the IRP to hold IRP context information. Drivers that use these routines to queue IRPs must leave that member unused.

Callers of IoCsqRemoveIrp must be running at an IRQL <= DISPATCH_LEVEL. The driver's callback routines must work correctly at that IRQL.

Requirements

Requirement Value
Minimum supported client Available in Windows XP and later versions of Windows. Drivers that must also work in Windows 2000 and Windows 98/Me can instead link to Csq.lib to use the routine.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= DISPATCH_LEVEL (see Remarks section)

See also

CsqAcquireLock

CsqCompleteCanceledIrp

CsqInsertIrp

CsqInsertIrpEx

CsqPeekNextIrp

CsqReleaseLock

CsqRemoveIrp

IO_CSQ

IO_CSQ_IRP_CONTEXT

IoCsqInitialize

IoCsqInitializeEx

IoCsqInsertIrp

IoCsqInsertIrpEx

IoCsqRemoveNextIrp