Skip to content

Commit

Permalink
some small tweaks for rdclientax
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKoell committed Apr 15, 2024
1 parent db0d8b3 commit cba50c6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/RoyalApps.Community.Rdp.WinForms/Controls/RdpControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,9 @@ private void CreateRdpClient()

if (RdpConfiguration.UseMsRdc)
{
string? msRdcAxLibrary = null;
var msTscAxLibrary = Environment.ExpandEnvironmentVariables("%SystemRoot%\\System32\\mstscax.dll");

string? msRdcAxLibrary = null;
if (!string.IsNullOrWhiteSpace(RdpConfiguration.MsRdcPath) && File.Exists(RdpConfiguration.MsRdcPath))
msRdcAxLibrary = RdpConfiguration.MsRdcPath;

Expand All @@ -585,13 +586,20 @@ private void CreateRdpClient()
if (string.IsNullOrWhiteSpace(msRdcAxLibrary))
{
Logger.LogWarning("Microsoft Remote Desktop Client cannot be used, rdclientax.dll was not found");

Environment.SetEnvironmentVariable("MSRDPEX_MSTSCAX_DLL", msTscAxLibrary);
Environment.SetEnvironmentVariable("MSRDPEX_AXNAME", "mstsc");

RdpConfiguration.UseMsRdc = false;
RdpClient.AxName = "mstsc";
RdpClient.RdpExDll = null!;
}
else
{
Logger.LogInformation("Microsoft Remote Desktop Client will be used");

Environment.SetEnvironmentVariable("MSRDPEX_RDCLIENTAX_DLL", msRdcAxLibrary);
Environment.SetEnvironmentVariable("MSRDPEX_AXNAME", "msrdc");
Logger.LogInformation("Microsoft Remote Desktop Client will be used");

RdpClient.AxName = "msrdc";
RdpClient.RdpExDll = MsRdpExManager.Instance.CoreApi.MsRdpExDllPath;
Expand Down

0 comments on commit cba50c6

Please sign in to comment.