IoCsqInsertIrp function

The IoCsqInsertIrp routine inserts an IRP in the driver's cancel-safe IRP queue.

Syntax

NTKERNELAPI VOID IoCsqInsertIrp(
  PIO_CSQ             Csq,
  PIRP                Irp,
  PIO_CSQ_IRP_CONTEXT Context
);

Parameters

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.

Irp

Pointer to the IRP to be queued.

Context

Pointer to an IO_CSQ_IRP_CONTEXT structure. IoCsqInsertIrp initializes this structure with context information for the inserted IRP. The driver passes this value to IoCsqRemoveIrp to delete the IRP from the queue. Context can be NULL if the driver will not use IoCsqRemoveIrp to remove this IRP from the queue.

Return Value

None

Remarks

IoCsqInsertIrp uses the queue's dispatch routines to insert the IRP. The IoCsqInsertIrp routine:

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

  2. Calls the queue's CsqInsertIrp routine to insert the IRP.

  3. Marks the IRP as pending.

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

If the IRP to be inserted has already been canceled, IoCsqInsertIrp does not attempt to insert the IRP into the queue.

Drivers can also use IoCsqInsertIrpEx to insert an IRP into the queue. For a queue that is specified by IoCsqInitializeEx, IoCsqInsertIrpEx provides additional capabilities. For more information, see Cancel-Safe IRP Queues.

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

Requirements

   
Windows version 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)"
DDI compliance rules IoAllocateFree, IoReuseIrp, IrpCancelField, RemoveLockCheck, RemoveLockForward, RemoveLockForward2, RemoveLockForwardDeviceControl, RemoveLockForwardDeviceControl2, RemoveLockForwardDeviceControlInternal, RemoveLockForwardDeviceControlInternal2, RemoveLockForwardRead, RemoveLockForwardRead2, RemoveLockForwardWrite, RemoveLockForwardWrite2, RemoveLockReleaseCleanup, RemoveLockReleaseClose, RemoveLockReleaseCreate, RemoveLockReleaseDeviceControl, RemoveLockReleaseInternalDeviceControl, RemoveLockReleasePower, RemoveLockReleaseRead, RemoveLockReleaseShutdown, RemoveLockReleaseSystemControl, RemoveLockReleaseWrite

See Also

CsqAcquireLock

CsqCompleteCanceledIrp

CsqInsertIrp

CsqInsertIrpEx

CsqPeekNextIrp

CsqReleaseLock

CsqRemoveIrp

IO_CSQ

IO_CSQ_IRP_CONTEXT

IoCsqInitialize

IoCsqInitializeEx

IoCsqInsertIrpEx

IoCsqRemoveIrp

IoCsqRemoveNextIrp