IO_CSQ_INSERT_IRP_EX callback function (wdm.h)

The CsqInsertIrpEx routine is used by the system to insert an IRP into a driver-implemented, cancel-safe IRP queue.

Syntax

IO_CSQ_INSERT_IRP_EX IoCsqInsertIrpEx;

NTSTATUS IoCsqInsertIrpEx(
  [in] _IO_CSQ *Csq,
  [in] PIRP Irp,
  [in] PVOID InsertContext
)
{...}

Parameters

[in] Csq

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

[in] Irp

Pointer to the IRP to insert into the IRP queue.

[in] InsertContext

Pointer to driver-defined context for the insert operation.

Return value

CsqInsertIrpEx returns STATUS_SUCCESS if the IRP has been successfully inserted, or the appropriate error code on failure.

Remarks

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

The IoCsqInsertIrpEx routine calls CsqInsertIrpEx to insert the IRP into the queue. The InsertContext parameter of IoCsqInsertIrpEx is passed as the InsertContext parameter of CsqInsertIrpEx.

Examples

To define a CsqInsertIrpEx callback routine, you must first provide a function declaration that identifies the type of callback routine you're defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it's a requirement for writing drivers for the Windows operating system.

For example, to define a CsqInsertIrpEx callback routine that is named MyCsqInsertIrpEx, use the IO_CSQ_INSERT_IRP_EX type as shown in this code example:

IO_CSQ_INSERT_IRP_EX MyCsqInsertIrpEx;

Then, implement your callback routine as follows:

_Use_decl_annotations_
NTSTATUS
 MyCsqInsertIrpEx(
    struct _IO_CSQ  *Csq,
    PIRP  Irp,
    PVOID  InsertContext
    )
  {
      // Function body
  }

The IO_CSQ_INSERT_IRP_EX function type is defined in the Wdm.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the IO_CSQ_INSERT_IRP_EX function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for WDM Drivers. For information about _Use_decl_annotations_, see Annotating Function Behavior.

Requirements

Requirement Value
Target Platform Desktop
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)

See also

CsqAcquireLock

CsqCompleteCanceledIrp

CsqInsertIrp

CsqPeekNextIrp

CsqReleaseLock

CsqRemoveIrp

IO_CSQ

IoCsqInitialize

IoCsqInitializeEx

IoCsqInsertIrp

IoCsqInsertIrpEx

IoCsqRemoveIrp

IoCsqRemoveNextIrp