18.104.22.168 SMB_COM_WRITE_AND_UNLOCK (0x14)
This command was introduced in the CorePlus dialect, but is often listed as part of the LAN Manager 1.0 dialect. This command is deprecated. Clients SHOULD use the SMB_COM_LOCKING_ANDX (section 22.214.171.124) command.
The write and unlock command has the effect of writing to a range of bytes and then unlocking them. This command is usually associated with an earlier usage of SMB_COM_LOCK_AND_READ (section 126.96.36.199) on the same range of bytes. The server's response field ByteCountWritten indicates the number of bytes actually written.
Aside from the lack of special handling of zero-length writes, this request behaves in an identical fashion to the SMB_COM_WRITE (section 188.8.131.52) command followed by a core protocol SMB_COM_UNLOCK_BYTE_RANGE command. Support for this SMB command is optional. A server SHOULD set bit 0 in the SMB Header (section 184.108.40.206) Flags field of the SMB_COM_NEGOTIATE (section 220.127.116.11) response to indicate to the client that the command is supported. If the command sends a message of length greater than the MaxBufferSize for the TID specified, the server MAY abort the connection to the client. If an error occurs on the write, the bytes remain locked.
This command supports only 32-bit offsets and is inappropriate for files having 64-bit offsets. The client SHOULD use SMB_COM_WRITE_ANDX (section 18.104.22.168) to write to files requiring 64-bit file offsets.
When FID represents a disk file and the request specifies a byte range beyond the current end of file, the file MUST be extended. Any bytes between the previous end of file and the requested offset are initialized to zero (0x00). When a write specifies a count of zero, the file is not truncated or extended to the length specified by the offset.
The client MUST have at least write access to the file.