Ejemplo n.º 1
0
        internal static void processRedirection(RdpPacket data, bool bStdRedirect)
        {
            if (!bStdRedirect)
            {
                data.ReadLittleEndian16();
            }

            data.ReadLittleEndian16();
            data.ReadLittleEndian16();
            Options.sessionID = data.ReadLittleEndian32();
            int num = data.ReadLittleEndian32();

            if ((num & 1) != 0)
            {
                Options.Host = data.ReadUnicodeString();
            }

            byte[] buffer = null;

            if ((num & 2) != 0)
            {
                int count = data.ReadLittleEndian32();
                buffer = new byte[count];
                data.Read(buffer, 0, count);
            }

            if ((num & 4) != 0)
            {
                Options.Username = data.ReadUnicodeString();
            }

            if ((num & 8) != 0)
            {
                Options.Domain = data.ReadUnicodeString();
            }

            if ((num & 0x10) != 0)
            {
                Options.Password = data.ReadUnicodeString();
            }

            if ((num & 0x200) != 0)
            {
                Options.Host = data.ReadUnicodeString();
            }

            if ((num & 0x100) != 0)
            {
                Options.Host = data.ReadUnicodeString();
            }

            if (!string.IsNullOrEmpty(Options.Domain))
            {
                Options.DomainAndUsername = Options.Domain + @"\" + Options.Username;
            }
            else
            {
                Options.DomainAndUsername = Options.Username;
            }

            if ((num & 0x80) == 0)
            {
                Network.Close();
                Licence.Reset();
                Network.Connect(Options.Host, Options.Port);
                MCS.sendСonnectionRequest(buffer, false);
            }
        }