Bewerken

Delen via


FsRtlFastLock macro (ntifs.h)

The FsRtlFastLock macro is used by file systems and filter drivers to request a byte-range lock for a file stream.

Syntax

BOOLEAN
FsRtlFastLock( A1,   /* FileLock            */
               A2,   /* FileObject          */
               A3,   /* FileOffset          */
               A4,   /* Length              */
               A5,   /* ProcessId           */
               A6,   /* Key                 */
               A7,   /* FailImmediately     */
               A8,   /* ExclusiveLock       */
               A9,   /* Iosb                */
               A10,  /* Context             */
               A11   /* AlreadySynchronized */ )

Parameters

A1

[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.

A2

[in] FileObject: Pointer to the FILE_OBJECT for the open file. The file object must have been created with GENERIC_READ or GENERIC_WRITE access to the file (or both).

A3

[in] FileOffset: Pointer to a variable that specifies the starting byte offset within the file of the range to be locked.

A4

[in] Length: Pointer to a variable that specifies the length in bytes of the range to be locked.

A5

[in] ProcessId: Pointer to the EPROCESS process ID for the process requesting the byte-range lock.

A6

[in] Key: The key to be assigned to the byte-range lock.

A7

[in] FailImmediately: Boolean value that specifies whether the lock request should fail if the lock cannot be granted immediately. If the caller can be put into a wait state until the request is granted, set FailImmediately to FALSE. If it cannot, set FailImmediately to TRUE.

A8

[in] ExclusiveLock: Set to TRUE if an exclusive lock is requested, FALSE if a shared lock is requested.

A9

[out] Iosb: Pointer to a caller-allocated IO_STATUS_BLOCK structure that receives status information about the lock request.

A10

[in] Context: Optional pointer to a context to use when releasing the byte-range lock.

A11

[in] AlreadySynchronized: This parameter is obsolete, but is retained for compatibility with legacy drivers.

Return value

None

Remarks

The FsRtlFastLock macro causes the caller to acquire a byte-range lock on a region of the specified file.

FsRtlFastLock returns TRUE to indicate that the IO_STATUS_BLOCK structure pointed to by Iosb received status information about the lock operation; otherwise it returns FALSE.

To examine the contents of the structure that Iosb points to, use the NT_STATUS macro.

Requirements

Requirement Value
Target Platform Desktop
Header ntifs.h (include Ntifs.h)
IRQL <= APC_LEVEL

See also

FILE_LOCK

FsRtlAllocateFileLock

FsRtlInitializeFileLock