Expand Minimize

FltProcessFileLock routine

The FltProcessFileLock routine processes and completes a file lock operation.

Syntax


FLT_PREOP_CALLBACK_STATUS FltProcessFileLock(
  _In_      PFILE_LOCK FileLock,
  _In_      PFLT_CALLBACK_DATA CallbackData,
  _In_opt_  PVOID Context
);

Parameters

FileLock [in]

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

CallbackData [in]

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

Context [in, optional]

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 codeDescription
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 (PUNLOCK_ROUTINE) 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 initializedFILE_LOCK structure, call FltFreeFileLock

Requirements

Version

Available starting with Windows XP with SP2 or Windows Server 2003 with SP1.

Header

Fltkernel.h (include Fltkernel.h)

Library

FltMgr.lib

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

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft