Compartir a través de


2.2.4.26.1 Request

 SMB_Parameters
   {
   UCHAR  WordCount;
   Words
     {
     USHORT FID;
     USHORT TotalByteCount;
     USHORT Reserved;
     ULONG  ByteOffsetToBeginWrite;
     ULONG  Timeout;
     USHORT WriteMode;
     ULONG  RequestMask;
     USHORT DataLength;
     USHORT DataOffset;
     }
   }
 SMB_Data
   {
   USHORT ByteCount;
   Bytes
     {
     UCHAR Pad[];
     UCHAR Buffer[DataLength];
     }
   }

SMB_Header:

SequenceNumber (2 bytes): This field MUST be zero (0x0000) unless the request is the last request in the multiplexed write sequence, in which case it MUST be a nonzero value. The nonzero value indicates to the server that this is the last request of the sequence and the server MUST respond by sending an SMB_COM_WRITE_MPX Response (section 3.2.5.19).


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 (25 bytes)

...

...

...

SMB_Data (variable)

...

SMB_Parameters (25 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 (24 bytes)

...

...

...

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

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

FID

TotalByteCount

Reserved

ByteOffsetToBeginWrite

...

Timeout

...

WriteMode

RequestMask

DataLength

DataOffset

FID (2 bytes): This field MUST be a valid 16-bit unsigned integer indicating the file to which the data is to be written.

TotalByteCount (2 bytes): The requested total number of bytes to write to the file. The value MAY exceed the negotiated buffer size.

Reserved (2 bytes): The server MUST ignore this value.

ByteOffsetToBeginWrite (4 bytes): The offset, in bytes, from the start of the file at which the write is to begin. This value indicates the offset at which to write the data contained in the SMB_Data.Bytes.Buffer field of the same message.

Timeout (4 bytes): This field MUST be ignored by the server.<36>

WriteMode (2 bytes): A 16-bit field containing flags defined as follows.

Name and bitmask

Meaning

WritethroughMode

0x0001

If set, the server MUST NOT respond to the client before the data is written to disk.

ConnectionlessMode

0x0080

If set, this flag indicates that messages are being sent over a connectionless transport. This flag MUST be set.

If WritethroughMode is not set, the server is assumed to be performing a form of write behind (cached writing). The SMB transport layer guarantees delivery of all secondary requests from the client. If an error occurs at the server end, all bytes received MUST be ignored and discarded. If an error such as disk full occurs while writing data to disk, the next access of the file handle (another write, close, read, and so on). MUST return the fact that the error occurred. The value of this error status MUST be the same for all requests that are part of the same write operation.

If WritethroughMode is set, the server MUST receive the data, write it to disk, and then send a final response indicating the result of the write.

RequestMask (4 bytes): This field is a bit mask indicating this SMB request's identity to the server. The server's response MUST contain the logical OR of all of the RequestMask values received. This response MUST be generated.

DataLength (2 bytes): This field value is the number of data bytes included in this request.

DataOffset (2 bytes): This field value is the offset, in bytes, from the start of the SMB Header (section 2.2.3.1) to the start of the data buffer.

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): This field MUST be greater than or equal to 0x0001.

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): Null padding bytes to align Buffer to a 16- or 32-bit boundary.

Buffer (variable): The raw data, in bytes, that is to be written to the file.