2.2.4.40.1 Request

            
 SMB_Parameters
   {
   UCHAR  WordCount;
   Words
     {
     USHORT FID;
     USHORT CountOfBytesToWrite;
     ULONG  WriteOffsetInBytes;
     UTIME  LastWriteTime;
     ULONG  Reserved[3] (optional);
     }
   }
 SMB_Data
   {
   USHORT ByteCount;
   Bytes
     {
     UCHAR Pad;
     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 (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 either 0x06 or 0x0C.

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

CountOfBytesToWrite

WriteOffsetInBytes

LastWriteTime

Reserved

...

...

FID (2 bytes): This field MUST be a valid 16-bit unsigned integer indicating the file to which the data SHOULD 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. If the value of this field is zero (0x0000), the server MUST truncate or extend the file to match the WriteOffsetInBytes.

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 can fit 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.

LastWriteTime (4 bytes): This field is a 32-bit unsigned integer indicating the number of seconds since Jan 1, 1970, 00:00:00.0. The server SHOULD set the last write time of the file represented by the FID to this value. If the value is zero (0x00000000), the server SHOULD use the current local time of the server to set the value. Failure to set the time MUST NOT result in an error response from the server.

Reserved (12 bytes): This field is optional. This field is reserved,  and all entries MUST be zero (0x00000000). This field is used only in the 12-word version of the request.

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

Buffer (variable)

...

ByteCount (2 bytes): This field MUST be 0x0001 + CountOfBytesToWrite.

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

Data (variable)

...

Pad (1 byte): The value of this field SHOULD be ignored. This is padding to force the byte alignment to a double word boundary.

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