2.2.4.20 SMB_COM_LOCK_AND_READ (0x13)

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 2.2.4.32) command.

This command is used to explicitly lock and read bytes from a regular file. The byte range requested is first locked and then read. The lock type is an exclusive read/write lock.  If the server cannot immediately grant the lock on the byte range an error MUST be returned to the client. If the lock cannot be obtained the server SHOULD NOT read the bytes.

The end of file condition is indicated by the server returning fewer bytes than the client has requested. A read request starting at or beyond the end of the file returns zero bytes. If a read requests more data than can be placed in a message of MaxBufferSize for the SMB connection, the server will abort the connection to the client. This client request is inappropriate for files having 64-bit offsets since it supports 32-bit offsets only. The client MUST have at least read access to the file.