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

            this.smbParameters.WordCount = packet.SmbParameters.WordCount;
            this.smbParameters.Count = packet.SmbParameters.Count;
            this.smbData.ByteCount = packet.SmbData.ByteCount;
            this.smbData.BufferFormat = packet.SmbData.BufferFormat;
            this.smbData.DataLength = packet.SmbData.DataLength;

            if (packet.smbData.DirectoryInformationData != null)
            {
                ushort dirInformationLength = 43;
                this.smbData.DirectoryInformationData = new SMB_Directory_Information[packet.smbData.DataLength
                    / dirInformationLength];
                for (int i = 0; i < packet.smbData.DirectoryInformationData.Length; i++)
                {
                    this.smbData.DirectoryInformationData[i] = packet.smbData.DirectoryInformationData[i];
                    this.smbData.DirectoryInformationData[i].FileName =
                        new byte[packet.smbData.DirectoryInformationData[i].FileName.Length];
                    Array.Copy(
                        packet.smbData.DirectoryInformationData[i].FileName,
                        this.smbData.DirectoryInformationData[i].FileName,
                        packet.smbData.DirectoryInformationData[i].FileName.Length);
                }
            }
            else
            {
                this.smbData.DirectoryInformationData = new SMB_Directory_Information[0];
            }
        }
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbFindUniqueResponsePacket(SmbFindUniqueResponsePacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.smbParameters.WordCount = packet.SmbParameters.WordCount;
            this.smbParameters.Count     = packet.SmbParameters.Count;
            this.smbData.ByteCount       = packet.SmbData.ByteCount;
            this.smbData.BufferFormat    = packet.SmbData.BufferFormat;
            this.smbData.DataLength      = packet.SmbData.DataLength;

            if (packet.smbData.DirectoryInformationData != null)
            {
                ushort dirInformationLength = 43;
                this.smbData.DirectoryInformationData = new SMB_Directory_Information[packet.smbData.DataLength
                                                                                      / dirInformationLength];
                for (int i = 0; i < packet.smbData.DirectoryInformationData.Length; i++)
                {
                    this.smbData.DirectoryInformationData[i]          = packet.smbData.DirectoryInformationData[i];
                    this.smbData.DirectoryInformationData[i].FileName =
                        new byte[packet.smbData.DirectoryInformationData[i].FileName.Length];
                    Array.Copy(
                        packet.smbData.DirectoryInformationData[i].FileName,
                        this.smbData.DirectoryInformationData[i].FileName,
                        packet.smbData.DirectoryInformationData[i].FileName.Length);
                }
            }
            else
            {
                this.smbData.DirectoryInformationData = new SMB_Directory_Information[0];
            }
        }
        public SmbFindUniqueResponsePacket CreateFindUniqueResponse(
            CifsServerPerConnection connection,
            SmbFindUniqueRequestPacket request,
            SMB_Directory_Information[] directoryInformationData)
        {
            directoryInformationData = directoryInformationData ?? new SMB_Directory_Information[0];
            SmbFindUniqueResponsePacket response = new SmbFindUniqueResponsePacket();
            response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);

            SMB_COM_FIND_UNIQUE_Response_SMB_Parameters smbParameters = response.SmbParameters;
            smbParameters.Count = (ushort)directoryInformationData.Length;
            smbParameters.WordCount = (byte)(TypeMarshal.GetBlockMemorySize(smbParameters) / 2);
            response.SmbParameters = smbParameters;

            ushort dataLength = 0;
            foreach (SMB_Directory_Information info in directoryInformationData)
            {
                dataLength += (ushort)TypeMarshal.GetBlockMemorySize(info);
            }
            SMB_COM_FIND_UNIQUE_Response_SMB_Data smbData = response.SmbData;
            smbData.BufferFormat = 0x05;
            smbData.DirectoryInformationData = directoryInformationData;
            smbData.DataLength = dataLength;
            smbData.ByteCount = (ushort)(dataLength + 0x03);
            response.SmbData = smbData;

            return response;
        }