3.2.4.14 Application Requests Reading from a File, Named Pipe, or Device

The application provides:

  • A valid Client.Open, representing the file from which the application attempts to read.

  • An offset, in bytes and relative to the start of the file, marking the location within the file at which the application attempts to read.

  • The number of bytes to be read.

  • A minimum number of bytes to be read.

  • An optional time-out value, in milliseconds, indicating how long a server is requested to wait.

The application MAY also provide an estimate of the number of bytes that it attempts to read next. This value MUST represent a sequential read (immediately following the bytes being read in this request), as it is used to allow the server to perform read-ahead caching.

CIFS provides several commands for reading data from a file, named pipe, or device. These are:

  • SMB_COM_READ (deprecated)

    The client MUST construct an SMB_COM_READ request message as defined in section 2.2.4.11.1. This command provides the basic Read operation.

  • SMB_COM_LOCK_AND_READ (deprecated)

    The client MUST construct an SMB_COM_LOCK_AND_READ request as defined in section 2.2.4.20.1. Prior to reading, this command attempts to establish a lock on the specified byte range.

  • SMB_COM_READ_RAW (deprecated)

    The client MUST construct an SMB_COM_READ_RAW request as defined in section 2.2.4.22.1. The behavior of the SMB_COM_READ_RAW request is described in section 3.2.4.14.1.

  • SMB_COM_READ_MPX (obsolescent)

    The client MUST construct SMB_COM_READ_MPX request messages as defined in section 2.2.4.23.1. The behavior of the SMB_COM_READ_MPX request is described in section 3.2.4.14.2.

  • SMB_COM_READ_ANDX

    If the application reads from a named pipe or device specifically, it MUST also provide the minimum number of bytes to be read.

    The client MUST construct an SMB_COM_READ_ANDX request message as defined in section 2.2.4.42.1, with the following additional requirements:

    • If CAP_LARGE_FILES was negotiated during session setup, then the client MAY use a 64-bit Offset value. If the client is using a 64-bit Offset value, SMB_Parameters.WordCount MUST be set to 0x0C and the SMB_Parameters.Words.Offset and SMB_Parameters.Words.OffsetHigh fields MUST be set to the lower 32 bits and higher 32 bits, respectively, of the supplied offset value.

    • If the client is using a 32-bit Offset value, SMB_Parameters.WordCount MUST be set to 0x0A, the SMB_Parameters.Words.Offset field MUST be assigned the offset value supplied by the application, and the SMB_Parameters.Words.OffsetHigh field MUST NOT be included in the request.

    • The SMB_Parameters.Words.MaxCountOfBytesToReturn field MUST be assigned the number of bytes to be returned. This value is supplied by the application. If a value was supplied for a minimum number of bytes to be read, the SMB_Parameters.Words.MinCountOfBytesToReturn field MUST be assigned the value that was supplied by the application. Otherwise, it MUST be set to 0x0000.

    • If a time-out value was supplied, the SMB_Parameters.Words.Timeout field MUST be assigned the value that was supplied by the application. Otherwise, it MUST be set to 0x00000000.

      In addition, if CAP_LARGE_READX was set by the server in the negotiate protocol response and FID refers to a disk file, then the MaxCountOfBytesToReturn field in the client request can exceed the client's Client.MaxBufferSize.

  • TRANS_RAW_READ_NMPIPE

    The client MUST construct the TRANS_RAW_READ_NMPIPE subcommand as defined in section 2.2.5.2. The request MUST be transported to the server using the Transaction subprotocol. TRANS_RAW_READ_NMPIPE allows for a raw read of data from a named pipe. This method of reading data from a named pipe ignores message boundaries even if the pipe is set up as a message mode pipe.

  • TRANS_READ_NMPIPE

    The client MUST construct the TRANS_READ_NMPIPE subcommand as defined in section 2.2.5.8. The request MUST be transported to the server using the Transaction subprotocol. TRANS_READ_NMPIPE allows data to be read from a named pipe in the mode set on the named pipe. If the named pipe is in message mode, this subcommand MUST read a message from the pipe.

The request MUST be sent to the server as described in section 3.2.4.1.

Show: