WRITE_AND_CLOSE: Write Bytes and Close File

This request is used to first write the specified bytes and then close the file.

Client Request
==================================
Description
=================================
UCHAR WordCount; Count of parameter words = 6
USHORT Fid; File handle
USHORT Count; Number of bytes to write
ULONG Offset; Offset in file of first byte to write
UTIME LastWriteTime; Time of last write
USHORT ByteCount; 1 (for pad) + value of Count
UCHAR Pad; To force to doubleword boundary
UCHAR Buffer[ Count ]; Data to write

Client Request
==================================
Description
=================================
UCHAR WordCount; Count of parameter words = 12
USHORT Fid; File handle
USHORT Count; Number of bytes to write
ULONG Offset; Offset in file of first byte to write
UTIME LastWriteTime; Time of last write
ULONG Reserved[3]; Reserved, must be 0
USHORT ByteCount; 1 (for pad) + value of Count
UCHAR Pad; To force to doubleword boundary
UCHAR Buffer[Count]; Data to write

Server Response
==================================
Description
=================================
UCHAR WordCount; Count of parameter words = 1
USHORT Count; Count of bytes actually written
USHORT ByteCount; Count of data bytes = 0

Since clients can formulate the request in either of two ways, wordcount must be used in order to correctly locate the data to be written.

count specifies the number of bytes to be written. offset is the offset in the file of the first byte to be written. Since offset is 32 bits, this request is inappropriate for general use in a very large file.

If lastwritetime and lastwritedate are 0, the server should allow its local operating system to set the file's times. Otherwise, the server should set the time to the values requested. Failure to set the times, even if requested by the client in this message, should not result in an error response from the server.

If count is 0, the file is truncated (or extended) to offset.

If an error occurs on the write, the file should still be closed.