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 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 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 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 Flags field of the SMB_COM_NEGOTIATE (section 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 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.