diff --git a/mRemoteV1/Connection/Protocol/RDP/Enums/RdpVersion.cs b/mRemoteV1/Connection/Protocol/RDP/Enums/RdpVersion.cs index 9872b5fb7..ee667343e 100644 --- a/mRemoteV1/Connection/Protocol/RDP/Enums/RdpVersion.cs +++ b/mRemoteV1/Connection/Protocol/RDP/Enums/RdpVersion.cs @@ -11,9 +11,15 @@ namespace mRemoteNG.Connection.Protocol.RDP public static readonly Version RDC81 = new Version(6, 3, 9600); } + /// + /// Represents a version of the RDP Client + /// public enum RdpVersionEnum { Rdc6, - Rdc8 + Rdc7, + Rdc8, + Rdc9, + Rdc10 } } diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol10.cs b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol10.cs new file mode 100644 index 000000000..e273cd11d --- /dev/null +++ b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol10.cs @@ -0,0 +1,18 @@ +using AxMSTSCLib; +using MSTSCLib; + +namespace mRemoteNG.Connection.Protocol.RDP +{ + public class RdpProtocol10 : RdpProtocol9 + { + public RdpProtocol10() + { + Control = new AxMsRdpClient10NotSafeForScripting(); + } + + protected override MsRdpClient6NotSafeForScripting CreateRdpClientControl() + { + return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient10NotSafeForScripting)Control).GetOcx(); + } + } +} diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol6.cs b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol6.cs index 80db8eee1..5ff307dc5 100644 --- a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol6.cs +++ b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol6.cs @@ -14,11 +14,11 @@ namespace mRemoteNG.Connection.Protocol.RDP { public class RdpProtocol6 : ProtocolBase { - private MsRdpClient6NotSafeForScripting _rdpClient; private Version _rdpVersion; private bool _redirectKeys; private bool _alertOnIdleDisconnect; private readonly FrmMain _frmMain = FrmMain.Default; + protected MsRdpClient6NotSafeForScripting RdpClient; protected bool LoginComplete; protected ConnectionInfo ConnectionInfo; @@ -27,11 +27,11 @@ namespace mRemoteNG.Connection.Protocol.RDP { get { - return _rdpClient.AdvancedSettings2.SmartSizing; + return RdpClient.AdvancedSettings2.SmartSizing; } protected set { - _rdpClient.AdvancedSettings2.SmartSizing = value; + RdpClient.AdvancedSettings2.SmartSizing = value; } } @@ -39,11 +39,11 @@ namespace mRemoteNG.Connection.Protocol.RDP { get { - return _rdpClient.FullScreen; + return RdpClient.FullScreen; } protected set { - _rdpClient.FullScreen = value; + RdpClient.FullScreen = value; } } @@ -65,8 +65,8 @@ namespace mRemoteNG.Connection.Protocol.RDP return; } - Debug.Assert(Convert.ToBoolean(_rdpClient.SecuredSettingsEnabled)); - var msRdpClientSecuredSettings = _rdpClient.SecuredSettings2; + Debug.Assert(Convert.ToBoolean(RdpClient.SecuredSettingsEnabled)); + var msRdpClientSecuredSettings = RdpClient.SecuredSettings2; msRdpClientSecuredSettings.KeyboardHookMode = 1; // Apply key combinations at the remote server. } catch (Exception ex) @@ -79,19 +79,13 @@ namespace mRemoteNG.Connection.Protocol.RDP public bool LoadBalanceInfoUseUtf8 { get; set; } #endregion - #region Constructors public RdpProtocol6() { Control = new AxMsRdpClient6NotSafeForScripting(); Connecting += OnConnectingDebugMessage; } - private void OnConnectingDebugMessage(object sender) - { - Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, $"Using RDP version: {ConnectionInfo.RdpProtocolVersion}"); - } - - #endregion + #region Public Methods public override bool Initialize() @@ -109,7 +103,7 @@ namespace mRemoteNG.Connection.Protocol.RDP Thread.Sleep(0); Application.DoEvents(); } - _rdpClient = (MsRdpClient6NotSafeForScripting)CreateRdpClientControl(); + RdpClient = CreateRdpClientControl(); } catch (System.Runtime.InteropServices.COMException ex) { @@ -118,31 +112,31 @@ namespace mRemoteNG.Connection.Protocol.RDP return false; } - _rdpVersion = new Version(_rdpClient.Version); + _rdpVersion = new Version(RdpClient.Version); - _rdpClient.Server = ConnectionInfo.Hostname; + RdpClient.Server = ConnectionInfo.Hostname; SetCredentials(); SetResolution(); - _rdpClient.FullScreenTitle = ConnectionInfo.Name; + RdpClient.FullScreenTitle = ConnectionInfo.Name; _alertOnIdleDisconnect = ConnectionInfo.RDPAlertIdleTimeout; - _rdpClient.AdvancedSettings2.MinutesToIdleTimeout = ConnectionInfo.RDPMinutesToIdleTimeout; + RdpClient.AdvancedSettings2.MinutesToIdleTimeout = ConnectionInfo.RDPMinutesToIdleTimeout; //not user changeable - _rdpClient.AdvancedSettings2.GrabFocusOnConnect = true; - _rdpClient.AdvancedSettings3.EnableAutoReconnect = true; - _rdpClient.AdvancedSettings3.MaxReconnectAttempts = Settings.Default.RdpReconnectionCount; - _rdpClient.AdvancedSettings2.keepAliveInterval = 60000; //in milliseconds (10,000 = 10 seconds) - _rdpClient.AdvancedSettings5.AuthenticationLevel = 0; - _rdpClient.AdvancedSettings2.EncryptionEnabled = 1; + RdpClient.AdvancedSettings2.GrabFocusOnConnect = true; + RdpClient.AdvancedSettings3.EnableAutoReconnect = true; + RdpClient.AdvancedSettings3.MaxReconnectAttempts = Settings.Default.RdpReconnectionCount; + RdpClient.AdvancedSettings2.keepAliveInterval = 60000; //in milliseconds (10,000 = 10 seconds) + RdpClient.AdvancedSettings5.AuthenticationLevel = 0; + RdpClient.AdvancedSettings2.EncryptionEnabled = 1; - _rdpClient.AdvancedSettings2.overallConnectionTimeout = Settings.Default.ConRDPOverallConnectionTimeout; + RdpClient.AdvancedSettings2.overallConnectionTimeout = Settings.Default.ConRDPOverallConnectionTimeout; - _rdpClient.AdvancedSettings2.BitmapPeristence = Convert.ToInt32(ConnectionInfo.CacheBitmaps); + RdpClient.AdvancedSettings2.BitmapPeristence = Convert.ToInt32(ConnectionInfo.CacheBitmaps); if (_rdpVersion >= RdpVersion.RDC61) { - _rdpClient.AdvancedSettings7.EnableCredSspSupport = ConnectionInfo.UseCredSsp; + RdpClient.AdvancedSettings7.EnableCredSspSupport = ConnectionInfo.UseCredSsp; } SetUseConsoleSession(); @@ -153,11 +147,11 @@ namespace mRemoteNG.Connection.Protocol.RDP SetLoadBalanceInfo(); SetRdGateway(); - _rdpClient.ColorDepth = (int)ConnectionInfo.Colors; + RdpClient.ColorDepth = (int)ConnectionInfo.Colors; SetPerformanceFlags(); - _rdpClient.ConnectingText = Language.strConnecting; + RdpClient.ConnectingText = Language.strConnecting; Control.Anchor = AnchorStyles.None; tmrReconnect.Elapsed += tmrReconnect_Elapsed; @@ -178,7 +172,7 @@ namespace mRemoteNG.Connection.Protocol.RDP try { - _rdpClient.Connect(); + RdpClient.Connect(); base.Connect(); return true; } @@ -194,7 +188,7 @@ namespace mRemoteNG.Connection.Protocol.RDP { try { - _rdpClient.Disconnect(); + RdpClient.Disconnect(); } catch (Exception ex) { @@ -244,16 +238,16 @@ namespace mRemoteNG.Connection.Protocol.RDP #endregion #region Private Methods - protected virtual object CreateRdpClientControl() + protected virtual MsRdpClient6NotSafeForScripting CreateRdpClientControl() { - return ((AxMsRdpClient6NotSafeForScripting)Control).GetOcx(); + return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient6NotSafeForScripting)Control).GetOcx(); } private void SetRdGateway() { try { - if (_rdpClient.TransportSettings.GatewayIsSupported == 0) + if (RdpClient.TransportSettings.GatewayIsSupported == 0) { Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strRdpGatewayNotSupported, true); return; @@ -262,31 +256,31 @@ namespace mRemoteNG.Connection.Protocol.RDP if (ConnectionInfo.RDGatewayUsageMethod != RDGatewayUsageMethod.Never) { - _rdpClient.TransportSettings.GatewayUsageMethod = (uint)ConnectionInfo.RDGatewayUsageMethod; - _rdpClient.TransportSettings.GatewayHostname = ConnectionInfo.RDGatewayHostname; - _rdpClient.TransportSettings.GatewayProfileUsageMethod = 1; // TSC_PROXY_PROFILE_MODE_EXPLICIT + RdpClient.TransportSettings.GatewayUsageMethod = (uint)ConnectionInfo.RDGatewayUsageMethod; + RdpClient.TransportSettings.GatewayHostname = ConnectionInfo.RDGatewayHostname; + RdpClient.TransportSettings.GatewayProfileUsageMethod = 1; // TSC_PROXY_PROFILE_MODE_EXPLICIT if (ConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard) { - _rdpClient.TransportSettings.GatewayCredsSource = 1; // TSC_PROXY_CREDS_MODE_SMARTCARD + RdpClient.TransportSettings.GatewayCredsSource = 1; // TSC_PROXY_CREDS_MODE_SMARTCARD } if (_rdpVersion >= RdpVersion.RDC61 && (Force & ConnectionInfo.Force.NoCredentials) != ConnectionInfo.Force.NoCredentials) { if (ConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.Yes) { - _rdpClient.TransportSettings2.GatewayUsername = ConnectionInfo.Username; - _rdpClient.TransportSettings2.GatewayPassword = ConnectionInfo.Password; - _rdpClient.TransportSettings2.GatewayDomain = ConnectionInfo?.Domain; + RdpClient.TransportSettings2.GatewayUsername = ConnectionInfo.Username; + RdpClient.TransportSettings2.GatewayPassword = ConnectionInfo.Password; + RdpClient.TransportSettings2.GatewayDomain = ConnectionInfo?.Domain; } else if (ConnectionInfo.RDGatewayUseConnectionCredentials == RDGatewayUseConnectionCredentials.SmartCard) { - _rdpClient.TransportSettings2.GatewayCredSharing = 0; + RdpClient.TransportSettings2.GatewayCredSharing = 0; } else { - _rdpClient.TransportSettings2.GatewayUsername = ConnectionInfo.RDGatewayUsername; - _rdpClient.TransportSettings2.GatewayPassword = ConnectionInfo.RDGatewayPassword; - _rdpClient.TransportSettings2.GatewayDomain = ConnectionInfo.RDGatewayDomain; - _rdpClient.TransportSettings2.GatewayCredSharing = 0; + RdpClient.TransportSettings2.GatewayUsername = ConnectionInfo.RDGatewayUsername; + RdpClient.TransportSettings2.GatewayPassword = ConnectionInfo.RDGatewayPassword; + RdpClient.TransportSettings2.GatewayDomain = ConnectionInfo.RDGatewayDomain; + RdpClient.TransportSettings2.GatewayCredSharing = 0; } } } @@ -319,7 +313,7 @@ namespace mRemoteNG.Connection.Protocol.RDP if (_rdpVersion >= RdpVersion.RDC61) { Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, string.Format(Language.strRdpSetConsoleSwitch, _rdpVersion), true); - _rdpClient.AdvancedSettings7.ConnectToAdministerServer = value; + RdpClient.AdvancedSettings7.ConnectToAdministerServer = value; } else { @@ -352,16 +346,16 @@ namespace mRemoteNG.Connection.Protocol.RDP { if (Settings.Default.EmptyCredentials == "windows") { - _rdpClient.UserName = Environment.UserName; + RdpClient.UserName = Environment.UserName; } else if (Settings.Default.EmptyCredentials == "custom") { - _rdpClient.UserName = Settings.Default.DefaultUsername; + RdpClient.UserName = Settings.Default.DefaultUsername; } } else { - _rdpClient.UserName = userName; + RdpClient.UserName = userName; } if (string.IsNullOrEmpty(password)) @@ -371,29 +365,29 @@ namespace mRemoteNG.Connection.Protocol.RDP if (Settings.Default.DefaultPassword != "") { var cryptographyProvider = new LegacyRijndaelCryptographyProvider(); - _rdpClient.AdvancedSettings2.ClearTextPassword = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey); + RdpClient.AdvancedSettings2.ClearTextPassword = cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, Runtime.EncryptionKey); } } } else { - _rdpClient.AdvancedSettings2.ClearTextPassword = password; + RdpClient.AdvancedSettings2.ClearTextPassword = password; } if (string.IsNullOrEmpty(domain)) { if (Settings.Default.EmptyCredentials == "windows") { - _rdpClient.Domain = Environment.UserDomainName; + RdpClient.Domain = Environment.UserDomainName; } else if (Settings.Default.EmptyCredentials == "custom") { - _rdpClient.Domain = Settings.Default.DefaultDomain; + RdpClient.Domain = Settings.Default.DefaultDomain; } } else { - _rdpClient.Domain = domain; + RdpClient.Domain = domain; } } catch (Exception ex) @@ -408,36 +402,36 @@ namespace mRemoteNG.Connection.Protocol.RDP { if ((Force & ConnectionInfo.Force.Fullscreen) == ConnectionInfo.Force.Fullscreen) { - _rdpClient.FullScreen = true; - _rdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width; - _rdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height; + RdpClient.FullScreen = true; + RdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width; + RdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height; return; } if ((InterfaceControl.Info.Resolution == RdpResolutions.FitToWindow) || (InterfaceControl.Info.Resolution == RdpResolutions.SmartSize)) { - _rdpClient.DesktopWidth = InterfaceControl.Size.Width; - _rdpClient.DesktopHeight = InterfaceControl.Size.Height; + RdpClient.DesktopWidth = InterfaceControl.Size.Width; + RdpClient.DesktopHeight = InterfaceControl.Size.Height; if (InterfaceControl.Info.Resolution == RdpResolutions.SmartSize) { - _rdpClient.AdvancedSettings2.SmartSizing = true; + RdpClient.AdvancedSettings2.SmartSizing = true; } } else if (InterfaceControl.Info.Resolution == RdpResolutions.Fullscreen) { - _rdpClient.FullScreen = true; - _rdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width; - _rdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height; + RdpClient.FullScreen = true; + RdpClient.DesktopWidth = Screen.FromControl(_frmMain).Bounds.Width; + RdpClient.DesktopHeight = Screen.FromControl(_frmMain).Bounds.Height; } else { var resolution = ConnectionInfo.Resolution.GetResolutionRectangle(); - _rdpClient.DesktopWidth = resolution.Width; - _rdpClient.DesktopHeight = resolution.Height; + RdpClient.DesktopWidth = resolution.Width; + RdpClient.DesktopHeight = resolution.Height; } } catch (Exception ex) @@ -452,7 +446,7 @@ namespace mRemoteNG.Connection.Protocol.RDP { if (ConnectionInfo.Port != (int)Defaults.Port) { - _rdpClient.AdvancedSettings2.RDPPort = ConnectionInfo.Port; + RdpClient.AdvancedSettings2.RDPPort = ConnectionInfo.Port; } } catch (Exception ex) @@ -465,11 +459,11 @@ namespace mRemoteNG.Connection.Protocol.RDP { try { - _rdpClient.AdvancedSettings2.RedirectDrives = ConnectionInfo.RedirectDiskDrives; - _rdpClient.AdvancedSettings2.RedirectPorts = ConnectionInfo.RedirectPorts; - _rdpClient.AdvancedSettings2.RedirectPrinters = ConnectionInfo.RedirectPrinters; - _rdpClient.AdvancedSettings2.RedirectSmartCards = ConnectionInfo.RedirectSmartCards; - _rdpClient.SecuredSettings2.AudioRedirectionMode = (int)ConnectionInfo.RedirectSound; + RdpClient.AdvancedSettings2.RedirectDrives = ConnectionInfo.RedirectDiskDrives; + RdpClient.AdvancedSettings2.RedirectPorts = ConnectionInfo.RedirectPorts; + RdpClient.AdvancedSettings2.RedirectPrinters = ConnectionInfo.RedirectPrinters; + RdpClient.AdvancedSettings2.RedirectSmartCards = ConnectionInfo.RedirectSmartCards; + RdpClient.SecuredSettings2.AudioRedirectionMode = (int)ConnectionInfo.RedirectSound; } catch (Exception ex) { @@ -502,7 +496,7 @@ namespace mRemoteNG.Connection.Protocol.RDP pFlags += Convert.ToInt32(RdpPerformanceFlags.EnableDesktopComposition); } - _rdpClient.AdvancedSettings2.PerformanceFlags = pFlags; + RdpClient.AdvancedSettings2.PerformanceFlags = pFlags; } catch (Exception ex) { @@ -514,7 +508,7 @@ namespace mRemoteNG.Connection.Protocol.RDP { try { - _rdpClient.AdvancedSettings5.AuthenticationLevel = (uint)ConnectionInfo.RDPAuthenticationLevel; + RdpClient.AdvancedSettings5.AuthenticationLevel = (uint)ConnectionInfo.RDPAuthenticationLevel; } catch (Exception ex) { @@ -530,7 +524,7 @@ namespace mRemoteNG.Connection.Protocol.RDP } try { - _rdpClient.AdvancedSettings2.LoadBalanceInfo = LoadBalanceInfoUseUtf8 + RdpClient.AdvancedSettings2.LoadBalanceInfo = LoadBalanceInfoUseUtf8 ? new AzureLoadBalanceInfoEncoder().Encode(ConnectionInfo.LoadBalanceInfo) : ConnectionInfo.LoadBalanceInfo; } @@ -544,21 +538,26 @@ namespace mRemoteNG.Connection.Protocol.RDP { try { - _rdpClient.OnConnecting += RDPEvent_OnConnecting; - _rdpClient.OnConnected += RDPEvent_OnConnected; - _rdpClient.OnLoginComplete += RDPEvent_OnLoginComplete; - _rdpClient.OnFatalError += RDPEvent_OnFatalError; - _rdpClient.OnDisconnected += RDPEvent_OnDisconnected; - _rdpClient.OnLeaveFullScreenMode += RDPEvent_OnLeaveFullscreenMode; - _rdpClient.OnIdleTimeoutNotification += RDPEvent_OnIdleTimeoutNotification; + RdpClient.OnConnecting += RDPEvent_OnConnecting; + RdpClient.OnConnected += RDPEvent_OnConnected; + RdpClient.OnLoginComplete += RDPEvent_OnLoginComplete; + RdpClient.OnFatalError += RDPEvent_OnFatalError; + RdpClient.OnDisconnected += RDPEvent_OnDisconnected; + RdpClient.OnLeaveFullScreenMode += RDPEvent_OnLeaveFullscreenMode; + RdpClient.OnIdleTimeoutNotification += RDPEvent_OnIdleTimeoutNotification; } catch (Exception ex) { Runtime.MessageCollector.AddExceptionStackTrace(Language.strRdpSetEventHandlersFailed, ex); } } + + private void OnConnectingDebugMessage(object sender, EventArgs args) + { + Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, $"Using RDP version: {ConnectionInfo.RdpProtocolVersion}"); + } #endregion - + #region Private Events & Handlers private void RDPEvent_OnIdleTimeoutNotification() { @@ -582,14 +581,14 @@ namespace mRemoteNG.Connection.Protocol.RDP const int UI_ERR_NORMAL_DISCONNECT = 0xB08; if (discReason != UI_ERR_NORMAL_DISCONNECT) { - var reason = _rdpClient.GetErrorDescription((uint)discReason, (uint) _rdpClient.ExtendedDisconnectReason); + var reason = RdpClient.GetErrorDescription((uint)discReason, (uint) RdpClient.ExtendedDisconnectReason); Event_Disconnected(this, discReason + "\r\n" + reason); } if (Settings.Default.ReconnectOnDisconnect) { ReconnectGroup = new ReconnectGroup(); - ReconnectGroup.CloseClicked += Event_ReconnectGroupCloseClicked; + ReconnectGroup.CloseClicked += Close; ReconnectGroup.Left = (int) ((double) Control.Width / 2 - (double) ReconnectGroup.Width / 2); ReconnectGroup.Top = (int) ((double) Control.Height / 2 - (double) ReconnectGroup.Height / 2); ReconnectGroup.Parent = Control; @@ -647,7 +646,7 @@ namespace mRemoteNG.Connection.Protocol.RDP tmrReconnect.Enabled = false; ReconnectGroup.DisposeReconnectGroup(); //SetProps() - _rdpClient.Connect(); + RdpClient.Connect(); } } #endregion diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol7.cs b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol7.cs new file mode 100644 index 000000000..2522d0279 --- /dev/null +++ b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol7.cs @@ -0,0 +1,18 @@ +using AxMSTSCLib; +using MSTSCLib; + +namespace mRemoteNG.Connection.Protocol.RDP +{ + public class RdpProtocol7 : RdpProtocol6 + { + public RdpProtocol7() + { + Control = new AxMsRdpClient7NotSafeForScripting(); + } + + protected override MsRdpClient6NotSafeForScripting CreateRdpClientControl() + { + return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient7NotSafeForScripting)Control).GetOcx(); + } + } +} diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol8.cs b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol8.cs index cb6ef151d..b4c15437e 100644 --- a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol8.cs +++ b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol8.cs @@ -14,9 +14,9 @@ namespace mRemoteNG.Connection.Protocol.RDP * * Windows 8+ support RDP v8 out of the box. */ - public class RdpProtocol8 : RdpProtocol6 + public class RdpProtocol8 : RdpProtocol7 { - private MsRdpClient8NotSafeForScripting _rdpClient; + private MsRdpClient8NotSafeForScripting _rdpClient => (MsRdpClient8NotSafeForScripting)RdpClient; private Size _controlBeginningSize; public override bool SmartSize @@ -59,8 +59,13 @@ namespace mRemoteNG.Connection.Protocol.RDP return true; } - - public override void ResizeBegin(object sender, EventArgs e) + + protected override MsRdpClient6NotSafeForScripting CreateRdpClientControl() + { + return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient8NotSafeForScripting)Control).GetOcx(); + } + + public override void ResizeBegin(object sender, EventArgs e) { _controlBeginningSize = Control.Size; } @@ -84,12 +89,6 @@ namespace mRemoteNG.Connection.Protocol.RDP _controlBeginningSize = Size.Empty; } - protected override object CreateRdpClientControl() - { - _rdpClient = (MsRdpClient8NotSafeForScripting)((AxMsRdpClient8NotSafeForScripting) Control).GetOcx(); - return _rdpClient; - } - private void ReconnectForResize() { if (!LoginComplete) @@ -118,10 +117,7 @@ namespace mRemoteNG.Connection.Protocol.RDP Control.Size = InterfaceControl.Size; return true; } - else - { - return false; - } + return false; } } } diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpProtocol9.cs b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol9.cs new file mode 100644 index 000000000..65f1c7a61 --- /dev/null +++ b/mRemoteV1/Connection/Protocol/RDP/RdpProtocol9.cs @@ -0,0 +1,18 @@ +using AxMSTSCLib; +using MSTSCLib; + +namespace mRemoteNG.Connection.Protocol.RDP +{ + public class RdpProtocol9 : RdpProtocol8 + { + public RdpProtocol9() + { + Control = new AxMsRdpClient9NotSafeForScripting(); + } + + protected override MsRdpClient6NotSafeForScripting CreateRdpClientControl() + { + return (MsRdpClient6NotSafeForScripting)((AxMsRdpClient9NotSafeForScripting)Control).GetOcx(); + } + } +} diff --git a/mRemoteV1/Connection/Protocol/RDP/RdpProtocolFactory.cs b/mRemoteV1/Connection/Protocol/RDP/RdpProtocolFactory.cs index 87d075ef6..eb8ce69ef 100644 --- a/mRemoteV1/Connection/Protocol/RDP/RdpProtocolFactory.cs +++ b/mRemoteV1/Connection/Protocol/RDP/RdpProtocolFactory.cs @@ -12,10 +12,19 @@ case RdpVersionEnum.Rdc6: newProtocol = new RdpProtocol6(); break; - case RdpVersionEnum.Rdc8: + case RdpVersionEnum.Rdc7: + newProtocol = new RdpProtocol7(); + break; + case RdpVersionEnum.Rdc8: newProtocol = new RdpProtocol8(); break; - } + case RdpVersionEnum.Rdc9: + newProtocol = new RdpProtocol9(); + break; + case RdpVersionEnum.Rdc10: + newProtocol = new RdpProtocol10(); + break; + } if (newProtocol != null) { diff --git a/mRemoteV1/mRemoteV1.csproj b/mRemoteV1/mRemoteV1.csproj index 7ebfe6145..8be1a59b3 100644 --- a/mRemoteV1/mRemoteV1.csproj +++ b/mRemoteV1/mRemoteV1.csproj @@ -247,7 +247,10 @@ + + +