3.3.5.27 Receiving an SMB_COM_WRITE_MPX Request

Upon receipt of an SMB_COM_WRITE_MPX Request (section 2.2.4.26.1), the server MUST validate the following fields:

  • TID: The tree ID MUST indicate a connected disk share.

  • UID: The user ID MUST indicate an active SMB session. The UID MUST be listed in Server.Connection.SessionTable.

  • CID: The SMB transport MUST be connectionless, and the Connection ID field MUST be valid for the transport.

  • PID and MID: These are used to identify a single Write MPX operation that can consist of multiple Write MPX request messages.

  • SequenceNumber: This field MUST be zero for all but the final Write MPX request sent in the operation. The requests can arrive in any order.

  • SMB_Parameters.Words.FID: Indicates the file to which the transmitted data is to be written. The FID MUST represent a regular file or a printer spool file.

The TID, UID, PID, MID, and CID values MUST be the same for all SMB_COM_WRITE_MPX (section 2.2.4.26) messages sent as part of the same operation. The FID MUST be the same for all SMB_COM_WRITE_MPX Request messages sent as part of the same operation.

The server MUST rely on the SMB transport to determine whether each client request was successfully received. If the transport indicates an error on the receipt of the request, the request MUST be discarded. If this SMB command request is received over a connection-oriented transport, the server MUST respond immediately with an error response; the error code MUST be STATUS_SMB_USE_STANDARD (ERRSRV/ERRusestd).

When the server receives the first SMB_COM_WRITE_MPX in a Write MPX exchange, it MUST initialize the Server.Open.MpxMask that it returns to the client to zero (0x00000000).

For each request received as part of the SMB_COM_WRITE_MPX operation, the server MUST attempt to write the data in the SMB_Data.Bytes.Buffer field to the file indicated by FID at the location indicated by SMB_Parameters.Words.ByteOffsetToBeginWrite. If the write is successful, the Server.Open.MpxMask is updated by performing a bitwise OR with the RequestMask in the request. The result is stored in Server.Open.MpxMask:

Server.Open.MpxMask |= RequestMask

When the server receives an SMB_COM_WRITE_MPX request that has a nonzero SequenceNumber in the SMB Header (section 2.2.3.1), the server takes one of two actions:

  • If WritethroughMode is set, the server writes all of the accumulated data and ensures (if possible) that the data is flushed to disk. ResponseMask  MUST be set to Server.Open.MpxMask. The server then returns the SMB_COM_WRITE_MPX Response (section 2.2.4.26.2). The ResponseMask indicates the set of SMB_COM_WRITE_MPX messages in this exchange that were received by the server.

  • If WritethroughMode is clear, the server responds immediately and sets ResponseMask as Server.Open.MpxMask; write operations that are in-progress complete asynchronously.

The client MUST resend any SMB_COM_WRITE_MPX requests that were not indicated as having been received in the ResponseMask. The last message resent MUST have the same nonzero SequenceNumber in the SMB Header as was previously used in this exchange. The server, once again, responds with an SMB_COM_WRITE_MPX Response containing the cumulative ResponseMask. This process continues until all request messages in the exchange have been acknowledged.

The SMB_COM_WRITE_MPX Response messages MUST be sent to the client as specified in section 3.3.4.1, with the exception that SMB signing is not supported over connectionless transports.