FltAllocateFileLock - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// fltkernel.h

PFILE_LOCK FLTAPI FltAllocateFileLock(
  [in, optional] PFLT_COMPLETE_LOCK_CALLBACK_DATA_ROUTINE CompleteLockCallbackDataRoutine,
  [in, optional] PUNLOCK_ROUTINE                          UnlockRoutine
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-fltkernel-fltallocatefilelock)

FltAllocateFileLock function

Description

The FltAllocateFileLock routine allocates and initializes a new FILE_LOCK structure.

Parameters

CompleteLockCallbackDataRoutine [in, optional]

Pointer to a PFLT_COMPLETE_LOCK_CALLBACK_DATA_ROUTINE-typed callback routine to be called when an IRP_MJ_LOCK_CONTROL request is completed. This parameter is optional and can be NULL.

UnlockRoutine [in, optional]

Pointer to a PUNLOCK_ROUTINE-typed callback routine to be called when the byte range is unlocked. This parameter is optional and can be NULL.

Return value

FltAllocateFileLock returns a pointer to the newly allocated FILE_LOCK structure.

Remarks

FltAllocateFileLock allocates a new FILE_LOCK structure from paged pool and initializes it.

The returned FILE_LOCK structure can be used to lock a byte range in a file by calling FltProcessFileLock.

When the FILE_LOCK structure is no longer needed, it can be uninitialized by calling FltUninitializeFileLock. The uninitialized FILE_LOCK structure can then be initialized for reuse by calling FltInitializeFileLock.

To free an initialized FILE_LOCK structure, call FltFreeFileLock.

When the CallbackData parameter passed to FltProcessFileLock represents a fast I/O operation, the callback specified in CompleteLockCallbackDataRoutine 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.

See also

FILE_LOCK

FltCheckLockForReadAccess

FltCheckLockForWriteAccess

FltFreeFileLock

FltInitializeFileLock

FltProcessFileLock

FltUninitializeFileLock

FsRtlAllocateFileLock

IRP_MJ_LOCK_CONTROL

PFLT_COMPLETE_LOCK_CALLBACK_DATA_ROUTINE

PUNLOCK_ROUTINE