コード例 #1
0
ファイル: PortScanner.cs プロジェクト: najachai/RDPUploader
        // Проверка ip на версию протокола RDP
        internal static bool?GetRdpVersion(string ip, int port, int timeout)
        {
            bool?result = false;

            try
            {
                // Rdp клиент
                var client = new RDPClient();

                // Подключение
                int version = 0;

                try
                {
                    version = client.CheckRdpVersion(ip, port, timeout, NativeWrapper.Dll.SecureValue1, NativeWrapper.Dll.SecureValue2);
                }
                catch { }

                if (version == 8) // PROTOCOL_HYBRID_EX 0x00000008
                {
                    result = true;
                }
                else if (version == 2) // PROTOCOL_HYBRID 0x00000002
                {
                    result = true;
                }
                else if (version == 268435456) // PROTOCOL_RDP (Windows 2003) 0x10000000
                {
                    result = false;
                }
                else if (version == 1) // PROTOCOL_SSL (Windows 2003) 0x00000001
                {
                    result = false;
                }
                else if (version == 0) // PROTOCOL_RDP (Windows XP) 0x00000000
                {
                    result = false;
                }
                else if (version == -1)
                {
                    result = null;
                }
                else
                {
                    result = false;
                }
            }
            catch { }

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Starts to connect to the host.
        /// </summary>
        /// <returns></returns>
        public override async Task Connect()
        {
            IsConnecting.Value = true;
            IsConnected.Value  = false;
            await EstablishRequiredConnection();

            RDPClient         = new RDPClient(ConnectionInfo);
            RDPClient.Closed += (s, e) =>
            {
                App.Current.Dispatcher.Invoke(async() =>
                {
                    await Disconnect();
                });
            };
            var(host, port) = GetActualEndPoint();
            this.WriteLog("Connecting...");
            await RDPClient.Open(host, port);

            this.WriteLog("Connection Established.");
            IsConnected.Value  = RDPClient.IsOpened;
            IsConnecting.Value = false;
        }
コード例 #3
0
ファイル: frm_main.cs プロジェクト: timsafari/Saft-RDP-Client
        private void button1_Click(object sender, EventArgs e)
        {
            if (RDPClient.Connected != 1)
            {
                RDPClient.Server   = textBox1.Text;
                RDPClient.UserName = textBox2.Text;
                RDPClient.AdvancedSettings2.ClearTextPassword = textBox3.Text;
                if (comboBox3.Text != "Локальный вход")
                {
                    RDPClient.Domain = comboBox3.Text;
                }
                else
                {
                    RDPClient.Domain = textBox1.Text;
                }



                switch (comboBox1.SelectedIndex)
                {
                case 0:
                    RDPClient.ColorDepth = 8;
                    break;

                case 1:
                    RDPClient.ColorDepth = 15;
                    break;

                case 2:
                    RDPClient.ColorDepth = 16;
                    break;

                case 3:
                    RDPClient.ColorDepth = 24;
                    break;

                case 4:
                    RDPClient.ColorDepth = 32;
                    break;
                }

                switch (comboBox2.SelectedIndex)
                {
                case 0:
                    RDPClient.DesktopWidth  = 640;
                    RDPClient.DesktopHeight = 480;
                    break;

                case 1:
                    RDPClient.DesktopWidth  = 800;
                    RDPClient.DesktopHeight = 600;
                    break;

                case 2:
                    RDPClient.DesktopWidth  = 1024;
                    RDPClient.DesktopHeight = 768;
                    break;

                case 3:
                    RDPClient.DesktopWidth  = 1280;
                    RDPClient.DesktopHeight = 1024;
                    break;

                case 4:
                    RDPClient.DesktopWidth  = RDPClient.Width;
                    RDPClient.DesktopHeight = RDPClient.Height;
                    break;
                }

                if (checkBox1.Checked)
                {
                    RDPClient.AdvancedSettings2.SmartSizing          = true;
                    RDPClient.AdvancedSettings2.DisplayConnectionBar = true;
                }

                if (checkBox2.Checked)
                {
                    RDPClient.FullScreen      = true;
                    RDPClient.FullScreenTitle = RDPClient.UserName + " on " + RDPClient.Server;
                }


                if (checkBox3.Checked)
                {
                    RDPClient.AdvancedSettings2.ConnectToServerConsole = true;
                }


                RDPClient.SecuredSettings2.AudioRedirectionMode = 2;
                RDPClient.BringToFront();
                RDPClient.Connect();
            }
            else
            {
                RDPClient.Disconnect();
            }
        }
コード例 #4
0
ファイル: frm_main.cs プロジェクト: timsafari/Saft-RDP-Client
        private void FastConnect_ConnectButton_Click(object sender, EventArgs e)
        {
            if (RDPClient.Connected != 1)
            {
                RDPClient.Server   = FastConnect_Server_TxtBx.Text;
                RDPClient.UserName = FastConnect_UserName_TxtBx.Text;
                RDPClient.AdvancedSettings2.ClearTextPassword = FastConnect_Password_TxtBx.Text;
                if (FastConnect_Domain_TxtBx.Text != "Локальный вход")
                {
                    RDPClient.Domain = FastConnect_Domain_TxtBx.Text;
                }
                else
                {
                    RDPClient.Domain = FastConnect_Server_TxtBx.Text;
                }



                switch (FastConnect_ColorDepth_CmbBx.SelectedIndex)
                {
                case 0:
                    RDPClient.ColorDepth = 8;
                    break;

                case 1:
                    RDPClient.ColorDepth = 15;
                    break;

                case 2:
                    RDPClient.ColorDepth = 16;
                    break;

                case 3:
                    RDPClient.ColorDepth = 24;
                    break;

                case 4:
                    RDPClient.ColorDepth = 32;
                    break;
                }

                switch (FastConnect_Resolution_CmbBx.SelectedIndex)
                {
                case 0:
                    RDPClient.DesktopWidth  = 640;
                    RDPClient.DesktopHeight = 480;
                    break;

                case 1:
                    RDPClient.DesktopWidth  = 800;
                    RDPClient.DesktopHeight = 600;
                    break;

                case 2:
                    RDPClient.DesktopWidth  = 1024;
                    RDPClient.DesktopHeight = 768;
                    break;

                case 3:
                    RDPClient.DesktopWidth  = 1280;
                    RDPClient.DesktopHeight = 1024;
                    break;

                case 4:
                    RDPClient.DesktopWidth  = RDPClient.Width;
                    RDPClient.DesktopHeight = RDPClient.Height;
                    break;
                }

                if (FastConnect_Scaling_ChkBx.Checked)
                {
                    RDPClient.AdvancedSettings2.SmartSizing          = true;
                    RDPClient.AdvancedSettings2.DisplayConnectionBar = true;
                }

                if (FastConnect_FullScreen_ChkBx.Checked)
                {
                    RDPClient.FullScreen      = true;
                    RDPClient.FullScreenTitle = RDPClient.UserName + " on " + RDPClient.Server;
                }


                if (FastConnect_ConnectToConsole_ChkBx.Checked)
                {
                    RDPClient.AdvancedSettings2.ConnectToServerConsole = true;
                }

                RDPClient.SecuredSettings2.AudioRedirectionMode = 2;
                RDPClient.BringToFront();

                try
                {
                    RDPClient.Connect();
                }
                catch
                {
                    MessageBox.Show("Соединение не может быть установлено");
                }
            }
            else
            {
                RDPClient.Disconnect();
            }
        }