共用方式為


2.2.4.12.1 Request

 SMB_Parameters
   {
   UCHAR  WordCount;
   Words
     {
     USHORT FID;
     USHORT CountOfBytesToWrite;
     ULONG  WriteOffsetInBytes;
     USHORT EstimateOfRemainingBytesToBeWritten;
     }
   }
 SMB_Data
   {
   USHORT ByteCount;
   Bytes
     {
     UCHAR  BufferFormat;
     USHORT DataLength;
     UCHAR  Data[ CountOfBytesToWrite ];    
     }
   }

SMB_Header:

TID (2 bytes): This field MUST contain a valid TID.

UID (2 bytes): This field MUST contain a valid UID.


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

...

...

SMB_Data (variable)

...

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

...

...

WordCount (1 byte): This field MUST be 0x05.

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

CountOfBytesToWrite

WriteOffsetInBytes

EstimateOfRemainingBytesToBeWritten

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

CountOfBytesToWrite (2 bytes): This field is a 16-bit unsigned integer indicating the number of bytes to be written to the file. The client MUST ensure that the amount of data sent can fit in the negotiated maximum buffer size.

WriteOffsetInBytes (4 bytes): This field is a 32-bit unsigned integer indicating the offset, in number of bytes, from the beginning of the file at which to begin writing to the file. The client MUST ensure that the amount of data sent fits in the negotiated maximum buffer size. Because this field is limited to 32 bits, this command is inappropriate for files that have 64-bit offsets.

EstimateOfRemainingBytesToBeWritten (2 bytes): This field is a 16-bit unsigned integer indicating the remaining number of bytes that the client anticipates to write to the file. This is an advisory field and can be 0x0000. This information can be used by the server to optimize cache behavior.

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 0x0003. The total value represents the size of the BufferFormat field in bytes plus the size of the DataLength field in bytes plus the value of the CountOfBytesToWrite field. See Data Buffer Format Codes (section 2.2.2.5) for a complete description of data buffer format codes and their usages.

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

BufferFormat

DataLength

Data (variable)

...

BufferFormat (1 byte): This field MUST be 0x01.

DataLength (2 bytes): This field MUST match SMB_Parameters.CountOfBytesToWrite.

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