A minifilter driver calls FltSetCancelCompletion to specify a cancel routine to be called if a given I/O operation is canceled.
NTSTATUS FltSetCancelCompletion( _In_ PFLT_CALLBACK_DATA CallbackData, _In_ PFLT_COMPLETE_CANCELED_CALLBACK CanceledCallback );
- CallbackData [in]
Pointer to the callback data (FLT_CALLBACK_DATA) structure for the I/O operation. The operation must be an IRP-based I/O operation and must not be a paging I/O operation. To determine whether a given callback data structure represents an IRP-based I/O operation, use the FLT_IS_IRP_OPERATION macro. This parameter is required and cannot be NULL.
- CanceledCallback [in]
Pointer to a caller-supplied cancel routine. The Filter Manager calls this routine if the I/O operation represented by CallbackData is canceled.
This routine is declared as follows:
typedef VOID (*PFLT_COMPLETE_CANCELED_CALLBACK) ( IN PFLT_CALLBACK_DATA CallbackData );
FltSetCancelCompletion returns STATUS_SUCCESS or an appropriate NTSTATUS value.
FltSetCancelCompletion specifies a cancel routine for an IRP-based I/O operation that is to be posted to a work queue.
Minifilter drivers usually call FltSetCancelCompletion for an I/O operation immediately before calling FltQueueDeferredIoWorkItem to post the operation to a work queue.
Do not call FltSetCancelCompletion for any I/O operation that is to be posted to a cancel-safe callback data queue using the FltCbdqXxx routines.
The Filter Manager calls the CanceledCallback routine without holding the system cancel spin lock or performing any other synchronization. Any required synchronization must be supplied by the minifilter driver itself.
To cancel an I/O operation, call FltCancelIo.