A minifilter driver calls the FltCheckOplockEx routine to synchronize the callback data structure for an IRP-based file I/O operation that has the current opportunistic lock (oplock) state of the file.
FLT_PREOP_CALLBACK_STATUS FLTAPI FltCheckOplockEx( POPLOCK Oplock, PFLT_CALLBACK_DATA CallbackData, ULONG Flags, PVOID Context, PFLTOPLOCK_WAIT_COMPLETE_ROUTINE WaitCompletionRoutine, PFLTOPLOCK_PREPOST_CALLBACKDATA_ROUTINE PrePostCallbackDataRoutine );
An opaque oplock pointer for the file. This pointer must have been initialized by a previous call to FltInitializeOplock.
A pointer to the callback data (FLT_CALLBACK_DATA) structure for the I/O operation.
A bitmask for the associated file I/O operation. A minifilter driver sets bits to specify the behavior of FltCheckOplockEx. The Flags parameter has the following options:
Allows an opportunistic lock break to proceed without blocking or pending the operation that caused the oplock break.
Specifies that FltCheckOplockEx should only check for an opportunistic lock key on the FILE_OBJECT that is associated with the I/O operation. This I/O operations is represented by the callback data that the CallbackData parameter points to. FltCheckOplockEx must then add the key if one is provided in the I/O operation. No other oplock processing occurs; that is, no opportunistic lock break will occur.
Specifies that FsRtlCheckOplockEx should revert any state that was previously set up through a call to the FltOplockFsctrl routine. FltOplockFsctrl is called when an IRP_MJ_CREATE request is processed. This IRP_MJ_CREATE request specifies the FILE_OPEN_REQUIRING_OPLOCK flag in the create options parameter. The OPLOCK_FLAG_BACK_OUT_ATOMIC_OPLOCK flag is typically used in final processing of such a create request when it previously failed.
Allows all opportunistic lock breaks to proceed regardless of the opportunistic lock key.
A pointer to caller-defined context information to be passed to the callback routines that WaitCompletionRoutine and PrePostCallbackDataRoutine point to. The Filter Manager treats this information as opaque.
A pointer to a caller-supplied callback routine. If an oplock break is in progress, the Filter Manager calls this routine when the oplock break is completed. This parameter is optional and can be NULL. If it is NULL, the caller is put into a wait state until the oplock break is completed.
This routine is declared as follows:
typedef VOID (*PFLTOPLOCK_WAIT_COMPLETE_ROUTINE) ( IN PFLT_CALLBACK_DATA CallbackData, IN PVOID Context );
PrePostCallbackDataRoutineA pointer to a caller-supplied callback routine to be called if the I/O operation is posted to a work queue. This parameter is optional and can be NULL. This routine is declared as follows:
typedef VOID (*PFLTOPLOCK_PREPOST_CALLBACKDATA_ROUTINE) ( IN PFLT_CALLBACK_DATA CallbackData, IN PVOID Context );
A pointer to the callback data structure for the I/O operation.
A context information pointer that was passed in the Context parameter to FltCheckOplockEx.
FltCheckOplockEx returns one of the following FLT_PREOP_CALLBACK_STATUS codes:
||FltCheckOplockEx encountered a pool allocation failure, or a call to the FsRtlCheckOplockEx function returned an error. FltCheckOplockEx sets the error code in the Status member of the IO_STATUS_BLOCK structure of the IoStatus member of the FLT_CALLBACK_DATA callback data structure. The CallbackData parameter points to this FLT_CALLBACK_DATA structure.|
||An oplock break was initiated, which caused the Filter Manager to post the I/O operation to a work queue. The I/O operation is represented by the callback data that the CallbackData parameter points to.|
||The callback data that the CallbackData parameter points to was not pended, and the I/O operation was performed immediately. Be aware that if the caller specified OPLOCK_FLAG_COMPLETE_IF_OPLOCKED in the Flags parameter, an oplock break might actually be in progress even though the I/O operation was not pended. To determine whether this is the situation, the caller should check for STATUS_OPLOCK_BREAK_IN_PROGRESS in the Status member of the IO_STATUS_BLOCK structure of the IoStatus member of the FLT_CALLBACK_DATA callback data structure.|
A minifilter driver calls FltCheckOplockEx to synchronize an IRP-based I/O operation with the current oplock state of a file according to the following conditions:
If the I/O operation will cause the oplock to break, the oplock break is initiated.
If the I/O operation cannot continue until the oplock break is complete, FltCheckOplockEx returns FLT_PREOP_PENDING and calls the callback routine that the PrePostCallbackDataRoutine parameter points to.
The I/O 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.
Minifilters must not call FltCheckOplockEx again within the callback specified in WaitCompletionRoutine. Doing so can result in a deadlock condition if the oplock package calls the completion callback before FltCheckOplockEx returns.
For more information about opportunistic locks, see the Microsoft Windows SDK documentation.
|Windows version||The FltCheckOplockEx routine is available starting with Windows 7.|
|Header||fltkernel.h (include Fltkernel.h)|