共用方式為


2.2.4.33.2 Response

The SMB_COM_TRANSACTION response has two possible formats. The standard format is used to return the results of the completed transaction. A shortened interim response message is sent following the initial SMB_COM_TRANSACTION request if the server determines that at least one SMB_COM_TRANSACTION_SECONDARY request message is expected from the client.

Whenever a transaction request is split across multiple SMB requests, the server MUST evaluate the initial SMB_COM_TRANSACTION request to determine whether or not it has the resources necessary to process the transaction. It MUST also check for any other errors that it can detect and then send back an interim response. If the interim response returns SUCCESS, then the client MUST send the next request of the transaction to the server. If the interim response reports an error, the client MUST NOT send the next request of the transaction to the server and SHOULD take appropriate action based on the error information included in the interim response.

The format of the SMB_COM_TRANSACTION Interim Server Response message is an SMB Header (section 2.2.3.1) with an empty SMB_Parameters and SMB_Data section. SMB_Parameters.WordCount and SMB_Data.ByteCount MUST be 0x00 and 0x0000, respectively. Error codes are returned in the SMB_Header.Status field.

 SMB_Parameters
   {
   UCHAR  WordCount;
   }
 SMB_Data
   {
   USHORT ByteCount;
   }
            

If no error is returned in the SMB_COM_TRANSACTION Interim Server Response, the transaction can proceed. The client sends as many SMB_COM_TRANSACTION_SECONDARY requests as required in order to transfer the remainder of the transaction subcommand SMB_Data.Trans_Parameters and SMB_Data.Trans_Data. The server processes the transaction and replies with one or more SMB_COM_TRANSACTION response messages.

 SMB_Parameters
   {
   UCHAR  WordCount;
   Words
     {
     USHORT TotalParameterCount;
     USHORT TotalDataCount;
     USHORT Reserved1;
     USHORT ParameterCount;
     USHORT ParameterOffset;
     USHORT ParameterDisplacement;
     USHORT DataCount;
     USHORT DataOffset;
     USHORT DataDisplacement;
     UCHAR  SetupCount;
     UCHAR  Reserved2;
     USHORT Setup[SetupCount];
     }
   }
 SMB_Data
   {
   USHORT ByteCount;
   Bytes
     {
     UCHAR  Pad1[];
     UCHAR  Trans_Parameters[ParameterCount];
     UCHAR  Pad2[];
     UCHAR  Trans_Data[DataCount];
     }
   }
            


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 (variable)

...

SMB_Data (variable)

...

SMB_Parameters (variable):

The SMB_Parameters section of the SMB_COM_TRANSACTION response contains information used to manage the transfer of the transaction response. It can also contain additional information that can include subcommand return codes or state information returned by the server. See the individual subprotocol subcommands for details.


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 (variable)

...

WordCount (1 byte): The value of Words.SetupCount plus 10 (0x0A). This value represents the total number of SMB parameter words and MUST be greater than or equal to 10 (0x0A).

