FsRtlInitializeFileLock - NtDoc

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

VOID FsRtlInitializeFileLock(
  [in]           PFILE_LOCK                 FileLock,
  [in, optional] PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine,
  [in, optional] PUNLOCK_ROUTINE            UnlockRoutine
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-ntifs-_fsrtl_advanced_fcb_header-fsrtlinitializefilelock)

FsRtlInitializeFileLock function

Description

The FsRtlInitializeFileLock routine initializes a FILE_LOCK structure.

Parameters

FileLock [in]

Pointer to an uninitialized FILE_LOCK structure.

CompleteLockIrpRoutine [in, optional]

Pointer to a PCOMPLETE_LOCK_IRP_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.

Remarks

FsRtlInitializeFileLock initializes an uninitialized FILE_LOCK structure.

It is a programming error to call FsRtlInitializeFileLock for a FILE_LOCK structure that has already been initialized by FsRtlInitializeFileLock or FltAllocateFileLock, unless the structure has been uninitialized by a subsequent call to FsRtlUninitializeFileLock.

Once initialized, the FILE_LOCK structure can be used to lock a byte range in a file by calling FsRtlProcessFileLock orFsRtlFastLock. FsRtlProcessFileLock processes lock IRPs. FsRtlFastLock performs non-IRP locking.

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

Minifilters must call FltInitializeFileLock instead of FsRtlInitializeFileLock.

See also

FILE_LOCK

FltInitializeFileLock

FltAllocateFileLock

FsRtlAreThereCurrentFileLocks

FsRtlFastLock

FsRtlProcessFileLock

FsRtlUninitializeFileLock

IRP_MJ_LOCK_CONTROL

IoCompleteRequest

PCOMPLETE_LOCK_IRP_ROUTINE

PUNLOCK_ROUTINE