/// <summary>
        /// to create a SetInformation2 request packet.
        /// </summary>
        /// <param name="messageId">This field SHOULD be the multiplex ID that is used to associate a response with a
        /// request.</param>
        /// <param name="uid">This field SHOULD identify the authenticated instance of the user.</param>
        /// <param name="treeId">This field identifies the subdirectory (or tree) on the server that the client is
        /// accessing.</param>
        /// <param name="fid">This is the FID representing the file for which attributes are to be set.</param>
        /// <param name="flags">An 8-bit field of 1-bit flags describing various features in effect for the
        /// message</param>
        /// <param name="flags2">A 16-bit field of 1-bit flags that represent various features in effect for the
        /// message. Unspecified bits are reserved and MUST be zero.</param>
        /// <param name="createDate">This is the FID representing the file for which attributes are to be set</param>
        /// <param name="creationTime">This is the date when the file was created</param>
        /// <param name="lastAccessDate">This is the date when the file was last accessed</param>
        /// <param name="lastAccessTime">This is the time on LastAccessDate when the file was last accessed.</param>
        /// <param name="lastWriteDate">This is the date when data were last written to the file</param>
        /// <param name="lastWriteTime">This is the time on LastWriteDate when data were last written to the
        /// file.</param>
        /// <returns>a SetInformation2 request packet</returns>
        public SmbSetInformation2RequestPacket CreateSetInformation2Request(
            ushort messageId,
            ushort uid,
            ushort treeId,
            ushort fid,
            SmbFlags flags,
            SmbFlags2 flags2,
            SmbDate createDate,
            SmbTime creationTime,
            SmbDate lastAccessDate,
            SmbTime lastAccessTime,
            SmbDate lastWriteDate,
            SmbTime lastWriteTime)
        {
            SmbSetInformation2RequestPacket packet = new SmbSetInformation2RequestPacket();

            packet.SmbHeader = CifsMessageUtils.CreateSmbHeader(SmbCommand.SMB_COM_SET_INFORMATION2,
                messageId, uid, treeId, flags, flags2);

            SMB_COM_SET_INFORMATION2_Request_SMB_Parameters smbParameters =
                new SMB_COM_SET_INFORMATION2_Request_SMB_Parameters();
            smbParameters.FID = fid;
            smbParameters.CreateDate = createDate;
            smbParameters.CreationTime = creationTime;
            smbParameters.LastAccessDate = lastAccessDate;
            smbParameters.LastAccessTime = lastAccessTime;
            smbParameters.LastWriteDate = lastWriteDate;
            smbParameters.LastWriteTime = lastWriteTime;
            smbParameters.WordCount = (byte)(Marshal.SizeOf(smbParameters) / NumBytesOfWord);

            SMB_COM_SET_INFORMATION2_Request_SMB_Data smbData = new SMB_COM_SET_INFORMATION2_Request_SMB_Data();
            smbData.ByteCount = 0;

            packet.SmbParameters = smbParameters;
            packet.SmbData = smbData;

            return packet;
        }
 /// <summary>
 /// to create a SetInformation2 request packet.
 /// </summary>
 /// <param name="uid">This field SHOULD identify the authenticated instance of the user.</param>
 /// <param name="treeId">This field identifies the subdirectory (or tree) on the server that the client is
 /// accessing.</param>
 /// <param name="fid">This is the FID representing the file for which attributes are to be set.</param>
 /// <param name="createDate">This is the FID representing the file for which attributes are to be set</param>
 /// <param name="creationTime">This is the date when the file was created</param>
 /// <param name="lastAccessDate">This is the date when the file was last accessed</param>
 /// <param name="lastAccessTime">This is the time on LastAccessDate when the file was last accessed.</param>
 /// <param name="lastWriteDate">This is the date when data were last written to the file</param>
 /// <param name="lastWriteTime">This is the time on LastWriteDate when data were last written to the
 /// file.</param>
 /// <returns>a SetInformation2 request packet</returns>
 /// <exception cref="System.NullReferenceException">There is no connection in context. </exception>
 public SmbSetInformation2RequestPacket CreateSetInformation2Request(
     ushort uid,
     ushort treeId,
     ushort fid,
     SmbDate createDate,
     SmbTime creationTime,
     SmbDate lastAccessDate,
     SmbTime lastAccessTime,
     SmbDate lastWriteDate,
     SmbTime lastWriteTime)
 {
     return this.CreateSetInformation2Request(this.Context.GetMessageId(this.connectionId),
         uid, treeId, fid, this.defaultParameters.Flag, this.defaultParameters.Flag2, createDate, creationTime,
         lastAccessDate, lastAccessTime, lastWriteDate, lastWriteTime);
 }
        public SmbQueryInformation2ResponsePacket CreateQueryInformation2Response(
            CifsServerPerConnection connection,
            SmbQueryInformation2RequestPacket request,
            SmbDate createDate,
            SmbTime createTime,
            SmbDate lastAccessDate,
            SmbTime lastAccessTime,
            SmbDate lastWriteDate,
            SmbTime lastWriteTime,
            uint fileDataSize,
            uint fileAllocationSize,
            SmbFileAttributes fileAttributes)
        {
            SmbQueryInformation2ResponsePacket response = new SmbQueryInformation2ResponsePacket();
            response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);

            SMB_COM_QUERY_INFORMATION2_Response_SMB_Parameters smbParameters = response.SmbParameters;
            smbParameters.CreateDate = createDate;
            smbParameters.CreationTime = createTime;
            smbParameters.LastAccessDate = lastAccessDate;
            smbParameters.LastAccessTime = lastAccessTime;
            smbParameters.LastWriteDate = lastWriteDate;
            smbParameters.LastWriteTime = lastWriteTime;
            smbParameters.FileDataSize = fileDataSize;
            smbParameters.FileAllocationSize = fileAllocationSize;
            smbParameters.FileAttributes = fileAttributes;
            smbParameters.WordCount = (byte)(TypeMarshal.GetBlockMemorySize(smbParameters) / 2);
            response.SmbParameters = smbParameters;

            return response;
        }