This topic has not yet been rated - Rate this topic

CsqPeekNextIrp routine

The CsqPeekNextIrp routine is used by the system to find the next matching IRP in a driver-implemented, cancel-safe IRP queue.

Syntax


IO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp;

PIRP CsqPeekNextIrp(
  _In_      PIO_CSQ Csq,
  _In_opt_  PIRP Irp,
  _In_opt_  PVOID PeekContext
)
{ ... }

Parameters

Csq [in]

Pointer to the IO_CSQ structure for the cancel-safe IRP queue.

Irp [in, optional]

Pointer to an IRP in the driver's IRP queue, or NULL to specify the beginning of the queue.

PeekContext [in, optional]

Pointer to driver-defined context information. The CsqPeekNextIrp routine returns the first IRP that follows Irp and matches PeekContext.

Return value

CsqPeekNextIrp returns the first IRP that follows Irp in the queue and matches PeekContext, or NULL if there is no matching IRP. If Irp is NULL, CsqPeekNextIrp returns the first matching IRP in the queue, or NULL if there is no matching IRP.

Remarks

The driver specifies the CsqPeekNextIrp routine for a cancel-safe IRP queue when it initializes the queue's IO_CSQ structure. The driver specifies the routine as the CsqPeekNextIrp parameter of IoCsqInitialize or IoCsqInitializeEx when it initializes IO_CSQ. For more information, see Cancel-Safe IRP Queues.

The system uses CsqPeekNextIrp to iterate through the IRPs in the driver's IRP queue. For example, the IoCsqRemoveNextIrp routine uses this routine to find the IRP to be removed.

Examples

To define a CsqPeekNextIrp callback routine that is named MyCsqPeekNextIrp, you must first provide a function declaration that Static Driver Verifier (SDV) and other verification tools require, as shown in the following code example:


IO_CSQ_PEEK_NEXT_IRP MyCsqPeekNextIrp;

Then, implement your callback routine as follows:


PIRP 
 MyCsqPeekNextIrp(
    _In_ PIO_CSQ  Csq,
    _In_opt_ PIRP  Irp,
    _In_opt_ PVOID  PeekContext
    )
  {
      // Function body
  }

The IO_CSQ_PEEK_NEXT_IRP function type is defined in the Wdm.h header file. For more information about SDV requirements for function declarations, see Declaring Functions Using Function Role Types for WDM Drivers.

Requirements

Header

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

See also

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

 

 

Send comments about this topic to Microsoft

Build date: 5/22/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.