IO_CSQ_COMPLETE_CANCELED_IRP callback function (wdm.h)
The CsqCompleteCanceledIrp routine is used by the system to signal to the driver that it can complete a canceled IRP.
Syntax
IO_CSQ_COMPLETE_CANCELED_IRP IoCsqCompleteCanceledIrp;
void IoCsqCompleteCanceledIrp(
[in] PIO_CSQ Csq,
[in] PIRP Irp
)
{...}
Parameters
[in] Csq
Pointer to the IO_CSQ structure for the cancel-safe IRP queue.
[in] Irp
Pointer to the IRP to be canceled.
Return value
None
Remarks
The driver specifies the CsqCompleteCanceledIrp routine for a cancel-safe IRP queue when it initializes the queue's IO_CSQ structure. The driver specifies the routine as the CsqCompleteCanceledIrp parameter of IoCsqInitialize or IoCsqInitializeEx when it initializes IO_CSQ. For more information, see Cancel-Safe IRP Queues.
The system calls this routine to complete a canceled IRP that has been removed from the driver's queue. Normally, drivers just call IoCompleteRequest for the IRP with a status of STATUS_CANCELLED.
Drivers are not required to remove the IRP from the queue before completing it as canceled: the system always calls the queue's CsqRemoveIrp routine to remove the IRP from the queue before calling CsqCompleteCanceledIrp.
Examples
To define a CsqCompleteCanceledIrp 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 CsqCompleteCanceledIrp callback routine that is named MyCsqCompleteCanceledIrp
, use the IO_CSQ_COMPLETE_CANCELED_IRP type as shown in this code example:
IO_CSQ_COMPLETE_CANCELED_IRP MyCsqCompleteCanceledIrp;
Then, implement your callback routine as follows:
_Use_decl_annotations_
VOID
MyCsqCompleteCanceledIrp(
_In_ PIO_CSQ Csq,
_In_ PIRP Irp
)
{
// Function body
}
The IO_CSQ_COMPLETE_CANCELED_IRP 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_COMPLETE_CANCELED_IRP 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) |