2.2.4.23.2 Response

 SMB_Parameters
   {
   UCHAR  WordCount;
   Words
     {
     ULONG  Offset;
     USHORT Count;
     USHORT Remaining;
     USHORT DataCompactionMode;
     USHORT Reserved;
     USHORT DataLength;
     USHORT DataOffset;
     }
   }
 SMB_Data
   {
   USHORT ByteCount;
   Bytes
     {
     UCHAR Pad[];
     UCHAR Data[DataLength];
     }
   }
            


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

SMB_Parameters (17 bytes)

...

...

...

SMB_Data (variable)

...

SMB_Parameters (17 bytes):


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

WordCount

Words (16 bytes)

...

...

...

WordCount (1 byte): This field MUST be 0x08. The length, in two-byte words, of the remaining SMB_Parameters.

Words (16 bytes):


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Offset

Count

Remaining

DataCompactionMode

Reserved

DataLength

DataOffset

Offset (4 bytes): The offset, in bytes, from the start of the file at which the read occurred.

Count (2 bytes): The total number of bytes designated to be returned in all responses to this request. This value usually starts at MaxCountOfBytesToReturn, but can be an overestimate. The overestimate can be reduced while the read is in progress. The last response generated by the server MUST contain the actual total number of bytes read and sent to the client in all of the responses. If the value in the last response is less than MaxCountOfBytesToReturn, the end of file was encountered during the read. If this value is exactly zero (0x0000), the original Offset into the file began at or after the end of file; in this case, only one response MUST be generated. The value of the field can (and usually does) exceed the negotiated buffer size.

Remaining (2 bytes): This integer MUST be -1 for regular files. For I/O devices or named pipes, this indicates the number of bytes remaining to be read from the file after the bytes returned in the response were de-queued. Servers SHOULD return 0xFFFF if they do not support this function on I/O devices or named pipes.

DataCompactionMode (2 bytes): Not used and MUST be 0x0000.

Reserved (2 bytes): This field MUST be set to 0x0000.

DataLength (2 bytes): This field is the number of bytes read and included in the response. The value of this field MUST NOT cause the message to exceed the client's maximum buffer size as specified in MaxBufferSize of the SMB_COM_SESSION_SETUP_ANDX (section 2.2.4.53) client request.

DataOffset (2 bytes): The offset, in bytes, from the beginning of the SMB Header (section 2.2.3.1) to the start of the Buffer field in the SMB_Data.block.

SMB_Data (variable):


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

ByteCount

Bytes (variable)

...

ByteCount (2 bytes): The length, in bytes, of the remaining SMB_Data. The length MUST be between DataLength and DataLength + 0x0003.

Bytes (variable):


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Pad (variable)

...

Buffer (variable)

...

Pad (variable): Padding bytes to align data on a proper address boundary. The DataOffset field points to the first byte after this field.

Buffer (variable): The bytes read from the file.

Error Codes

SMB error class

SMB error code

NT status code

POSIX equivalent

Description

ERRDOS

(0x01)

ERRnoaccess

(0x0005)

STATUS_ALREADY_COMMITTED

(0xC0000021)

ENOLCK

Attempt to read from a portion of the file that the server detects has been locked or has been opened in deny-read.

ERRDOS

(0x01)

ERRbadfid

(0x0006)

STATUS_INVALID_HANDLE

(0xC0000008)

STATUS_SMB_BAD_FID

(0x00060001)

ENFILE

Attempt to read from a FID that the server does not have open.

ERRDOS

(0x01)

ERRnomem

(0x0008)

STATUS_INSUFF_SERVER_RESOURCES

(0xC0000205)

ENOMEM

The server is out of resources.

ERRDOS

(0x01)

ERRbadaccess

(0x000C)

STATUS_ACCESS_DENIED

(0xC0000022)

Read permission required.

ERRDOS

(0x01)

ERRlock

(0x0021)

STATUS_FILE_LOCK_CONFLICT

(0xC0000054)

STATUS_LOCK_NOT_GRANTED

(0xC0000055)

EAGAIN

The requested byte range was already locked by a different process (PID).

ERRDOS

(0x01)

ERReof

(0x0026)

STATUS_END_OF_FILE

(0xC0000011)

Attempted to read beyond the end of the file.

ERRSRV

(0x02)

ERRerror

(0x0001)

EBADF

The FID was validated by the server but unacceptable to the system.

ERRSRV

(0x02)

ERRerror

(0x0001)

EDEADLK

The read would block and deadlock would result.

ERRSRV

(0x02)

ERRerror

(0x0001)

STATUS_INVALID_SMB

(0x00010002)

A corrupt request has been encountered.

ERRSRV

(0x02)

ERRinvdevice

 (0x0007)

STATUS_BAD_DEVICE_TYPE

(0xC00000CB)

Attempt to read from an open spool file.

ERRSRV

(0x02)

ERRinvtid

(0x0005)

STATUS_SMB_BAD_TID

(0x00050002)

Invalid TID in request.

ERRSRV

(0x02)

ERRbaduid

(0x005B)

STATUS_SMB_BAD_UID

(0x005B0002)

The UID specified is not defined as a valid ID for this session, or the user identified by the UID does not have sufficient privileges.

ERRSRV

(0x02)

ERRuseSTD

(0x00FB)

STATUS_SMB_USE_STD

(0x00FB0002)

This command is not supported for the FID at this time. Use a standard read command.

ERRHRD

(0x03)

ERRdata

(0x0017)

STATUS_DATA_ERROR

(0xC000003E)

EIO

A problem has occurred in the physical I/O.

ERRHRD

(0x03)

ERRread

(0x001E)

ENXIO

The device associated with the file descriptor is a block-special or character-special file and the value of the file pointer is out of range.