The FltQueueDeferredIoWorkItem routine posts an IRP-based I/O operation to a work queue.
NTSTATUS FLTAPI FltQueueDeferredIoWorkItem( PFLT_DEFERRED_IO_WORKITEM FltWorkItem, PFLT_CALLBACK_DATA Data, PFLT_DEFERRED_IO_WORKITEM_ROUTINE WorkerRoutine, WORK_QUEUE_TYPE QueueType, PVOID Context );
A pointer to the work item to add to the work queue. The work item must have been allocated by calling FltAllocateDeferredIoWorkItem.
A pointer to the callback data (FLT_CALLBACK_DATA) structure for the I/O operation. The operation must be an IRP-based 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.
A pointer to a caller-supplied worker routine. This routine is declared as follows:
typedef VOID (*PFLT_DEFERRED_IO_WORKITEM_ROUTINE) ( _in PFLT_DEFERRED_IO_WORKITEM FltWorkItem, __in PFLT_CALLBACK_DATA CallbackData, __in_opt PVOID Context );
An opaque pointer to a deferred work item structure.
A pointer to the callback data structure for the I/O operation.
An optional context information pointer that was passed as the Context parameter of FltQueueDeferredIoWorkItem.
This parameter specifies the queue into which the work item that FltWorkItem points to is to be inserted. QueueType can be either of the following.
|CriticalWorkQueue||Insert the work item into the queue from which a system thread with a real-time priority attribute processes the work item.|
|DelayedWorkQueue||Insert the work item into the queue from which a system thread with a variable priority attribute processes the work item.|
The QueueType value HyperCriticalWorkQueue is reserved for system use.
A pointer to caller-defined context information to be passed as the Context parameter of the callback routine specified in the WorkerRoutine parameter.
The FltQueueDeferredIoWorkItem routine returns STATUS_SUCCESS or an appropriate NTSTATUS value such as one of the following:
||The target instance for the I/O operation (Data->Iopb->TargetInstance) is being torn down. This is an error code.|
The I/O operation cannot be posted safely to a worker thread. Possible reasons include the following:
The FltQueueDeferredIoWorkItem routine posts an I/O operation to a system work queue. The specified WorkerRoutine callback routine is called in the context of a system thread, at IRQL PASSIVE_LEVEL.
The operation must be an IRP-based 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.
A minifilter driver can use FltQueueDeferredIoWorkItem in a preoperation callback (PFLT_PRE_OPERATION_CALLBACK) routine as follows:
The preoperation callback calls FltAllocateDeferredIoWorkItem to allocate the work item.
The preoperation callback calls FltQueueDeferredIoWorkItem to post the operation to the work queue.
The preoperation callback returns FLT_PREOP_PENDING.
After processing the I/O operation, the work routine calls FltCompletePendedPreOperation to return the I/O operation to the Filter Manager.
The work routine calls FltFreeDeferredIoWorkItem to free the work item.
The post-operation callback calls FltAllocateDeferredIoWorkItem to allocate the work item.
The post-operation callback calls FltQueueDeferredIoWorkItem to post the operation to the work queue.
The post-operation callback returns FLT_POSTOP_MORE_PROCESSING_REQUIRED.
After processing the I/O operation, the work routine calls FltCompletePendedPostOperation to return the I/O operation to the Filter Manager.
To avoid deadlocks, a minifilter must not post an I/O operation to a system work queue in the post-operation callback for any I/O operations that a driver can complete directly in the storage stack, such as the following:
|Minimum supported client||This routine is available in Microsoft Windows 2000 and later versions of all Windows operating systems.|
|Header||fltkernel.h (include Fltkernel.h)|