This request is used to lock and "read ahead" the specified bytes of the file indicated by fid in the SMB header
Client Request ============================== |
Description ===================================== |
UCHAR WordCount; | Count of parameter words = 5 |
USHORT Fid; | File handle |
USHORT Count; | Count of bytes being requested |
ULONG Offset; | Offset in file of first byte to read |
USHORT Remaining; | Estimate of bytes to read if nonzero |
USHORT ByteCount; | Count of data bytes = 0 |
fid must refer to a disk file. count specifies the requested number of bytes. offset specifies the offset in the file of the first byte to be locked then read. Note that this offset is limited to 32 bits, so this client request is inappropriate for files having 64 bit offsets.
remaining is advisory. If the value is not zero, then it is taken as an estimate of the total number of bytes that will be read, including those read by this request. This additional information may be used by the server to optimize buffer allocation or read-ahead. remaining is not included in the byte range to be locked.
Server Response ================================== |
Description ================================= |
UCHAR WordCount; | Count of parameter words = 5 |
USHORT Count; | Count of bytes actually returned |
USHORT Reserved [4]; | Reserved (must be 0) |
USHORT ByteCount; | Count of data bytes |
UCHAR BufferFormat; | 0x01 -- Data block |
USHORT DataLength; | Length of data |
bytecount is the number of bytes actually being returned. bytecount may be less than the count requested only if a read specifies bytes beyond the current file size. In this case only the bytes that exist are returned. A read completely beyond the end of file results in a response of length zero. This is the only circumstance when a zero length response is generated. A count returned which is less than the count requested is the end of file indicator.
As in the core SMB_LOCK_BYTE_RANGE request, if the lock can not be immediately granted an error should be returned to the client. If an error occurs on the lock, the bytes should not be read. If a Read requests more data than can be placed in a message of the maximum-xmit-size for the tid specified, the server will abort the connection to the client.