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

            this.smbParameters.WordCount = packet.SmbParameters.WordCount;
            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.smbParameters.FileDataSize = packet.SmbParameters.FileDataSize;
            this.smbParameters.FileAllocationSize = packet.SmbParameters.FileAllocationSize;
            this.smbParameters.FileAttributes = packet.SmbParameters.FileAttributes;

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

            this.smbParameters.WordCount              = packet.SmbParameters.WordCount;
            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.smbParameters.FileDataSize           = packet.SmbParameters.FileDataSize;
            this.smbParameters.FileAllocationSize     = packet.SmbParameters.FileAllocationSize;
            this.smbParameters.FileAttributes         = packet.SmbParameters.FileAttributes;

            this.smbData.ByteCount = packet.SmbData.ByteCount;
        }
        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;
        }