Пример #1
0
        private void ConnectThread()
        {
            try
            {
                // Инициализация
                Options.width  = 1024;
                Options.height = 768;
                Options.Canvas = new RdpCanvas(Options.width, Options.height);
                ControlFlow.resetOrderState();
                Licence.Reset();
                ChangedRect.Reset();

                // Подключение
                Network.Connect(Options.Host, Options.Port);
                MCS.sendСonnectionRequest(null, false);

                // Получения изображения
                Rdp.Start();
            }
            catch
            {
                // Флаг выполнения
                Options.IsRunned = false;
            }
        }
Пример #2
0
        internal static RdpPacket Secure_receive(out bool bFastPath)
        {
            int num, num2;

            MCS.TS_SECURITY_HEADER num3;
            RdpPacket packet = null;

Label_0001:
            bFastPath = false;
            packet    = ReceiveMCS(out num, out num2);

            if (packet == null)
            {
                return(null);
            }

            switch (num2)
            {
            case 0xff:
                bFastPath = true;
                return(packet);

            case 0xfe:
                packet    = Secure.DecryptPacket(packet);
                bFastPath = true;
                return(packet);
            }

            if (Secure.RDPEncrypted() || Licence.IsLicensePacket(packet))
            {
                num3 = (MCS.TS_SECURITY_HEADER)packet.ReadLittleEndian32();

                if (num3.HasFlag(MCS.TS_SECURITY_HEADER.SEC_ENCRYPT))
                {
                    packet = Secure.DecryptPacket(packet);
                }

                if (num3.HasFlag(MCS.TS_SECURITY_HEADER.SEC_LICENSE_PKT))
                {
                    Licence.process(packet);
                    goto Label_0001;
                }

                if (num3.HasFlag(MCS.TS_SECURITY_HEADER.SEC_REDIRECTION_PKT))
                {
                    ControlFlow.processRedirection(packet, true);
                    goto Label_0001;
                }
            }

            if (num != MCS.MSC_GLOBAL_CHANNEL)
            {
                Channels.channel_process(num, packet);
                goto Label_0001;
            }

            return(packet);
        }
Пример #3
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);
            }
        }