Partager via


2.2.4.13 SMB_COM_LOCK_BYTE_RANGE (0x0C)

This is an original Core Protocol command. This command is deprecated. Clients SHOULD use the SMB_COM_LOCKING_ANDX (section 2.2.4.32) command.

This command is not compatible with files having greater than 32-bit offsets. The SMB_COM_LOCKING_ANDX command introduced in the LAN Manager 1.0 dialect was modified in the NT LAN Manager dialect to support files that have 64-bit offsets. SMB_COM_LOCKING_ANDX is the preferred method of locking and unlocking byte ranges for clients that negotiate the LAN Manager 1.0 dialect or later. The client MUST negotiate NT LAN Manager or later dialect to access the support for 64-bit file offsets.

This command is used to explicitly lock a contiguous range of bytes in an open regular file. More than one non-overlapping byte range can be locked in any specified file. Locks prevent attempts to lock, read, or write the locked portion of the file by other clients or PIDs. Overlapping locks MUST be failed with STATUS_LOCK_NOT_GRANTED (ERRDOS/ERRlock). Offsets beyond the current end of file are allowed to be locked. Such locks MUST NOT cause allocation of additional file space. Locks MUST be unlocked only by the client PID that performed the lock.

Because this client request supports 32-bit offsets only, it is inappropriate for files that have 64-bit offsets. The client MUST have at least read access to the file.