Words (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

TotalParameterCount

TotalDataCount

Reserved1

ParameterCount

ParameterOffset

ParameterDisplacement

DataCount

DataOffset

DataDisplacement

SetupCount

Reserved2

Setup (variable)

...

TotalParameterCount (2 bytes): The total number of transaction parameter bytes that the server expects to send to the client for this response. Parameter bytes for a transaction are carried within the SMB_Data.Trans_Parameters field of the SMB_COM_TRANSACTION response. If the size of all of the required SMB_Data.Trans_Parameters for a given transaction causes the response to exceed the MaxBufferSize established during session setup, then the server MUST NOT send all of the parameters in one response. The server MUST break up the parameters and send additional responses using the SMB_COM_TRANSACTION command to send the additional parameters. Any single response MUST NOT exceed the MaxBufferSize established during session setup. The server indicates to the client to expect additional parameters in at least one more SMB_COM_TRANSACTION response by setting ParameterCount (see following) to be less than TotalParameterCount.

TotalDataCount (2 bytes): The total number of transaction data bytes that the server expects to send to the client for this response. Data bytes of a transaction are carried within the SMB_Data.Trans_Data field of the SMB_COM_TRANSACTION response. If the size of all of the required SMB_Data.Trans_Data for a given transaction causes the response to exceed the MaxBufferSize established during session setup, then the server MUST NOT send all of the data in one response. The server MUST break up the data and send additional responses using the SMB_COM_TRANSACTION command to send the additional data. Any single response MUST NOT exceed the MaxBufferSize established during session setup. The server indicates to the client to expect additional data in at least one more SMB_COM_TRANSACTION response by setting DataCount (see following) to be less than TotalDataCount.

Reserved1 (2 bytes): Reserved. This field MUST be 0x0000 in the client request. The server MUST ignore the contents of this field.

ParameterCount (2 bytes): The number of transaction parameter bytes being sent in this response. If the transaction fits within a single SMB_COM_TRANSACTION response, then this value MUST be equal to TotalParameterCount. Otherwise, the sum of the ParameterCount values in the transaction response messages MUST be equal to the smallest TotalParameterCount value reported by the server. The ParameterCount field MUST be used to determine the number of transaction parameter bytes contained within the response.

ParameterOffset (2 bytes): This field MUST contain the number of bytes from the start of the SMB Header to the start of the SMB_Data.Trans_Parameters field. Client implementations MUST use this value to locate the transaction parameter block within the response. If ParameterCount is zero, the client/server MAY set this field to zero.<45>

ParameterDisplacement (2 bytes): The offset, in bytes, relative to all of the transaction parameter bytes in this transaction response at which this block of parameter bytes SHOULD be placed. This value MUST be used by the client to correctly reassemble the transaction response parameters when the response messages are received out of order.

DataCount (2 bytes): The number of transaction data bytes being sent in this response. If the transaction response fits within a single SMB_COM_TRANSACTION, then this value MUST be equal to TotalDataCount. Otherwise, the sum of the DataCount values in the primary and secondary transaction responses MUST be equal to the smallest TotalDataCount value reported to the client. If the value of this field is less than the value of TotalDataCount, then at least one additional SMB_COM_TRANSACTION response MUST be used to transfer the remaining data bytes.

DataOffset (2 bytes): This field MUST be the number of bytes from the start of the SMB Header of the response to the start of the SMB_Data.Trans_Data field. Client implementations MUST use this value to locate the transaction data block within the response. If DataCount is zero, the client/server MAY set this field to zero.<46>

DataDisplacement (2 bytes): The offset, in bytes, relative to all of the transaction data bytes in this transaction response at which this block of data bytes SHOULD be placed. This value MUST be used by the client to correctly reassemble the transaction data when the response messages are received out of order.

SetupCount (1 byte): The number of setup words that are included in the transaction response.

Reserved2 (1 byte): A padding byte. This field MUST be 0x00. Existing CIFS implementations can combine this field with SetupCount to form a USHORT. If SetupCount is defined as a USHORT, the high order byte MUST be zero.

Setup (variable): An array of two-byte words that provides transaction results from the server. The size and content of the array are specific to individual subprotocol subcommands.

SMB_Data (variable):

The SMB_Data section of the SMB_COM_TRANSACTION response contains the parameters and data generated by the transaction subcommand.


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 number of bytes in the SMB_Data.Bytes array that follows.

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

Pad1 (variable)

...

Trans_Parameters (variable)

...

Pad2 (variable)

...

Trans_Data (variable)

...

Pad1 (variable): This field SHOULD be used as an array of padding bytes to align the following field to a 4-byte boundary relative to the start of the SMB Header (section 2.2.3.1), This can cause this field to be a zero-length field. This field SHOULD be set to zero by the client/server, and MUST be ignored by the server/client.

Trans_Parameters (variable): Transaction parameter bytes. See the individual SMB_COM_TRANSACTION subcommand descriptions for information on parameters returned by the server for each subcommand.

Pad2 (variable): This field SHOULD be used as an array of padding bytes to align the following field to a 4-byte boundary relative to the start of the SMB Header. This constraint can cause this field to be a zero-length field. This field SHOULD be set to zero by the client/server and MUST be ignored by the server/client.

Trans_Data (variable): Transaction data bytes. See the individual SMB_COM_TRANSACTION subcommand descriptions for information on data returned by the server for each subcommand.

Error Codes

The errors returned from calls to SMB_COM_TRANSACTION are specific to the subcommand being executed. See the documentation for the individual subcommands for more detailed information.