Skip to content

Commit

Permalink
RDP - Do not add the scrolls on our own anymore - clients manage them…
Browse files Browse the repository at this point in the history
… theirself. Added support for choosing RDP client location and added support for FreeRDP 2 as an RDP client.
  • Loading branch information
vityank committed May 10, 2020
1 parent aa9cf84 commit 4129996
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 31 deletions.
3 changes: 3 additions & 0 deletions SuperPutty/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@
<setting name="VNCExe" serializeAs="String">
<value />
</setting>
<setting name="RDPExe" serializeAs="String">
<value />
</setting>
<setting name="TabTextBehavior" serializeAs="String">
<value>Static</value>
</setting>
Expand Down
13 changes: 13 additions & 0 deletions SuperPutty/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions SuperPutty/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<Setting Name="VNCExe" Provider="SuperPutty.Utils.PortableSettingsProvider" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="RDPExe" Provider="SuperPutty.Utils.PortableSettingsProvider" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="TabTextBehavior" Provider="SuperPutty.Utils.PortableSettingsProvider" Type="System.String" Scope="User">
<Value Profile="(Default)">Static</Value>
</Setting>
Expand Down
4 changes: 2 additions & 2 deletions SuperPutty/Utils/PuttyStartInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static String GetExecutable(SessionData session)
return TryParseEnvVars(SuperPuTTY.Settings.VNCExe);

case ConnectionProtocol.RDP:
return Environment.ExpandEnvironmentVariables("%systemroot%\\system32\\mstsc.exe");
return TryParseEnvVars(SuperPuTTY.Settings.RDPExe);

case ConnectionProtocol.WINCMD:
return Environment.ExpandEnvironmentVariables("%systemroot%\\system32\\cmd.exe");
Expand Down Expand Up @@ -63,7 +63,7 @@ public PuttyStartInfo(SessionData session)
}
else if (session.Proto == ConnectionProtocol.RDP)
{
RDPStartInfo rdp = new RDPStartInfo(session);
RDPStartInfo rdp = new RDPStartInfo(session, this.Executable);
this.Args = rdp.Args;
this.WorkingDir = rdp.StartingDir;
}
Expand Down
30 changes: 23 additions & 7 deletions SuperPutty/Utils/RDPStartinfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,34 @@ public class RDPStartInfo

private SessionData session;

public RDPStartInfo(SessionData session)
public RDPStartInfo(SessionData session, String binName)
{
this.session = session;
this.Args = "-v:" + session.Host;
if (binName.EndsWith("\\wfreerdp.exe"))
{
this.Args = "/cert-ignore /size:1920x1080 +window-drag /disp /workarea /network:wan +auto-reconnect /auto-reconnect-max-retries:0 +bitmap-cache /v:" + session.Host;

if (session.Port != 0)
this.Args += ":" + session.Port.ToString() + " ";
if (session.Port != 0)
this.Args += ":" + session.Port.ToString() + " ";

if (session.Username != "")
this.Args += "/u:"+session.Username;

if (!String.IsNullOrEmpty(session.ExtraArgs))
this.Args += session.ExtraArgs + " ";
if (!String.IsNullOrEmpty(session.ExtraArgs))
this.Args += session.ExtraArgs + " ";
}
else
{
this.Args = "-v:" + session.Host;

this.Args += "/span";
if (session.Port != 0)
this.Args += ":" + session.Port.ToString() + " ";

if (!String.IsNullOrEmpty(session.ExtraArgs))
this.Args += session.ExtraArgs + " ";

this.Args += "/span";
}

this.StartingDir = "%userprofile%\\Desktop";
}
Expand Down
4 changes: 2 additions & 2 deletions SuperPutty/ctlApplicationPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private void AttachToWindow()
// set window parameters (how it's displayed)
long lStyle = NativeMethods.GetWindowLong(m_AppWin, NativeMethods.GWL_STYLE);
lStyle &= ~NativeMethods.WS_BORDER;
if (this.proto == SuperPutty.Data.ConnectionProtocol.RDP || this.proto == SuperPutty.Data.ConnectionProtocol.VNC)
if (this.proto == SuperPutty.Data.ConnectionProtocol.VNC)
lStyle |= NativeMethods.WS_HSCROLL | NativeMethods.WS_VSCROLL;
NativeMethods.SetWindowLong(m_AppWin, NativeMethods.GWL_STYLE, lStyle);
NativeMethods.WinEventDelegate lpfnWinEventProc = new NativeMethods.WinEventDelegate(WinEventProc);
Expand Down Expand Up @@ -246,7 +246,7 @@ private bool IsWindowAppliesForInherit(IntPtr hWnd)
StringBuilder winTitleBuf = new StringBuilder(256);
int winTitleLen = NativeMethods.GetWindowText(hWnd, winTitleBuf, winTitleBuf.Capacity - 1);
Log.Info("IsWindowAppliesForInherit: Evaluating window " + winTitleBuf.ToString());
if (winTitleLen > 0 && winTitleBuf.ToString().Contains(" - Remote Desktop Connection"))
if (winTitleLen > 0 && (winTitleBuf.ToString().Contains(" - Remote Desktop Connection") || winTitleBuf.ToString().Contains("FreeRDP: ")))
return true;
return false;
default:
Expand Down
55 changes: 47 additions & 8 deletions SuperPutty/dlgFindPutty.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4129996

Please sign in to comment.