FsRtlGetNextFileLock function (ntifs.h)

The FsRtlGetNextFileLock routine is used to enumerate the byte-range locks that currently exist for a specified file.

Syntax

PFILE_LOCK_INFO FsRtlGetNextFileLock(
  [in] PFILE_LOCK FileLock,
  [in] BOOLEAN    Restart
);

Parameters

[in] FileLock

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

[in] Restart

Set to TRUE if the enumeration is to start at the beginning of the list of byte range locks. Set to FALSE if resuming the enumeration from a previous call.

To enumerate all byte-range locks for a given file, use FsRtlGetNextFileLock as follows:

for (p = FsRtlGetNextFileLock( FileLock, TRUE );
     p != NULL;
     p = FsRtlGetNextFileLock( FileLock, FALSE )) {
        // Process the lock information pointed to by p
}

Return value

FsRtlGetNextFileLock returns a pointer to the FILE_LOCK_INFO structure for the next byte-range lock, if one exists. If there are no more byte-range locks for this file, FsRtlGetNextFileLock returns NULL.

Remarks

The byte range locks are not enumerated in any particular order.

Note that because the current enumeration state is stored in the FILE_LOCK structure, callers must be careful to synchronize calls to FsRtlGetNextFileLock, and to avoid modifying any of the structures that it returns. If multiple threads attempt to use FsRtlGetNextFileLock at the same time, the results will be unpredictable, and the enumeration will not be reliably complete.

Requirements

Requirement Value
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= APC_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport)

See also

FsRtlAreThereCurrentFileLocks

FsRtlCheckLockForReadAccess

FsRtlCheckLockForWriteAccess

FsRtlFastCheckLockForRead

FsRtlFastCheckLockForWrite

FsRtlFastLock

FsRtlFastUnlockAll

FsRtlFastUnlockAllByKey

FsRtlFastUnlockSingle

FsRtlInitializeFileLock

FsRtlProcessFileLock

FsRtlUninitializeFileLock