FltProcessFileLock function (fltkernel.h)

The FltProcessFileLock routine processes and completes a file lock operation.

Syntax

FLT_PREOP_CALLBACK_STATUS FLTAPI FltProcessFileLock(
  [in]           PFILE_LOCK         FileLock,
  [in]           PFLT_CALLBACK_DATA CallbackData,
  [in, optional] PVOID              Context
);

Parameters

[in] FileLock

Pointer to the FILE_LOCK structure for the file. This structure must have been initialized by a previous call to FltAllocateFileLock or FltInitializeFileLock.

[in] CallbackData

Pointer to the callback data (FLT_CALLBACK_DATA) structure for the IRP_MJ_LOCK_CONTROL operation.

[in, optional] Context

Context pointer to be used when completing the operation. This context pointer is passed to the CompleteLockCallbackDataRoutine and UnlockRoutine callback routines that the minifilter driver registered in a previous call to FltAllocateFileLock. This parameter is optional and can be NULL.

Return value

FltProcessFileLock returns one of the following.

Return code Description
FLT_PREOP_COMPLETE The Filter Manager is done with the CallbackData, which can now be completed.
FLT_PREOP_DISALLOW_FASTIO The CallbackData represents a fast I/O operation, and a minifilter driver in the stack has disallowed the fast I/O to be used for this operation. The Filter Manager does not send the operation to any minifilter drivers below the one that disallowed the operation. In this case, the Filter Manager only calls the postoperation callback routines (and CompleteLockCallbackDataRoutine callbacks) of the minifilter drivers above the minifilter driver that disallowed the fast I/O operation.
FLT_PREOP_PENDING The lock operation has been pended.

Remarks

FltProcessFileLock processes a file lock (IRP_MJ_LOCK_CONTROL) operation. The lock operation can be a fast I/O or IRP-based operation.

For unlock operations, the Filter Manager calls the UnlockRoutine callback routine that the caller registered for the FILE_LOCK structure in a previous call to FltAllocateFileLock.

When the lock operation is completed, the Filter Manager calls the CompleteLockCallbackDataRoutine (PFLT_COMPLETE_LOCK_CALLBACK_DATA_ROUTINE) completion callback routine that the caller registered for the FILE_LOCK structure in a previous call to FltAllocateFileLock.

When the CallbackData parameter passed to FltProcessFileLock represents a fast I/O operation, the callback specified in CompleteLockCallbackDataRoutine parameter of the FltAllocateFileLock routine is not invoked. Only when the I/O operation in CallbackData is an IRP, and CompleteLockCallbackDataRoutine is not NULL, will the callback routine be called.

To determine whether the CallbackData represents a fast I/O operation, use the FLT_IS_FASTIO_OPERATION macro.

To allocate and initialize a new file lock structure, call FltAllocateFileLock.

To free an initialized FILE_LOCK structure, call FltFreeFileLock.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2
Minimum supported server Windows Server 2003 with SP1
Target Platform Universal
Header fltkernel.h (include Fltkernel.h)
Library FltMgr.lib
DLL Fltmgr.sys
IRQL <= APC_LEVEL

See also

FILE_LOCK

FLT_CALLBACK_DATA

FLT_IS_FASTIO_OPERATION

FltAllocateFileLock

FltCheckLockForReadAccess

FltCheckLockForWriteAccess

FltFreeFileLock

FltInitializeFileLock

FltUninitializeFileLock

FsRtlProcessFileLock

IRP_MJ_LOCK_CONTROL

PFLT_COMPLETE_LOCK_CALLBACK_DATA_ROUTINE

[PUNLOCK_ROUTINE](../ntifs/nc-ntifs-punlock_routine.md