Partager via


2.2.4.25.1 Request

 SMB_Parameters
   {
   UCHAR  WordCount;
   Words
     {
     USHORT FID;
     USHORT CountOfBytes;
     USHORT Reserved1;
     ULONG  Offset;
     ULONG  Timeout;
     USHORT WriteMode;
     ULONG  Reserved2;
     USHORT DataLength;
     USHORT DataOffset;
     ULONG  OffsetHigh (optional);
     }
   }
 SMB_Data
   {
   USHORT ByteCount;
   Words
     {
     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 (variable)

...

SMB_Data (variable)

...

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

WordCount

Words (variable)

...

WordCount (1 byte): This field MUST be 0x0C or 0x0E

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

FID

CountOfBytes

Reserved1

Offset

...

Timeout

...

WriteMode

Reserved2

DataLength

DataOffset

OffsetHigh

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

CountOfBytes (2 bytes): The total number of bytes to be written to the file during the entire dialog. The value MAY exceed the maximum buffer size (MaxBufferSize) established for the session.

Reserved1 (2 bytes): This field is reserved and MUST be ignored by the server.

Offset (4 bytes): The offset, in bytes, from the start of the file at which the write SHOULD begin. If WordCount is 0x0E, this is the lower 32 bits of a 64-bit value.

Timeout (4 bytes): This field is the time-out, in milliseconds, to wait for the write to complete. This field is optionally honored only when writing to a named pipe or I/O device. It does not apply and MUST be 0x00000000 when writing to a regular file.

WriteMode (2 bytes): A 16-bit field containing flags defined as follows. The flag names below are provided for reference only.

Name and bitmask

Meaning

WritethroughMode

0x0001

If set, the server MUST NOT respond to the client before the data is written to disk (write-through).

ReadBytesAvailable

0x0002

If set, the server SHOULD set the Interim Response Response.SMB_Parameters.Available field correctly for writes to named pipes or I/O devices.

NamedPipeRaw

0x0004

Applicable to named pipes only. If set, the named pipe MUST be written to in raw mode (no translation; the opposite of message mode).

NamedPipeStart

0x0008

Applicable to named pipes only. If set, this data is the start of a message.

If WritethroughMode is not set, this SMB is assumed to be a form of write behind (cached write). The SMB transport layer guarantees delivery of raw data from the client. If an error occurs at the server end, all bytes MUST be received and discarded. If an error occurs while writing data to disk (such as disk full) the next access to the file handle (another write, close, read, etc.) MUST result in an error, reporting this situation.

If WritethroughMode is set, the server MUST receive the data, write it to disk and then send a Final Server Response (section 2.2.4.25.3) indicating the result of the write. The total number of bytes successfully written MUST also be returned in the SMB_Parameters.Count field of the response.

Reserved2 (4 bytes): This field MUST be 0x00000000.

DataLength (2 bytes): This field is the number of bytes included in the SMB_Data block that are to be written to the file.

DataOffset (2 bytes): This field is the offset, in bytes, from the start of the SMB Header (section 2.2.3.1) to the start of the data to be written to the file from the Data[] field. Specifying this offset allows the client to efficiently align the data buffer.

OffsetHigh (4 bytes): If WordCount is 0x0E, this is the upper 32 bits of the 64-bit offset in bytes from the start of the file at which the write MUST start. Support of this field is optional.

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 0x0000.

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)

...

Data (variable)

...

Pad (variable): Padding bytes for the client to align the data on an appropriate boundary for transfer of the SMB transport. The server MUST ignore these bytes.

Data (variable): The bytes to be written to the file.