Expand Minimize

IoCsqRemoveNextIrp routine

The IoCsqRemoveNextIrp routine removes the next matching IRP in the queue.

Syntax


PIRP IoCsqRemoveNextIrp(
  _Inout_   PIO_CSQ Csq,
  _In_opt_  PVOID PeekContext
);

Parameters

Csq [in, out]

Pointer to the driver's dispatch table for cancel-safe IRP queues. The dispatch table must be initialized by IoCsqInitialize.

PeekContext [in, optional]

A pointer to a driver-defined context value. IoCsqRemoveNextIrp passes this parameter to the driver's CsqPeekNextIrp routine. For more information, see the following Remarks section.

Return value

This routine returns a pointer to the next matching IRP in the queue, or NULL if no more IRPs are available. The routine only returns IRPs that have not yet been canceled.

Remarks

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

  1. Calls the queue's CsqAcquireLock routine to lock the queue.

  2. Calls the queue's CsqPeekNextIrp routine to find the next matching IRP in the queue. IoCsqRemoveNextIrp passes the value of the PeekContext parameter as the PeekContext parameter of CsqPeekNextIrp. CsqPeekNextIrp returns a pointer to the next matching IRP, or NULL if there is no matching IRP.

  3. If the return value of CsqPeekNextIrp is non-NULL, IoCsqRemoveNextIrp calls the queue's CsqRemoveIrp routine to remove the IRP.

  4. Calls the queue's CsqReleaseLock routine to unlock the queue.

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 IoCsqRemoveNextIrp must be running at an IRQL <= DISPATCH_LEVEL. The driver's callback routines must work correctly at that IRQL.

Requirements

Version

Available in Windows XP and later versions of Windows. Drivers that must also work on Windows 2000 and Windows 98/Me can instead link to Csq.lib to use the routine.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

<= DISPATCH_LEVEL (see Remarks section)

See also

IO_CSQ
IoCsqInitialize
IoCsqInitializeEx
IoCsqInsertIrp
IoCsqInsertIrpEx
IoCsqRemoveIrp
CsqAcquireLock
CsqCompleteCanceledIrp
CsqInsertIrp
CsqInsertIrpEx
CsqPeekNextIrp
CsqReleaseLock
CsqRemoveIrp

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft