/// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbSetInformation2RequestPacket(SmbSetInformation2RequestPacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.smbParameters.WordCount = packet.SmbParameters.WordCount;
            this.smbParameters.FID = packet.SmbParameters.FID;
            this.smbParameters.CreateDate = new SmbDate();
            this.smbParameters.CreateDate.Year = packet.SmbParameters.CreateDate.Year;
            this.smbParameters.CreateDate.Month = packet.SmbParameters.CreateDate.Month;
            this.smbParameters.CreateDate.Day = packet.SmbParameters.CreateDate.Day;
            this.smbParameters.CreationTime = new SmbTime();
            this.smbParameters.CreationTime.Hour = packet.SmbParameters.CreationTime.Hour;
            this.smbParameters.CreationTime.Minutes = packet.SmbParameters.CreationTime.Minutes;
            this.smbParameters.CreationTime.Seconds = packet.SmbParameters.CreationTime.Seconds;
            this.smbParameters.LastAccessDate = new SmbDate();
            this.smbParameters.LastAccessDate.Year = packet.SmbParameters.LastAccessDate.Year;
            this.smbParameters.LastAccessDate.Month = packet.SmbParameters.LastAccessDate.Month;
            this.smbParameters.LastAccessDate.Day = packet.SmbParameters.LastAccessDate.Day;
            this.smbParameters.LastAccessTime = new SmbTime();
            this.smbParameters.LastAccessTime.Hour = packet.SmbParameters.LastAccessTime.Hour;
            this.smbParameters.LastAccessTime.Minutes = packet.SmbParameters.LastAccessTime.Minutes;
            this.smbParameters.LastAccessTime.Seconds = packet.SmbParameters.LastAccessTime.Seconds;
            this.smbParameters.LastWriteDate = new SmbDate();
            this.smbParameters.LastWriteDate.Year = packet.SmbParameters.LastWriteDate.Year;
            this.smbParameters.LastWriteDate.Month = packet.SmbParameters.LastWriteDate.Month;
            this.smbParameters.LastWriteDate.Day = packet.SmbParameters.LastWriteDate.Day;
            this.smbParameters.LastWriteTime = new SmbTime();
            this.smbParameters.LastWriteTime.Hour = packet.SmbParameters.LastWriteTime.Hour;
            this.smbParameters.LastWriteTime.Minutes = packet.SmbParameters.LastWriteTime.Minutes;
            this.smbParameters.LastWriteTime.Seconds = packet.SmbParameters.LastWriteTime.Seconds;

            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
Exemple #2
0
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbSetInformation2RequestPacket(SmbSetInformation2RequestPacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.smbParameters.WordCount              = packet.SmbParameters.WordCount;
            this.smbParameters.FID                    = packet.SmbParameters.FID;
            this.smbParameters.CreateDate             = new SmbDate();
            this.smbParameters.CreateDate.Year        = packet.SmbParameters.CreateDate.Year;
            this.smbParameters.CreateDate.Month       = packet.SmbParameters.CreateDate.Month;
            this.smbParameters.CreateDate.Day         = packet.SmbParameters.CreateDate.Day;
            this.smbParameters.CreationTime           = new SmbTime();
            this.smbParameters.CreationTime.Hour      = packet.SmbParameters.CreationTime.Hour;
            this.smbParameters.CreationTime.Minutes   = packet.SmbParameters.CreationTime.Minutes;
            this.smbParameters.CreationTime.Seconds   = packet.SmbParameters.CreationTime.Seconds;
            this.smbParameters.LastAccessDate         = new SmbDate();
            this.smbParameters.LastAccessDate.Year    = packet.SmbParameters.LastAccessDate.Year;
            this.smbParameters.LastAccessDate.Month   = packet.SmbParameters.LastAccessDate.Month;
            this.smbParameters.LastAccessDate.Day     = packet.SmbParameters.LastAccessDate.Day;
            this.smbParameters.LastAccessTime         = new SmbTime();
            this.smbParameters.LastAccessTime.Hour    = packet.SmbParameters.LastAccessTime.Hour;
            this.smbParameters.LastAccessTime.Minutes = packet.SmbParameters.LastAccessTime.Minutes;
            this.smbParameters.LastAccessTime.Seconds = packet.SmbParameters.LastAccessTime.Seconds;
            this.smbParameters.LastWriteDate          = new SmbDate();
            this.smbParameters.LastWriteDate.Year     = packet.SmbParameters.LastWriteDate.Year;
            this.smbParameters.LastWriteDate.Month    = packet.SmbParameters.LastWriteDate.Month;
            this.smbParameters.LastWriteDate.Day      = packet.SmbParameters.LastWriteDate.Day;
            this.smbParameters.LastWriteTime          = new SmbTime();
            this.smbParameters.LastWriteTime.Hour     = packet.SmbParameters.LastWriteTime.Hour;
            this.smbParameters.LastWriteTime.Minutes  = packet.SmbParameters.LastWriteTime.Minutes;
            this.smbParameters.LastWriteTime.Seconds  = packet.SmbParameters.LastWriteTime.Seconds;

            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
        /// <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;
        }
        public SmbSetInformation2ResponsePacket CreateSetInformation2Response(
            CifsServerPerConnection connection,
            SmbSetInformation2RequestPacket request)
        {
            SmbSetInformation2ResponsePacket response = new SmbSetInformation2ResponsePacket();
            response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);

            return response;
        }