188.8.131.52 Application Requests Writing to a File, Named Pipe, or Device
The application provides:
A valid Client.Open, representing the file to which the application attempts to write.
An offset, in bytes and relative to the start of the file, marking the location within the file where the application attempts to write.
The data and the number of bytes to be written.
Whether or not the write is to be done in write-through mode.
An optional time-out value, in milliseconds, designating how long to wait for the write to complete.
CIFS provides several commands for writing data to a file, named pipe, or device. These are:
SMB_COM_WRITE (section 184.108.40.206) (deprecated)
SMB_COM_WRITE_AND_UNLOCK (section 220.127.116.11) (deprecated)
SMB_COM_WRITE_RAW (section 18.104.22.168) (deprecated)
SMB_COM_WRITE_MPX (section 22.214.171.124) (obsolescent)
SMB_COM_WRITE_AND_CLOSE (section 126.96.36.199) (deprecated)
If the client uses a 64-bit offset value, SMB_Parameters.WordCount MUST be set to 0x0E and the SMB_Parameters.Words.Offset and SMB_Parameters.Words.OffsetHigh fields MUST be set to the lower 32 bits and the higher 32 bits, respectively, of the supplied offset value.
If the client uses a 32-bit offset value, SMB_Parameters.WordCount MUST be set to 0x0C, 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.WriteMode field MUST reflect any behavior that the application requests from the server. See the description of the WriteMode field in section 188.8.131.52.1.
The SMB_Parameters.Words.DataLength field MUST be set to the length, in bytes, of the data to be written.
The SMB_Parameters.Words.DataOffset field MUST be set to the offset, in bytes and relative to the start of the SMB Header block, of the data to be written to the file.
The SMB_Data.Bytes.Pad field MUST contain padding bytes used to align the SMB_Data.Bytes.Data field to an appropriate boundary.
The SMB_Data.Bytes.Data field MUST contain the data to be written.
If the write is to a named pipe, and if the write spans multiple requests, the client SHOULD set the SMB_Parameters.Words.Remaining field to the number of bytes remaining to be written and MUST set the RAW_MODE bit in the SMB_Parameters.Words.WriteMode field. For the first write request the client MUST set the MSG_START bit in the SMB_Parameters.Words.WriteMode field.<205>
The client MUST construct an SMB_COM_WRITE Request (section 184.108.40.206.1) message as defined in section 220.127.116.11.1. This command provides the basic Write operation.
This command is used to write to a locked byte range in the file and then unlock the range. The application MAY provide an indication of the number of additional bytes immediately following the bytes written and unlocked that it attempts to write. The byte range to be written MUST be locked prior to writing. The client MUST construct the SMB_COM_WRITE_AND_UNLOCK Request (section 18.104.22.168.1) as defined in section 22.214.171.124.1.
The client MUST construct an SMB_COM_WRITE_MPX Request (section 126.96.36.199.1) as defined in section 188.8.131.52.1. The behavior of the SMB_COM_WRITE_MPX Request (section 184.108.40.206.1) is described in section 220.127.116.11.2.
The client MUST construct an SMB_COM_WRITE_AND_CLOSE (section 18.104.22.168) command as defined in section 22.214.171.124.1. This command has the effect of writing to a range of bytes and then closing the file associated with the supplied FID. This command behaves identically to an SMB_COM_WRITE (section 126.96.36.199) command followed by an SMB_COM_CLOSE (section 188.8.131.52) command.
The client MUST construct an SMB_COM_WRITE_ANDX Request (section 184.108.40.206.1) message as defined in section 220.127.116.11.1, with the following additional requirements:
If the application writes to a named pipe or device and if a time-out value is supplied, the SMB_Parameters.Words.Timeout field MUST be assigned the value supplied by the application. Otherwise, it MUST be set to 0x00000000.
This command is used to write data to an open print queue spool file. The first data written to the print file MUST be printer-specific control data. The length of the control data block MUST be specified in the SMB_Parameters.Words.SetupLength field. A single SMB_COM_WRITE_PRINT_FILE command can contain both printer-specific control data and print file data, as long as the control data is completely written first.
The client MUST construct an SMB_COM_WRITE_PRINT_FILE request message as defined in section 18.104.22.168.1.
The client MUST construct the TRANS_RAW_WRITE_NMPIPE subcommand as defined in section 22.214.171.124. The request MUST be transported to the server using the Transaction subprotocol. TRANS_RAW_WRITE_NMPIPE allows for a raw write of data to a named pipe. This method of writing data to a named pipe ignores message boundaries even if the pipe was set up as a message mode pipe.
The client MUST construct the TRANS_WRITE_NMPIPE subcommand as defined in section 126.96.36.199.1. The request MUST be transported to the server using the Transaction subprotocol. TRANS_WRITE_NMPIPE allows data to be written to a named pipe in the mode set on the named pipe. If the named pipe is in message mode, this subcommand MUST write a message from the pipe.
The request MUST be sent to the server as described in section 188.8.131.52.