mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-18 22:59:41 +08:00
Compare commits
125 Commits
v1.74
...
v1.75Alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43100930cd | ||
|
|
aac7e4cc53 | ||
|
|
1c8f3e2328 | ||
|
|
a54f0a2e89 | ||
|
|
fdb3cecf8e | ||
|
|
8762c39dd5 | ||
|
|
fc56c56883 | ||
|
|
ae950ac075 | ||
|
|
e6532dc155 | ||
|
|
ee6af8c187 | ||
|
|
bc1a0725df | ||
|
|
8163e7273e | ||
|
|
58fdba1d89 | ||
|
|
649f864236 | ||
|
|
292f3b03cc | ||
|
|
ec8fe3c343 | ||
|
|
823b0518ae | ||
|
|
c48caf5bdc | ||
|
|
20bc6d079f | ||
|
|
dccd318f60 | ||
|
|
2b0f670fb7 | ||
|
|
b5c431dca8 | ||
|
|
57dd93f136 | ||
|
|
976e02effb | ||
|
|
396387340a | ||
|
|
d9bf021597 | ||
|
|
b4e26f513b | ||
|
|
2eef31f74d | ||
|
|
cc96e2b3eb | ||
|
|
4526a0b875 | ||
|
|
4568bcc0ae | ||
|
|
cf3af14c6a | ||
|
|
d320c84bc8 | ||
|
|
8eff262e8f | ||
|
|
8c7d90f0c4 | ||
|
|
0e189551dd | ||
|
|
981acd6510 | ||
|
|
404aae6bf3 | ||
|
|
57cc9b8de4 | ||
|
|
d2def0a34d | ||
|
|
f1a5e1c029 | ||
|
|
19ae192887 | ||
|
|
cc87227559 | ||
|
|
9ad0c74a56 | ||
|
|
55a8b743c8 | ||
|
|
7adb150d1c | ||
|
|
afdb392289 | ||
|
|
1c8e24a117 | ||
|
|
266e79a2c3 | ||
|
|
6c5d629a88 | ||
|
|
84ed778b67 | ||
|
|
c1d41847a2 | ||
|
|
73c50837d8 | ||
|
|
89075aa3e9 | ||
|
|
bffe4454ba | ||
|
|
69a8f50b58 | ||
|
|
8c6f6534b6 | ||
|
|
791a78154d | ||
|
|
f08ce0acd5 | ||
|
|
757b195d5c | ||
|
|
c6a39a9220 | ||
|
|
a2054b458b | ||
|
|
6ee12d447f | ||
|
|
f95e3fb719 | ||
|
|
aa9141505f | ||
|
|
b4f0d2f2ae | ||
|
|
5bc67ab796 | ||
|
|
4f86e0da62 | ||
|
|
12165ac9a6 | ||
|
|
dd783c2dc0 | ||
|
|
4b65086622 | ||
|
|
de2542c172 | ||
|
|
973de3507e | ||
|
|
1945d5ac6b | ||
|
|
cb3614d54c | ||
|
|
4375f2d5d1 | ||
|
|
92b6cf201e | ||
|
|
b2b53561ba | ||
|
|
73a1923db6 | ||
|
|
76e290f6b7 | ||
|
|
be02814021 | ||
|
|
d60c007ac6 | ||
|
|
e92c1eaa9d | ||
|
|
8d638602b9 | ||
|
|
48161aca47 | ||
|
|
11314972fa | ||
|
|
83ac202a6b | ||
|
|
02c601fd3a | ||
|
|
86f6f85142 | ||
|
|
ca4cb433a9 | ||
|
|
e5bed0afcb | ||
|
|
11cf85f771 | ||
|
|
18d7a9cfe9 | ||
|
|
b3bac32441 | ||
|
|
0b9fb06c08 | ||
|
|
c6219ff315 | ||
|
|
2b7668aa68 | ||
|
|
c8a684e10d | ||
|
|
5a5d675f3e | ||
|
|
a4acc60f1d | ||
|
|
b3bc04251b | ||
|
|
203111eb5a | ||
|
|
472168b9e4 | ||
|
|
328ebbe3f7 | ||
|
|
999cd19d81 | ||
|
|
d23f6a69e5 | ||
|
|
38c7fe9e0a | ||
|
|
dc02f51a15 | ||
|
|
dd7ea02c9f | ||
|
|
5e0bf0da6e | ||
|
|
f2f4b14f5e | ||
|
|
e27b4fa2f9 | ||
|
|
c71a57bd69 | ||
|
|
8c57b271d8 | ||
|
|
e167602a32 | ||
|
|
590f4ba2c6 | ||
|
|
b2c0dc235c | ||
|
|
f357a53e0e | ||
|
|
5f7d1f9f3f | ||
|
|
010c0a5061 | ||
|
|
f160e456ae | ||
|
|
2a3fc01937 | ||
|
|
7671328245 | ||
|
|
85dc45a479 | ||
|
|
eb696b49fe |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -282,3 +282,6 @@ Installer Projects/Installer/Fragments/FilesFragment.wxs
|
||||
Installer Projects/Installer/Fragments/HelpFilesFragment.wxs
|
||||
InstallerProjects/Installer/Fragments/FilesFragment.wxs
|
||||
InstallerProjects/Installer/Resources/License.rtf
|
||||
|
||||
# user preference: .editorconfig - http://editorconfig.org/
|
||||
.editorconfig
|
||||
135
CHANGELOG.TXT
135
CHANGELOG.TXT
@@ -1,3 +1,36 @@
|
||||
1.75 Alpha 2 (2016-08-03):
|
||||
|
||||
General Changes:
|
||||
----------------
|
||||
Updated GeckoFx pacakge
|
||||
Updated DockPanelSuite library to 2.10 Final
|
||||
Japanese translation updated
|
||||
MR-942: Refactored code relating to loading the connections file
|
||||
|
||||
Features/Enhancements:
|
||||
----------------------
|
||||
PR-133: Option to reconnect all currently opened connection tabs
|
||||
MR-917: Improved cryptographic support
|
||||
|
||||
Fixes:
|
||||
------
|
||||
MR-910: Fixes to support Remote Desktop Gateways
|
||||
|
||||
|
||||
|
||||
1.75 Alpha 1 (2016-07-08):
|
||||
|
||||
General Changes:
|
||||
----------------
|
||||
Additional code cleanup
|
||||
|
||||
|
||||
Fixes:
|
||||
------
|
||||
MR-905: mRemoteNG crashes at startup (in FIPS policy check)
|
||||
MR-902: mRemoteNG crashes after locking/unlocking the local system after loading a VNC connection
|
||||
|
||||
|
||||
1.74 (2016-06-28):
|
||||
|
||||
Supported Platforms/Components:
|
||||
@@ -9,57 +42,57 @@
|
||||
|
||||
General Changes:
|
||||
----------------
|
||||
Converted source from Visual Basic to C Sharp
|
||||
Lots of code refactoring/clean up/general stability changes
|
||||
MR-714: Removed Keyboard shortcut functionality
|
||||
- Introduced in 1.73 beta that was never officially released
|
||||
- This caused stability issues
|
||||
- May be re-added in a future release
|
||||
- Removal does *NOT* impact the ability to send keyboard shortcuts to RDP sessions (when redirect key combinations is set to "yes")
|
||||
MR-559: Removed RDP Sessions panel functionality. This required a library for which no trusted origin/source could be located
|
||||
Removed a bunch of old code/libraries and replaced them accordingly
|
||||
|
||||
|
||||
Security Updates:
|
||||
-----------------
|
||||
MR-775, MR-745: Updated PuTTY to 0.67
|
||||
|
||||
|
||||
Features/Enhancements:
|
||||
----------------------
|
||||
Updated to latest DockPanelSuite and enabled a slick new theme!
|
||||
MR-145: Installer is now MSI based
|
||||
MR-255: Updated RDP Client to version 8
|
||||
MR-389: Updates to IE rendering engine
|
||||
- Support for latest version of IE (9-11)
|
||||
- Dropped support for IE 7 & IE 8
|
||||
MR-850: Replaced XULRunner with GeckoFx
|
||||
- No need to manually configure to have the Gecko rendering engine available now
|
||||
- Install image is now significantly larger due to the inclusion of the Gecko Engine
|
||||
MR-821: Initial Japanese translation included
|
||||
Port Scan is now Asynchronous (and is significantly faster)
|
||||
|
||||
|
||||
Fixes:
|
||||
------
|
||||
MR-874: Added work-around to installer to ignore installation prerequisites
|
||||
MR-884: Slow startup in some scnearios checking authenticode certificate
|
||||
MR-872: Crash in External Tools when arguments aren't quoted
|
||||
MR-854: crashes when right clicking on connection tab
|
||||
MR-852: Option "Allow only a single instance of the application" non-functional
|
||||
MR-836: Trying to delete a folder of connections only deletes 2 connections at a time
|
||||
MR-824, MR-706: Suppress Script Errors when using the IE rendering engine
|
||||
MR-822: Improve RDP error code messages
|
||||
MR-640: Fixed Inheritance not working
|
||||
MR-639: RDP: Connect to console session
|
||||
MR-610, MR-582, MR-451: RDP: Protocol Error 3334 or exceptions with large number of connections open
|
||||
- This problem appears largely resolved by most reports and testing
|
||||
- Further workarounds/problem avoidance: Disable Bitmap Caching on all RDP session configuration
|
||||
MR-429: Display issue on the Options -> Advanced panel
|
||||
MR-385: Inheritance settings lost when moving item to the root of the tree
|
||||
|
||||
|
||||
|
||||
Converted source from Visual Basic to C Sharp
|
||||
Lots of code refactoring/clean up/general stability changes
|
||||
MR-714: Removed Keyboard shortcut functionality
|
||||
- Introduced in 1.73 beta that was never officially released
|
||||
- This caused stability issues
|
||||
- May be re-added in a future release
|
||||
- Removal does *NOT* impact the ability to send keyboard shortcuts to RDP sessions (when redirect key combinations is set to "yes")
|
||||
MR-559: Removed RDP Sessions panel functionality. This required a library for which no trusted origin/source could be located
|
||||
Removed a bunch of old code/libraries and replaced them accordingly
|
||||
|
||||
|
||||
Security Updates:
|
||||
-----------------
|
||||
MR-775, MR-745: Updated PuTTY to 0.67
|
||||
|
||||
|
||||
Features/Enhancements:
|
||||
----------------------
|
||||
Updated to latest DockPanelSuite and enabled a slick new theme!
|
||||
MR-145: Installer is now MSI based
|
||||
MR-255: Updated RDP Client to version 8
|
||||
MR-389: Updates to IE rendering engine
|
||||
- Support for latest version of IE (9-11)
|
||||
- Dropped support for IE 7 & IE 8
|
||||
MR-850: Replaced XULRunner with GeckoFx
|
||||
- No need to manually configure to have the Gecko rendering engine available now
|
||||
- Install image is now significantly larger due to the inclusion of the Gecko Engine
|
||||
MR-821: Initial Japanese translation included
|
||||
Port Scan is now Asynchronous (and is significantly faster)
|
||||
|
||||
|
||||
Fixes:
|
||||
------
|
||||
MR-874: Added work-around to installer to ignore installation prerequisites
|
||||
MR-884: Slow startup in some scnearios checking authenticode certificate
|
||||
MR-872: Crash in External Tools when arguments aren't quoted
|
||||
MR-854: crashes when right clicking on connection tab
|
||||
MR-852: Option "Allow only a single instance of the application" non-functional
|
||||
MR-836: Trying to delete a folder of connections only deletes 2 connections at a time
|
||||
MR-824, MR-706: Suppress Script Errors when using the IE rendering engine
|
||||
MR-822: Improve RDP error code messages
|
||||
MR-640: Fixed Inheritance not working
|
||||
MR-639: RDP: Connect to console session
|
||||
MR-610, MR-582, MR-451: RDP: Protocol Error 3334 or exceptions with large number of connections open
|
||||
- This problem appears largely resolved by most reports and testing
|
||||
- Further workarounds/problem avoidance: Disable Bitmap Caching on all RDP session configuration
|
||||
MR-429: Display issue on the Options -> Advanced panel
|
||||
MR-385: Inheritance settings lost when moving item to the root of the tree
|
||||
|
||||
|
||||
|
||||
1.73 Beta 2 (NEVER RELEASED):
|
||||
Fixed issue MR-619 - Keyboard shortcuts stop working after locking the screen with Win+L
|
||||
Added support for importing files from PuTTY Connection Manager.
|
||||
|
||||
@@ -115,7 +115,7 @@ Copyright
|
||||
Creative Commons Attribution 2.5 License
|
||||
http://www.famfamfam.com/
|
||||
|
||||
VncSharp 1.0
|
||||
VncSharp 1.1
|
||||
Copyright <20> 2004-2009 David Humphrey
|
||||
GNU General Public License (GPL) Version 2
|
||||
http://cdot.senecac.on.ca/projects/vncsharp/
|
||||
https://github.com/humphd/VncSharp
|
||||
|
||||
@@ -5,26 +5,10 @@ namespace CustomActions
|
||||
public class CustomActions
|
||||
{
|
||||
[CustomAction]
|
||||
public static ActionResult IsKBInstalled(Session session)
|
||||
public static ActionResult IsMinimumRdpVersionInstalled(Session session)
|
||||
{
|
||||
session.Log("Begin IsKBInstalled");
|
||||
string kb = session["KB"];
|
||||
session.Log("Checking if '{0}' is installed", kb);
|
||||
InstalledWindowsUpdateGatherer updateGatherer = new InstalledWindowsUpdateGatherer();
|
||||
bool isUpdateInstalled = updateGatherer.IsUpdateInstalled(kb);
|
||||
session.Log("KB is installed = '{0}'", isUpdateInstalled);
|
||||
if (isUpdateInstalled)
|
||||
{
|
||||
session[kb] = "1";
|
||||
session.Log("Set property '{0}' to '1'", kb);
|
||||
}
|
||||
else
|
||||
{
|
||||
session[kb] = "0";
|
||||
session.Log("Set property '{0}' to '0'", kb);
|
||||
}
|
||||
|
||||
session.Log("End IsKBInstalled");
|
||||
var rdpVersionChecker = new RdpVersionChecker(session);
|
||||
rdpVersionChecker.Execute();
|
||||
return ActionResult.Success;
|
||||
}
|
||||
|
||||
@@ -32,8 +16,8 @@ namespace CustomActions
|
||||
public static ActionResult IsLegacyVersionInstalled(Session session)
|
||||
{
|
||||
session.Log("Begin IsLegacyVersionInstalled");
|
||||
UninstallNSISVersions uninstaller = new UninstallNSISVersions();
|
||||
if (uninstaller.IsLegacymRemoteNGInstalled())
|
||||
var uninstaller = new UninstallNsisVersions();
|
||||
if (uninstaller.IsLegacymRemoteNgInstalled())
|
||||
{
|
||||
session["LEGACYVERSIONINSTALLED"] = "1";
|
||||
}
|
||||
@@ -50,8 +34,8 @@ namespace CustomActions
|
||||
public static ActionResult UninstallLegacyVersion(Session session)
|
||||
{
|
||||
session.Log("Begin UninstallLegacyVersion");
|
||||
UninstallNSISVersions uninstaller = new UninstallNSISVersions();
|
||||
string uninstallString = uninstaller.GetLegacyUninstallString();
|
||||
var uninstaller = new UninstallNsisVersions();
|
||||
uninstaller.GetLegacyUninstallString();
|
||||
uninstaller.UninstallLegacyVersion(true);
|
||||
session.Log("End UninstallLegacyVersion");
|
||||
return ActionResult.Success;
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
<Compile Include="CustomActions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="InstalledWindowsUpdateGatherer.cs" />
|
||||
<Compile Include="UninstallNSISVersions.cs" />
|
||||
<Compile Include="RdpVersionChecker.cs" />
|
||||
<Compile Include="UninstallNsisVersions.cs" />
|
||||
<Content Include="CustomAction.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -6,13 +6,11 @@ namespace CustomActions
|
||||
{
|
||||
public class InstalledWindowsUpdateGatherer
|
||||
{
|
||||
private ManagementScope _managementScope;
|
||||
private ManagementClass _managementClass;
|
||||
private readonly ManagementScope _managementScope;
|
||||
|
||||
public InstalledWindowsUpdateGatherer()
|
||||
{
|
||||
_managementScope = Connect();
|
||||
_managementClass = new ManagementClass("Win32_QuickFixEngineering");
|
||||
}
|
||||
|
||||
|
||||
@@ -24,28 +22,29 @@ namespace CustomActions
|
||||
}
|
||||
catch (ManagementException e)
|
||||
{
|
||||
Console.WriteLine("Failed to connect", e.Message);
|
||||
Console.WriteLine($"Failed to connect: {e.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList GetInstalledUpdates()
|
||||
{
|
||||
string query = "SELECT * FROM Win32_QuickFixEngineering";
|
||||
ArrayList installedUpdates = new ArrayList();
|
||||
ManagementObjectSearcher searcher = new ManagementObjectSearcher(_managementScope, new ObjectQuery(query));
|
||||
foreach(ManagementObject queryObj in searcher.Get())
|
||||
const string query = "SELECT * FROM Win32_QuickFixEngineering";
|
||||
var installedUpdates = new ArrayList();
|
||||
var searcher = new ManagementObjectSearcher(_managementScope, new ObjectQuery(query));
|
||||
foreach(var o in searcher.Get())
|
||||
{
|
||||
var queryObj = (ManagementObject) o;
|
||||
installedUpdates.Add(queryObj["HotFixID"]);
|
||||
}
|
||||
return installedUpdates;
|
||||
}
|
||||
|
||||
public bool IsUpdateInstalled(string KB)
|
||||
public bool IsUpdateInstalled(string kb)
|
||||
{
|
||||
bool updateIsInstalled = false;
|
||||
string query = string.Format("SELECT HotFixID FROM Win32_QuickFixEngineering WHERE HotFixID='{0}'", KB);
|
||||
ManagementObjectSearcher searcher = new ManagementObjectSearcher(_managementScope, new ObjectQuery(query));
|
||||
var updateIsInstalled = false;
|
||||
var query = $"SELECT HotFixID FROM Win32_QuickFixEngineering WHERE HotFixID='{kb}'";
|
||||
var searcher = new ManagementObjectSearcher(_managementScope, new ObjectQuery(query));
|
||||
if (searcher.Get().Count > 0)
|
||||
updateIsInstalled = true;
|
||||
return updateIsInstalled;
|
||||
|
||||
42
InstallerProjects/CustomActions/RdpVersionChecker.cs
Normal file
42
InstallerProjects/CustomActions/RdpVersionChecker.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Microsoft.Deployment.WindowsInstaller;
|
||||
|
||||
namespace CustomActions
|
||||
{
|
||||
public class RdpVersionChecker
|
||||
{
|
||||
private readonly Session _session;
|
||||
private const string MinimumVersionInstalledReturnVar = "MINIMUM_RDP_VERSION_INSTALLED";
|
||||
private const string MinimumRdpKbVariable = "MINIMUM_RDP_KB";
|
||||
|
||||
public RdpVersionChecker(Session session)
|
||||
{
|
||||
_session = session;
|
||||
}
|
||||
|
||||
public bool Execute()
|
||||
{
|
||||
_session.Log("Begin IsMinimumRdpVersionInstalled");
|
||||
var minimumKb = _session[MinimumRdpKbVariable];
|
||||
var isUpdateInstalled = IsUpdateInstalled(minimumKb);
|
||||
SetReturnValue(isUpdateInstalled);
|
||||
_session.Log("End IsMinimumRdpVersionInstalled");
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsUpdateInstalled(string minimumKb)
|
||||
{
|
||||
_session.Log("Checking if '{0}' is installed", minimumKb);
|
||||
var updateGatherer = new InstalledWindowsUpdateGatherer();
|
||||
var isUpdateInstalled = updateGatherer.IsUpdateInstalled(minimumKb);
|
||||
_session.Log("KB is installed = '{0}'", isUpdateInstalled);
|
||||
return isUpdateInstalled;
|
||||
}
|
||||
|
||||
private void SetReturnValue(bool isUpdateInstalled)
|
||||
{
|
||||
var updateInstalledVal = isUpdateInstalled ? "1" : "0";
|
||||
_session[MinimumVersionInstalledReturnVar] = updateInstalledVal;
|
||||
_session.Log($"Set property '{MinimumVersionInstalledReturnVar}' to '{updateInstalledVal}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace CustomActions
|
||||
{
|
||||
public class UninstallNSISVersions
|
||||
public class UninstallNsisVersions
|
||||
{
|
||||
private const string REGISTRY_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
|
||||
private const string REGISTRY_PATH_Wow6432 = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
|
||||
private const string RegistryPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
|
||||
private const string RegistryPathWow6432 = "Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\mRemoteNG";
|
||||
private RegistryKey _activeRegistryPath;
|
||||
|
||||
|
||||
public UninstallNSISVersions()
|
||||
public UninstallNsisVersions()
|
||||
{
|
||||
GetLegacymRemoteNGRegistryKeyPath();
|
||||
GetLegacymRemoteNgRegistryKeyPath();
|
||||
}
|
||||
|
||||
public void UninstallLegacyVersion(bool Silent = false)
|
||||
public void UninstallLegacyVersion(bool silent = false)
|
||||
{
|
||||
if (!IsLegacymRemoteNGInstalled())
|
||||
if (!IsLegacymRemoteNgInstalled())
|
||||
return;
|
||||
string uninstallString = GetLegacyUninstallString();
|
||||
string forceNonTempUninstaller = string.Format("_?={0}", uninstallString.Replace("Uninstall.exe", "").Replace(@"""", ""));
|
||||
string silentUninstall = "";
|
||||
if (Silent)
|
||||
var uninstallString = GetLegacyUninstallString();
|
||||
var forceNonTempUninstaller = $"_?={uninstallString.Replace("Uninstall.exe", "").Replace(@"""", "")}";
|
||||
var silentUninstall = "";
|
||||
if (silent)
|
||||
{
|
||||
silentUninstall = "/S";
|
||||
}
|
||||
ProcessStartInfo processStartInfo = new ProcessStartInfo(uninstallString);
|
||||
processStartInfo.UseShellExecute = true;
|
||||
processStartInfo.Arguments = string.Format("{0} {1}", forceNonTempUninstaller, silentUninstall);
|
||||
Process uninstallProcess = Process.Start(processStartInfo);
|
||||
while (uninstallProcess.HasExited == false)
|
||||
var processStartInfo = new ProcessStartInfo(uninstallString)
|
||||
{
|
||||
UseShellExecute = true,
|
||||
Arguments = $"{forceNonTempUninstaller} {silentUninstall}"
|
||||
};
|
||||
var uninstallProcess = Process.Start(processStartInfo);
|
||||
while (uninstallProcess != null && uninstallProcess.HasExited == false)
|
||||
{
|
||||
Debug.WriteLine("Waiting for uninstaller to exit");
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsLegacymRemoteNGInstalled()
|
||||
public bool IsLegacymRemoteNgInstalled()
|
||||
{
|
||||
return (_activeRegistryPath != null);
|
||||
}
|
||||
|
||||
public string GetLegacyUninstallString()
|
||||
{
|
||||
if (IsLegacymRemoteNGInstalled())
|
||||
return _activeRegistryPath.GetValue("UninstallString").ToString();
|
||||
return "";
|
||||
return IsLegacymRemoteNgInstalled() ? _activeRegistryPath.GetValue("UninstallString").ToString() : "";
|
||||
}
|
||||
|
||||
private void GetLegacymRemoteNGRegistryKeyPath()
|
||||
private void GetLegacymRemoteNgRegistryKeyPath()
|
||||
{
|
||||
GetUninstallKeyPath();
|
||||
GetUninstallKeyPath6432();
|
||||
@@ -62,20 +60,24 @@ namespace CustomActions
|
||||
{
|
||||
try
|
||||
{
|
||||
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(REGISTRY_PATH);
|
||||
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(RegistryPath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ }
|
||||
}
|
||||
|
||||
private void GetUninstallKeyPath6432()
|
||||
{
|
||||
try
|
||||
{
|
||||
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(REGISTRY_PATH_Wow6432);
|
||||
_activeRegistryPath = Registry.LocalMachine.OpenSubKey(RegistryPathWow6432);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,6 @@
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<?include $(sys.CURRENTDIR)Includes\Config.wxi?>
|
||||
<Fragment>
|
||||
<CustomAction Id="SetRDP80KBValue" Return="check" Execute="immediate" Property="KB" Value="$(var.RDP80KB)" />
|
||||
<CustomAction Id="CheckIfRDP80Installed" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="IsKBInstalled" />
|
||||
</Fragment>
|
||||
<Fragment>
|
||||
<CustomAction Id="SetRDP81KBValue" Return="check" Execute="immediate" Property="KB" Value="$(var.RDP81KB)" />
|
||||
<CustomAction Id="CheckIfRDP81Installed" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="IsKBInstalled" />
|
||||
<CustomAction Id="CheckIfMinimumRdpInstalled" Return="check" Execute="immediate" BinaryKey="CustomActions.CA.dll" DllEntry="IsMinimumRdpVersionInstalled" />
|
||||
</Fragment>
|
||||
</Wix>
|
||||
@@ -16,8 +16,9 @@
|
||||
<?define RequiredDotNetFrameworkMinorVersion = "0" ?>
|
||||
<?define RequiredDotNetFrameworkServicePackLevel = "" ?>
|
||||
<?define RequiredDotNetFrameworkVersion = "$(var.RequiredDotNetFrameworkMajorVersion).$(var.RequiredDotNetFrameworkMinorVersion)" ?>
|
||||
<?define RDP80KB = "KB2592687" ?>
|
||||
<?define RDP81KB = "KB2923545" ?>
|
||||
<?define Rdp80Kb = "KB2592687" ?>
|
||||
<?define Rdp81Kb = "KB2923545" ?>
|
||||
<?define MinimumRdpKb = $(var.Rdp80Kb) ?>
|
||||
<?define IGNOREPREREQUISITES = 0 ?>
|
||||
|
||||
<?if $(var.Platform) = x64 ?>
|
||||
|
||||
@@ -135,9 +135,9 @@ IF EXIST C:\mRemoteNG_code_signing_cert.pfx (
|
||||
)
|
||||
|
||||
REM Rename MSI to include version number
|
||||
powershell "&""$(SolutionDir)Tools\rename_installer_with_version.ps1""" %27$(SolutionDir)%27 %27!(TargetPath)%27
|
||||
powershell -ExecutionPolicy Bypass -File "$(SolutionDir)Tools\rename_installer_with_version.ps1" $(SolutionDir)
|
||||
|
||||
REM Copy MSI to Release folder
|
||||
IF %25buildenv: Portable=%25==Release (powershell "&""$(SolutionDir)Tools\copy_release_installer.ps1""" %27$(TargetDir)%27 %27$(SolutionDir)Release%27)</PostBuildEvent>
|
||||
IF %25buildenv: Portable=%25==Release (powershell -ExecutionPolicy Bypass -File "$(SolutionDir)Tools\copy_release_installer.ps1" $(TargetDir) $(SolutionDir)Release)</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -16,6 +16,8 @@
|
||||
<Property Id="APPLICATIONROOTDIRECTORY">
|
||||
<RegistrySearch Id='mRemoteNGRegistry' Type='raw' Root='HKLM' Key='Software\mRemoteNG' Name='InstallDir' />
|
||||
</Property>
|
||||
<Property Id='MINIMUM_RDP_KB' Value='$(var.MinimumRdpKb)' />
|
||||
<Property Id='MINIMUM_RDP_VERSION_INSTALLED' Value='0' Secure='yes' />
|
||||
<Property Id='REQUIREDDOTNETFRAMEWORKVERSION' Value='$(var.RequiredDotNetFrameworkVersion)' />
|
||||
<Property Id='LEGACYVERSIONINSTALLED' Value='0' />
|
||||
<PropertyRef Id="NETFRAMEWORK40FULL" />
|
||||
@@ -24,8 +26,7 @@
|
||||
|
||||
|
||||
<InstallUISequence>
|
||||
<Custom Action="SetRDP80KBValue" After="AppSearch" />
|
||||
<Custom Action="CheckIfRDP80Installed" After="SetRDP80KBValue">(NOT Installed) AND (VersionNT = 601 OR VersionNT64 = 601)</Custom>
|
||||
<Custom Action="CheckIfMinimumRdpInstalled" After="AppSearch">(NOT Installed) AND (VersionNT = 601 OR VersionNT64 = 601)</Custom>
|
||||
<LaunchConditions After="SetWIX_IS_NETFRAMEWORK_40_OR_LATER_INSTALLED" />
|
||||
<Custom Action="CheckIfLegacyVersionInstalled" After="LaunchConditions" />
|
||||
<Custom Action="UninstallLegacyVersion" After="CheckIfLegacyVersionInstalled">(NOT Installed) AND (LEGACYVERSIONINSTALLED = 1)</Custom>
|
||||
@@ -50,7 +51,7 @@
|
||||
</Condition>
|
||||
<!-- If Win7, require RDP 8.0 update (KB2592687) -->
|
||||
<Condition Message="!(loc.Install_RDP80Requirement)">
|
||||
<![CDATA[Installed OR (IGNOREPREREQUISITES = 1) OR (VersionNT >= 602 OR VersionNT64 >= 602) OR ((VersionNT = 601 OR VersionNT64 = 601) ]]>AND ($(var.RDP80KB) = 1 OR $(var.RDP81KB) = 1))
|
||||
<![CDATA[Installed OR (IGNOREPREREQUISITES = 1) OR (VersionNT >= 602 OR VersionNT64 >= 602) OR ((VersionNT = 601 OR VersionNT64 = 601) AND (MINIMUM_RDP_VERSION_INSTALLED = 1))]]>
|
||||
</Condition>
|
||||
|
||||
|
||||
|
||||
32
Jenkinsfile
vendored
32
Jenkinsfile
vendored
@@ -5,10 +5,11 @@ node('windows') {
|
||||
def vsExtensionsDir = "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow"
|
||||
|
||||
stage 'Checkout Branch'
|
||||
def gitUrl = "https://github.com/mRemoteNG/mRemoteNG.git"
|
||||
def branchName = GetBranchName()
|
||||
echo "BranchName: ${branchName}"
|
||||
git([url: gitUrl, branch: branchName])
|
||||
checkout([
|
||||
$class: 'GitSCM',
|
||||
branches: scm.branches,
|
||||
userRemoteConfigs: scm.userRemoteConfigs
|
||||
])
|
||||
|
||||
stage 'Restore NuGet Packages'
|
||||
def nugetPath = "C:\\nuget.exe"
|
||||
@@ -24,26 +25,3 @@ node('windows') {
|
||||
def nunitTestAdapterPath = "C:\\Users\\Administrator\\AppData\\Local\\Microsoft\\VisualStudio\\14.0\\Extensions"
|
||||
bat "\"${vsToolsDir}\\VsDevCmd.bat\" && VSTest.Console.exe /TestAdapterPath:${nunitTestAdapterPath} \"${jobDir}\\mRemoteNGTests\\bin\\debug\\mRemoteNGTests.dll\""
|
||||
}
|
||||
def GetBranchName() {
|
||||
def jobDir = pwd()
|
||||
echo "JobDir: ${jobDir}"
|
||||
def patternToUse = GetPatternToMatchBranchNameFromDirectory()
|
||||
echo "PatternToUse: ${patternToUse}"
|
||||
java.util.regex.Matcher matcher = jobDir =~ patternToUse
|
||||
echo "Ran the matcher"
|
||||
matcher ? matcher[0][1] : null
|
||||
}
|
||||
def GetPatternToMatchBranchNameFromDirectory() {
|
||||
def patternToUse = ""
|
||||
def folderSeparator = ""
|
||||
def branchNamePattern = "[a-zA-Z0-9\\-_.]*"
|
||||
def jenkinsJobInfoTag = "@*[0-9]*"
|
||||
echo "isUnix: ${isUnix()}"
|
||||
if (isUnix()) {
|
||||
folderSeparator = "/"
|
||||
} else {
|
||||
folderSeparator = "\\\\"
|
||||
}
|
||||
patternToUse = "${folderSeparator}(${branchNamePattern})(${jenkinsJobInfoTag})\$"
|
||||
patternToUse
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,296 +0,0 @@
|
||||
; ---------------------
|
||||
; DotNetVer.nsh
|
||||
; Written by: David Grinberg
|
||||
; Homepage: http://ontheperiphery.veraida.com/
|
||||
; Updated By: Brandon Hansen (http://www.remotehams.com/)
|
||||
; ---------------------
|
||||
;
|
||||
; LogicLib extensions for checking Microsoft .NET Framework versions and service packs.
|
||||
;
|
||||
; Latests Updates by Brandon Hansen, KG6YPI (RemoteHams.com)
|
||||
; Dec 26, 2011 - .NET Framework 4.0 detection fixes - client profile not being found
|
||||
; Dec 07, 2010 - .NET Framework 4.0 detection added by Brandon Hansen (KG6YPI)
|
||||
;
|
||||
; Usage examples:
|
||||
;
|
||||
; ${If} ${HasDotNet4.0}
|
||||
; DetailPrint "Microsoft .NET Framework 4.0 installed."
|
||||
; ${If} ${DOTNETVER_4_0} AtLeastDotNetServicePack 1
|
||||
; DetailPrint "Microsoft .NET Framework 4.0 is at least SP1."
|
||||
; ${Else}
|
||||
; DetailPrint "Microsoft .NET Framework 4.0 SP1 not installed."
|
||||
; ${EndIf}
|
||||
; ${If} ${DOTNETVER_4_0} HasDotNetClientProfile 1
|
||||
; DetailPrint "Microsoft .NET Framework 4.0 (Client Profile) available."
|
||||
; ${EndIf}
|
||||
; ${If} ${DOTNETVER_4_0} HasDotNetFullProfile 1
|
||||
; DetailPrint "Microsoft .NET Framework 4.0 (Full Profile) available."
|
||||
; ${EndIf}
|
||||
; ${If} ${DOTNETVER_4_0} HasDotNetFullProfile 0
|
||||
; DetailPrint "Microsoft .NET Framework 4.0 (Full Profile) not available."
|
||||
; ${EndIf}
|
||||
; ${EndIf}
|
||||
|
||||
|
||||
!verbose push
|
||||
!verbose 3
|
||||
|
||||
!ifndef ___DOTNETVER__NSH___
|
||||
!define ___DOTNETVER__NSH___
|
||||
|
||||
!include LogicLib.nsh
|
||||
!include Util.nsh
|
||||
|
||||
# constants
|
||||
|
||||
!define DOTNETVER_1_0 "1.0"
|
||||
!define DOTNETVER_1_1 "1.1"
|
||||
!define DOTNETVER_2_0 "2.0"
|
||||
!define DOTNETVER_3_0 "3.0"
|
||||
!define DOTNETVER_3_5 "3.5"
|
||||
!define DOTNETVER_4_0 "4.0"
|
||||
|
||||
# variable declaration
|
||||
|
||||
Var /GLOBAL __DONTNET_FOUNDVER
|
||||
|
||||
!macro __DotNetVer_DeclareVars
|
||||
!ifndef __DOTNETVER_VARS_DECLARED
|
||||
!define __DOTNETVER_VARS_DECLARED
|
||||
Var /GLOBAL __DOTNET_1.0
|
||||
Var /GLOBAL __DOTNET_1.1
|
||||
Var /GLOBAL __DOTNET_2.0
|
||||
Var /GLOBAL __DOTNET_3.0
|
||||
Var /GLOBAL __DOTNET_3.5
|
||||
Var /GLOBAL __DOTNET_4.0
|
||||
|
||||
Var /GLOBAL __DOTNETVER_1.0_SP
|
||||
Var /GLOBAL __DOTNETVER_1.1_SP
|
||||
Var /GLOBAL __DOTNETVER_2.0_SP
|
||||
Var /GLOBAL __DOTNETVER_3.0_SP
|
||||
Var /GLOBAL __DOTNETVER_3.5_SP
|
||||
Var /GLOBAL __DOTNETVER_4.0_SP
|
||||
|
||||
Var /GLOBAL __DOTNET_1.0_CLIENT
|
||||
Var /GLOBAL __DOTNET_1.1_CLIENT
|
||||
Var /GLOBAL __DOTNET_2.0_CLIENT
|
||||
Var /GLOBAL __DOTNET_3.0_CLIENT
|
||||
Var /GLOBAL __DOTNET_3.5_CLIENT
|
||||
Var /GLOBAL __DOTNET_4.0_CLIENT
|
||||
|
||||
Var /GLOBAL __DOTNET_1.0_FULL
|
||||
Var /GLOBAL __DOTNET_1.1_FULL
|
||||
Var /GLOBAL __DOTNET_2.0_FULL
|
||||
Var /GLOBAL __DOTNET_3.0_FULL
|
||||
Var /GLOBAL __DOTNET_3.5_FULL
|
||||
Var /GLOBAL __DOTNET_4.0_FULL
|
||||
|
||||
StrCpy $__DOTNET_1.0 0
|
||||
StrCpy $__DOTNET_1.1 0
|
||||
StrCpy $__DOTNET_2.0 0
|
||||
StrCpy $__DOTNET_3.0 0
|
||||
StrCpy $__DOTNET_3.5 0
|
||||
StrCpy $__DOTNET_4.0 0
|
||||
|
||||
StrCpy $__DOTNETVER_1.0_SP 0
|
||||
StrCpy $__DOTNETVER_1.1_SP 0
|
||||
StrCpy $__DOTNETVER_2.0_SP 0
|
||||
StrCpy $__DOTNETVER_3.0_SP 0
|
||||
StrCpy $__DOTNETVER_3.5_SP 0
|
||||
StrCpy $__DOTNETVER_4.0_SP 0
|
||||
|
||||
StrCpy $__DOTNET_1.0_CLIENT 0
|
||||
StrCpy $__DOTNET_1.1_CLIENT 0
|
||||
StrCpy $__DOTNET_2.0_CLIENT 0
|
||||
StrCpy $__DOTNET_3.0_CLIENT 0
|
||||
StrCpy $__DOTNET_3.5_CLIENT 0
|
||||
StrCpy $__DOTNET_4.0_CLIENT 0
|
||||
|
||||
StrCpy $__DOTNET_1.0_FULL 0
|
||||
StrCpy $__DOTNET_1.1_FULL 0
|
||||
StrCpy $__DOTNET_2.0_FULL 0
|
||||
StrCpy $__DOTNET_3.0_FULL 0
|
||||
StrCpy $__DOTNET_3.5_FULL 0
|
||||
StrCpy $__DOTNET_4.0_FULL 0
|
||||
|
||||
!endif
|
||||
!macroend
|
||||
|
||||
|
||||
# lazy initialization macro
|
||||
|
||||
!macro __DotNetVer_InitVars
|
||||
# only calculate version once
|
||||
StrCmp $__DONTNET_FOUNDVER "" dotnetver.noveryet
|
||||
Return
|
||||
|
||||
dotnetver.noveryet:
|
||||
!insertmacro __DotNetVer_DeclareVars
|
||||
|
||||
Push $0 ;registry count
|
||||
Push $1 ;registry key
|
||||
Push $2 ;version number
|
||||
Push $3 ;installed
|
||||
Push $4 ;service pack number
|
||||
Push $8 ;strLen helper var
|
||||
|
||||
StrCpy $0 0
|
||||
|
||||
dotnetver.startenum:
|
||||
|
||||
EnumRegKey $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP" $0
|
||||
StrCmp $1 "" dotnetver.done
|
||||
|
||||
IntOp $0 $0 + 1
|
||||
|
||||
StrCpy $2 $1 1 0
|
||||
StrCmp $2 "v" +1 dotnetver.startenum
|
||||
StrCpy $2 $1 3 1
|
||||
|
||||
; Check for .NET 1.0 to 3.5
|
||||
ReadRegDWORD $3 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\$1" "Install"
|
||||
ReadRegDWORD $4 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\$1" "SP"
|
||||
IntCmp $3 1 dotnetcheck.skipalt
|
||||
; Alternate check for versions that don't set the Install key
|
||||
ReadRegDWORD $3 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\$1\Setup" "InstallSuccess"
|
||||
dotnetcheck.skipalt:
|
||||
; This is a sanity check that works on .NET 1.0 to 3.5
|
||||
; if it fails check for dotnet 4
|
||||
IntCmp $3 0 dotnetcheck.40
|
||||
StrCmp $2 ${DOTNETVER_1_0} dotnetver.10
|
||||
StrCmp $2 ${DOTNETVER_1_1} dotnetver.11
|
||||
StrCmp $2 ${DOTNETVER_2_0} dotnetver.20
|
||||
StrCmp $2 ${DOTNETVER_3_0} dotnetver.30
|
||||
StrCmp $2 ${DOTNETVER_3_5} dotnetver.35
|
||||
dotnetcheck.40:
|
||||
StrCmp $2 ${DOTNETVER_4_0} dotnetver.40
|
||||
StrCmp $2 "4" dotnetver.40
|
||||
|
||||
Goto dotnetver.startenum
|
||||
|
||||
dotnetver.10:
|
||||
StrCpy $__DOTNET_1.0 1
|
||||
StrCpy $__DOTNETVER_1.0_SP $4
|
||||
StrCpy $__DOTNET_1.0_FULL 1
|
||||
Goto dotnetver.startenum
|
||||
dotnetver.11:
|
||||
StrCpy $__DOTNET_1.1 1
|
||||
StrCpy $__DOTNETVER_1.1_SP $4
|
||||
StrCpy $__DOTNET_1.1_FULL 1
|
||||
Goto dotnetver.startenum
|
||||
dotnetver.20:
|
||||
StrCpy $__DOTNET_2.0 1
|
||||
StrCpy $__DOTNETVER_2.0_SP $4
|
||||
StrCpy $__DOTNET_2.0_FULL 1
|
||||
Goto dotnetver.startenum
|
||||
dotnetver.30:
|
||||
StrCpy $__DOTNET_3.0 1
|
||||
StrCpy $__DOTNETVER_3.0_SP $4
|
||||
StrCpy $__DOTNET_3.0_FULL 1
|
||||
Goto dotnetver.startenum
|
||||
dotnetver.35:
|
||||
StrCpy $__DOTNET_3.5 1
|
||||
StrCpy $__DOTNETVER_3.5_SP $4
|
||||
StrCpy $__DOTNET_3.5_FULL 1
|
||||
Goto dotnetver.startenum
|
||||
dotnetver.40:
|
||||
; Check for .NET 4.0 (Full Profile)
|
||||
ReadRegDWORD $3 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Install"
|
||||
ReadRegDWORD $4 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "SP"
|
||||
StrLen $8 $3
|
||||
IntCmp $8 0 dotnetcheck.40c
|
||||
IntCmp $3 0 dotnetcheck.40c
|
||||
StrCmp $2 ${DOTNETVER_4_0} dotnetver.40_Full
|
||||
StrCmp $2 "4" dotnetver.40_Full
|
||||
dotnetcheck.40c:
|
||||
; Check for .NET 4.0 (Client Profile)
|
||||
ReadRegDWORD $3 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" "Install"
|
||||
ReadRegDWORD $4 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Client" "SP"
|
||||
StrLen $8 $3
|
||||
IntCmp $8 0 dotnetver.startenum
|
||||
IntCmp $3 0 dotnetver.startenum
|
||||
StrCmp $2 ${DOTNETVER_4_0} dotnetver.40_Client
|
||||
StrCmp $2 "4" dotnetver.40_Client
|
||||
Goto dotnetver.startenum
|
||||
dotnetver.40_Full:
|
||||
StrCpy $__DOTNET_4.0 1
|
||||
StrCpy $__DOTNETVER_4.0_SP $4
|
||||
StrCpy $__DOTNET_4.0_FULL 1
|
||||
Goto dotnetcheck.40c ; continue looking for other profiles
|
||||
dotnetver.40_Client:
|
||||
StrCpy $__DOTNET_4.0 1
|
||||
StrCpy $__DOTNETVER_4.0_SP $4
|
||||
StrCpy $__DOTNET_4.0_CLIENT 1
|
||||
Goto dotnetver.startenum
|
||||
|
||||
dotnetver.done:
|
||||
|
||||
StrCpy $__DONTNET_FOUNDVER "1"
|
||||
|
||||
Pop $8
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
!macroend
|
||||
|
||||
!macro _HasDotNet _a _b _t _f
|
||||
${CallArtificialFunction} __DotNetVer_InitVars
|
||||
|
||||
!insertmacro _= `$__DOTNET_${_b}` `1` `${_t}` `${_f}`
|
||||
!macroend
|
||||
|
||||
!macro __DotNetVer_DefineTest Ver
|
||||
!define HasDotNet${Ver} `"" HasDotNet ${Ver}`
|
||||
!macroend
|
||||
|
||||
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_1_0}
|
||||
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_1_1}
|
||||
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_2_0}
|
||||
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_3_0}
|
||||
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_3_5}
|
||||
!insertmacro __DotNetVer_DefineTest ${DOTNETVER_4_0}
|
||||
|
||||
!macro _AtLeastDotNetServicePack _a _b _t _f
|
||||
${CallArtificialFunction} __DotNetVer_InitVars
|
||||
|
||||
!insertmacro _>= `$__DOTNETVER_${_a}_SP` `${_b}` `${_t}` `${_f}`
|
||||
!macroend
|
||||
!define AtLeastDotNetServicePack `AtLeastDotNetServicePack`
|
||||
|
||||
|
||||
!macro _AtMostDotNetServicePack _a _b _t _f
|
||||
${CallArtificialFunction} __DotNetVer_InitVars
|
||||
|
||||
!insertmacro _<= `$__DOTNETVER_${_a}_SP` `${_b}` `${_t}` `${_f}`
|
||||
!macroend
|
||||
!define AtMostDotNetServicePack `AtMostDotNetServicePack`
|
||||
|
||||
|
||||
!macro _IsDotNetServicePack _a _b _t _f
|
||||
${CallArtificialFunction} __DotNetVer_InitVars
|
||||
|
||||
!insertmacro _= `$__DOTNETVER_${_a}_SP` `${_b}` `${_t}` `${_f}`
|
||||
!macroend
|
||||
!define IsDotNetServicePack `IsDotNetServicePack`
|
||||
|
||||
!macro _HasDotNetClientProfile _a _b _t _f
|
||||
${CallArtificialFunction} __DotNetVer_InitVars
|
||||
|
||||
!insertmacro _= `$__DOTNET_${_a}_CLIENT` `${_b}` `${_t}` `${_f}`
|
||||
!macroend
|
||||
!define HasDotNetClientProfile `HasDotNetClientProfile`
|
||||
|
||||
!macro _HasDotNetFullProfile _a _b _t _f
|
||||
${CallArtificialFunction} __DotNetVer_InitVars
|
||||
|
||||
!insertmacro _= `$__DOTNET_${_a}_FULL` `${_b}` `${_t}` `${_f}`
|
||||
!macroend
|
||||
!define HasDotNetFullProfile `HasDotNetFullProfile`
|
||||
|
||||
# done
|
||||
|
||||
!endif # !___DOTNETVER__NSH___
|
||||
|
||||
!verbose pop
|
||||
@@ -1,22 +0,0 @@
|
||||
; Czech installer translation
|
||||
|
||||
; Start mRemoteNG after installation
|
||||
LangString LaunchMremoteNow ${LANG_CZECH} "mRemoteNG run CZECH message"
|
||||
|
||||
; Installer Language
|
||||
LangString InstallerLanguage ${LANG_CZECH} "Installer Language"
|
||||
|
||||
; Select installer Language
|
||||
LangString SelectInstallerLanguage ${LANG_CZECH} "Please select the language of the installer"
|
||||
|
||||
; Requires .NET Framework
|
||||
LangString RequiresNetFramework ${LANG_CZECH} "mRemoteNG requires Microsoft .NET Framework 3.0."
|
||||
|
||||
; User needs to be Admin
|
||||
LangString RequiresAdminUser ${LANG_CZECH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
|
||||
|
||||
; Start Menu items
|
||||
LangString CreditsLinkName ${LANG_CZECH} "Credits"
|
||||
LangString CopyingLinkName ${LANG_CZECH} "License"
|
||||
LangString UninstallLinkName ${LANG_CZECH} "Uninstall"
|
||||
LangString ChangeLogLinkName ${LANG_CZECH} "Version History"
|
||||
@@ -1,22 +0,0 @@
|
||||
; Dutch installer translation
|
||||
|
||||
; Start mRemoteNG after installation
|
||||
LangString LaunchMremoteNow ${LANG_DUTCH} "mRemoteNG run DUTCH message"
|
||||
|
||||
; Installer Language
|
||||
LangString InstallerLanguage ${LANG_DUTCH} "Installer Language"
|
||||
|
||||
; Select installer Language
|
||||
LangString SelectInstallerLanguage ${LANG_DUTCH} "Please select the language of the installer"
|
||||
|
||||
; Requires .NET Framework
|
||||
LangString RequiresNetFramework ${LANG_DUTCH} "mRemoteNG requires Microsoft .NET Framework 3.0."
|
||||
|
||||
; User needs to be Admin
|
||||
LangString RequiresAdminUser ${LANG_DUTCH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
|
||||
|
||||
; Start Menu items
|
||||
LangString CreditsLinkName ${LANG_DUTCH} "Credits"
|
||||
LangString CopyingLinkName ${LANG_DUTCH} "License"
|
||||
LangString UninstallLinkName ${LANG_DUTCH} "Uninstall"
|
||||
LangString ChangeLogLinkName ${LANG_DUTCH} "Version History"
|
||||
@@ -1,22 +0,0 @@
|
||||
; English installer translation
|
||||
|
||||
; Start mRemoteNG after installation
|
||||
LangString LaunchMremoteNow ${LANG_ENGLISH} "Launch mRemoteNG Now"
|
||||
|
||||
; Installer Language
|
||||
LangString InstallerLanguage ${LANG_ENGLISH} "Installer Language"
|
||||
|
||||
; Select installer Language
|
||||
LangString SelectInstallerLanguage ${LANG_ENGLISH} "Please select the language of the installer"
|
||||
|
||||
; Requires .NET Framework
|
||||
LangString RequiresNetFramework ${LANG_ENGLISH} "mRemoteNG requires Microsoft .NET Framework 3.0."
|
||||
|
||||
; User needs to be Admin
|
||||
LangString RequiresAdminUser ${LANG_ENGLISH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
|
||||
|
||||
; Start Menu items
|
||||
LangString CreditsLinkName ${LANG_ENGLISH} "Credits"
|
||||
LangString CopyingLinkName ${LANG_ENGLISH} "License"
|
||||
LangString UninstallLinkName ${LANG_ENGLISH} "Uninstall"
|
||||
LangString ChangeLogLinkName ${LANG_ENGLISH} "Version History"
|
||||
@@ -1,22 +0,0 @@
|
||||
; French installer translation
|
||||
|
||||
; Start mRemoteNG after installation
|
||||
LangString LaunchMremoteNow ${LANG_FRENCH} "mRemoteNG run FRENCH message"
|
||||
|
||||
; Installer Language
|
||||
LangString InstallerLanguage ${LANG_FRENCH} "Installer Language"
|
||||
|
||||
; Select installer Language
|
||||
LangString SelectInstallerLanguage ${LANG_FRENCH} "Please select the language of the installer"
|
||||
|
||||
; Requires .NET Framework
|
||||
LangString RequiresNetFramework ${LANG_FRENCH} "mRemoteNG requires Microsoft .NET Framework 3.0."
|
||||
|
||||
; User needs to be Admin
|
||||
LangString RequiresAdminUser ${LANG_FRENCH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
|
||||
|
||||
; Start Menu items
|
||||
LangString CreditsLinkName ${LANG_FRENCH} "Credits"
|
||||
LangString CopyingLinkName ${LANG_FRENCH} "License"
|
||||
LangString UninstallLinkName ${LANG_FRENCH} "Uninstall"
|
||||
LangString ChangeLogLinkName ${LANG_FRENCH} "Version History"
|
||||
@@ -1,22 +0,0 @@
|
||||
; German installer translation
|
||||
|
||||
; Start mRemoteNG after installation
|
||||
LangString LaunchMremoteNow ${LANG_GERMAN} "mRemoteNG jetzt Starten"
|
||||
|
||||
; Installer Language
|
||||
LangString InstallerLanguage ${LANG_GERMAN} "Installationsprogamm Sprache"
|
||||
|
||||
; Select installer Language
|
||||
LangString SelectInstallerLanguage ${LANG_GERMAN} "Bitte w<>hlen Sie die Sprache f<>r das Installationsprogramm"
|
||||
|
||||
; Requires .NET Framework
|
||||
LangString RequiresNetFramework ${LANG_GERMAN} "mRemoteNG ben<65>tigt das Microsoft .NET Framework 3.0."
|
||||
|
||||
; User needs to be Admin
|
||||
LangString RequiresAdminUser ${LANG_GERMAN} "Sie m<>ssen Mitglied der Grupper 'Power Users' or 'Administratoren' sein, damit Sie mRemoteNG installieren k<>nnen."
|
||||
|
||||
; Start Menu items
|
||||
LangString CreditsLinkName ${LANG_GERMAN} "Credits"
|
||||
LangString CopyingLinkName ${LANG_GERMAN} "License"
|
||||
LangString UninstallLinkName ${LANG_GERMAN} "Uninstall"
|
||||
LangString ChangeLogLinkName ${LANG_GERMAN} "Version History"
|
||||
@@ -1,31 +0,0 @@
|
||||
!define LanguageNameEnglish "English"
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
!include "Language\english.nsi"
|
||||
|
||||
!define LanguageNameCzech "Čeština"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!include "Language\czech.nsi"
|
||||
|
||||
!define LanguageNameGerman "Deutsch"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!include "Language\german.nsi"
|
||||
|
||||
!define LanguageNameSpanish "Español"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!include "Language\spanish.nsi"
|
||||
|
||||
!define LanguageNameFrench "Français"
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!include "Language\french.nsi"
|
||||
|
||||
!define LanguageNameDutch "Nederlands"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!include "Language\dutch.nsi"
|
||||
|
||||
!define LanguageNamePolish "Polski"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
!include "Language\polish.nsi"
|
||||
|
||||
!define LanguageNameThai "ภาษาไทย"
|
||||
!insertmacro MUI_LANGUAGE "Thai"
|
||||
!include "Language\thai.nsi"
|
||||
@@ -1,22 +0,0 @@
|
||||
; Polish installer translation
|
||||
|
||||
; Start mRemoteNG after installation
|
||||
LangString LaunchMremoteNow ${LANG_POLISH} "mRemoteNG run POLISH message"
|
||||
|
||||
; Installer Language
|
||||
LangString InstallerLanguage ${LANG_POLISH} "Installer Language"
|
||||
|
||||
; Select installer Language
|
||||
LangString SelectInstallerLanguage ${LANG_POLISH} "Please select the language of the installer"
|
||||
|
||||
; Requires .NET Framework
|
||||
LangString RequiresNetFramework ${LANG_POLISH} "mRemoteNG requires Microsoft .NET Framework 3.0."
|
||||
|
||||
; User needs to be Admin
|
||||
LangString RequiresAdminUser ${LANG_POLISH} "You must be a member of the 'Power Users' or 'Administrators' group to install mRemoteNG."
|
||||
|
||||
; Start Menu items
|
||||
LangString CreditsLinkName ${LANG_POLISH} "Credits"
|
||||
LangString CopyingLinkName ${LANG_POLISH} "License"
|
||||
LangString UninstallLinkName ${LANG_POLISH} "Uninstall"
|
||||
LangString ChangeLogLinkName ${LANG_POLISH} "Version History"
|
||||
@@ -1,22 +0,0 @@
|
||||
; Spanish installer translation
|
||||
|
||||
; Start mRemoteNG after installation
|
||||
LangString LaunchMremoteNow ${LANG_SPANISH} "Iniciando de mRemoteNG"
|
||||
|
||||
; Installer Language
|
||||
LangString InstallerLanguage ${LANG_SPANISH} "Lenguaje de Instalación"
|
||||
|
||||
; Select installer Language
|
||||
LangString SelectInstallerLanguage ${LANG_SPANISH} "Seleccione el lenguaje de instalación"
|
||||
|
||||
; Requires .NET Framework
|
||||
LangString RequiresNetFramework ${LANG_SPANISH} "mRemoteNG requiere Microsoft .NET Framework 3.0."
|
||||
|
||||
; User needs to be Admin
|
||||
LangString RequiresAdminUser ${LANG_SPANISH} "Debe ser miembro del grupo 'Administradores' para poder instalar mRemoteNG."
|
||||
|
||||
; Start Menu items
|
||||
LangString CreditsLinkName ${LANG_SPANISH} "Créditos"
|
||||
LangString CopyingLinkName ${LANG_SPANISH} "Licencia"
|
||||
LangString UninstallLinkName ${LANG_SPANISH} "Desinstalar"
|
||||
LangString ChangeLogLinkName ${LANG_SPANISH} "Historial de Versiones"
|
||||
@@ -1,23 +0,0 @@
|
||||
; Thai installer translation
|
||||
; Contributed by Apisitt Rattana
|
||||
|
||||
; Start mRemoteNG after installation
|
||||
LangString LaunchMremoteNow ${LANG_THAI} "ขณะนี้กำลังติดตั้ง mRemoteNG"
|
||||
|
||||
; Installer Language
|
||||
LangString InstallerLanguage ${LANG_THAI} "ภาษาสำหรับการติดตั้ง"
|
||||
|
||||
; Select installer Language
|
||||
LangString SelectInstallerLanguage ${LANG_THAI} "กรุณาเลือกภาษาสำหรับการติดตั้ง"
|
||||
|
||||
; Requires .NET Framework
|
||||
LangString RequiresNetFramework ${LANG_THAI} "mRemoteNG มีความต้องการ Microsoft .NET Framework 3.0. เป็นพื้นฐาน"
|
||||
|
||||
; User needs to be Admin
|
||||
LangString RequiresAdminUser ${LANG_THAI} "คุณต้องเป็นสมาชิกในกลุ่มของ 'Power Users' หรือ 'Administrators' เพื่อการติดตั้ง mRemoteNG"
|
||||
|
||||
; Start Menu items
|
||||
LangString CreditsLinkName ${LANG_THAI} "Credits"
|
||||
LangString CopyingLinkName ${LANG_THAI} "License"
|
||||
LangString UninstallLinkName ${LANG_THAI} "Uninstall"
|
||||
LangString ChangeLogLinkName ${LANG_THAI} "Version History"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 79 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 83 KiB |
@@ -1,197 +0,0 @@
|
||||
!include "MUI.nsh"
|
||||
!include "WordFunc.nsh"
|
||||
!insertmacro VersionCompare
|
||||
|
||||
!include "DotNetVer.nsh"
|
||||
!include "..\Release\Version.nsh"
|
||||
|
||||
; This will be passed in using the /D switch by BUILD.CMD
|
||||
!ifdef PRODUCT_VERSION_TAG
|
||||
!define PRODUCT_VERSION_FRIENDLY "${PRODUCT_VERSION_SHORT}"
|
||||
!define PRODUCT_VERSION_TAGGED "${PRODUCT_VERSION_SHORT}-${PRODUCT_VERSION_TAG}"
|
||||
!else
|
||||
!define PRODUCT_VERSION_FRIENDLY "${PRODUCT_VERSION_SHORT}"
|
||||
!define PRODUCT_VERSION_TAGGED "${PRODUCT_VERSION_SHORT}"
|
||||
!endif
|
||||
|
||||
; Basic Config
|
||||
Name "mRemoteNG ${PRODUCT_VERSION_FRIENDLY}"
|
||||
OutFile "..\Release\mRemoteNG-Installer-${PRODUCT_VERSION_TAGGED}.exe"
|
||||
SetCompressor /SOLID lzma
|
||||
InstallDir "$PROGRAMFILES\mRemoteNG"
|
||||
InstallDirRegKey HKLM "Software\mRemoteNG" "InstallPath"
|
||||
RequestExecutionLevel admin
|
||||
|
||||
; Version Information
|
||||
VIProductVersion ${PRODUCT_VERSION}
|
||||
VIAddVersionKey "CompanyName" "Next Generation Software"
|
||||
VIAddVersionKey "ProductName" "mRemoteNG"
|
||||
VIAddVersionKey "ProductVersion" ${PRODUCT_VERSION}
|
||||
VIAddVersionKey "LegalCopyright" "Copyright © 2007-2009 Felix Deimel, 2010-2013 Riley McArdle"
|
||||
VIAddVersionKey "FileDescription" "mRemoteNG ${PRODUCT_VERSION_FRIENDLY} Installer"
|
||||
VIAddVersionKey "FileVersion" ${PRODUCT_VERSION}
|
||||
|
||||
; Design
|
||||
!define MUI_ICON "Setup_Install.ico"
|
||||
!define MUI_UNICON "RecycleBin.ico"
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_BITMAP "header.bmp" ; optional
|
||||
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
|
||||
!define MUI_HEADERIMAGE_UNBITMAP "header.bmp" ; optional
|
||||
!define MUI_HEADERIMAGE_UNBITMAP_NOSTRETCH
|
||||
!define MUI_HEADER_TRANSPARENT_TEXT
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP_NOSTRETCH
|
||||
|
||||
; Install Pages
|
||||
!insertmacro MUI_PAGE_LICENSE "..\COPYING.TXT"
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
||||
|
||||
; Finish Page
|
||||
!define MUI_FINISHPAGE_RUN_NOTCHECKED
|
||||
!define MUI_FINISHPAGE_RUN "$INSTDIR\mRemoteNG.exe"
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
; Uninstall Pages
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
; Get Languages
|
||||
!include "Language\languages.nsi"
|
||||
|
||||
; Set finish page text
|
||||
!define MUI_FINISHPAGE_RUN_Text "$(LaunchMremoteNow)"
|
||||
|
||||
Function .onInit
|
||||
ClearErrors
|
||||
UserInfo::GetName
|
||||
IfErrors Win9x
|
||||
Pop $0
|
||||
UserInfo::GetAccountType
|
||||
Pop $1
|
||||
# GetOriginalAccountType will check the tokens of the original user of the
|
||||
# current thread/process. If the user tokens were elevated or limited for
|
||||
# this process, GetOriginalAccountType will return the non-restricted
|
||||
# account type.
|
||||
# On Vista with UAC, for example, this is not the same value when running
|
||||
# with `RequestExecutionLevel user`. GetOriginalAccountType will return
|
||||
# "admin" while GetAccountType will return "user".
|
||||
StrCmp $1 "Admin" 0 +3
|
||||
Goto doit
|
||||
StrCmp $1 "Power" 0 +3
|
||||
Goto doit
|
||||
StrCmp $1 "User" 0 +3
|
||||
Goto noop
|
||||
StrCmp $1 "Guest" 0 +3
|
||||
Goto noop
|
||||
MessageBox MB_OK "Unknown error"
|
||||
Goto doit
|
||||
|
||||
Win9x:
|
||||
doit:
|
||||
# We can install
|
||||
IfSilent +2
|
||||
Call SelectLanguage
|
||||
Goto end
|
||||
noop:
|
||||
MessageBox MB_OK "$(RequiresAdminUser)"
|
||||
Quit
|
||||
end:
|
||||
FunctionEnd
|
||||
|
||||
Function SelectLanguage
|
||||
;Language selection dialog
|
||||
Push ""
|
||||
Push ${LANG_ENGLISH}
|
||||
Push ${LanguageNameEnglish}
|
||||
Push ${LANG_GERMAN}
|
||||
Push ${LanguageNameGerman}
|
||||
Push ${LANG_DUTCH}
|
||||
Push ${LanguageNameDutch}
|
||||
Push ${LANG_FRENCH}
|
||||
Push ${LanguageNameFrench}
|
||||
Push ${LANG_POLISH}
|
||||
Push ${LanguageNamePolish}
|
||||
Push ${LANG_SPANISH}
|
||||
Push ${LanguageNameSpanish}
|
||||
Push ${LANG_CZECH}
|
||||
Push ${LanguageNameCzech}
|
||||
Push ${LANG_THAI}
|
||||
Push ${LanguageNameThai}
|
||||
Push A ; A means auto count languages
|
||||
; for the auto count to work the first empty push (Push "") must remain
|
||||
LangDLL::LangDialog "$(InstallerLanguage)" "$(SelectInstallerLanguage)"
|
||||
|
||||
Pop $LANGUAGE
|
||||
StrCmp $LANGUAGE "cancel" 0 +2
|
||||
Abort
|
||||
|
||||
; Check .NET version
|
||||
${IfNot} ${HasDotNet3.0}
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "$(RequiresNetFramework)"
|
||||
Quit
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Section "" ; Install
|
||||
SetOutPath $INSTDIR
|
||||
SetShellVarContext all
|
||||
|
||||
; AddFiles
|
||||
File /r /x "mRemoteNG.vshost.*" "..\mRemoteV1\bin\Release\*.*"
|
||||
File /r "Dependencies\*.*"
|
||||
File "..\*.txt"
|
||||
|
||||
; Uninstaller
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
; Register ActiveX components
|
||||
RegDLL "$INSTDIR\eolwtscom.dll"
|
||||
|
||||
; Start Menu
|
||||
CreateDirectory "$SMPROGRAMS\mRemoteNG"
|
||||
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(CreditsLinkName).lnk" "$INSTDIR\CREDITS.TXT"
|
||||
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(CopyingLinkName).lnk" "$INSTDIR\COPYING.TXT"
|
||||
CreateShortCut "$SMPROGRAMS\mRemoteNG\mRemoteNG.lnk" "$INSTDIR\mRemoteNG.exe"
|
||||
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(UninstallLinkName).lnk" "$INSTDIR\Uninstall.exe"
|
||||
CreateShortCut "$SMPROGRAMS\mRemoteNG\$(ChangeLogLinkName).lnk" "$INSTDIR\CHANGELOG.TXT"
|
||||
|
||||
; Registry
|
||||
WriteRegStr HKLM "Software\mRemoteNG" "InstallPath" $INSTDIR
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayName" "mRemoteNG"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "Publisher" "Next Generation Software"
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayIcon" "$INSTDIR\mRemoteNG.exe"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "EstimatedSize" 7080
|
||||
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "DisplayVersion" ${PRODUCT_VERSION}
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "VersionMajor" ${PRODUCT_VERSION_MAJOR}
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "VersionMinor" ${PRODUCT_VERSION_MINOR}
|
||||
|
||||
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "UninstallString" '"$INSTDIR\Uninstall.exe"'
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "NoModify" 1
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG" "NoRepair" 1
|
||||
SectionEnd
|
||||
|
||||
Section "un.Uninstall"
|
||||
; Unregister ActiveX components
|
||||
UnregDLL "$INSTDIR\eolwtscom.dll"
|
||||
|
||||
; Delete Files
|
||||
RMDIR /r $INSTDIR
|
||||
|
||||
; Start Menu
|
||||
SetShellVarContext all
|
||||
RMDir /r "$SMPROGRAMS\mRemoteNG"
|
||||
SetShellVarContext current
|
||||
RMDir /r "$SMPROGRAMS\mRemoteNG"
|
||||
|
||||
; Registry
|
||||
DeleteRegValue HKLM "Software\mRemoteNG" "InstallPath"
|
||||
DeleteRegKey /ifempty HKLM "Software\mRemoteNG"
|
||||
DeleteRegKey /ifempty HKCU "Software\mRemoteNG"
|
||||
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mRemoteNG"
|
||||
SectionEnd
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 151 KiB |
34
README.MD
Normal file
34
README.MD
Normal file
@@ -0,0 +1,34 @@
|
||||
[](https://twitter.com/intent/follow?screen_name=mRemoteNG)
|
||||
|
||||
|
||||
[](https://gitter.im/mRemoteNG/PublicChat)
|
||||
|
||||
[](http://ec2-52-39-111-114.us-west-2.compute.amazonaws.com:8080/job/mRemoteNG/job/mRemoteNG/job/develop/)
|
||||
[](https://github.com/mRemoteNG/mRemoteNG/releases/tag/v1.74)
|
||||
|
||||
|
||||
mRemoteNG is the next generation of mRemote, a full-featured, multi-tab remote connections manager.
|
||||
|
||||
It allows you to store all your remote connections in a simple yet powerful interface.
|
||||
|
||||
Currently these protocols are supported:
|
||||
|
||||
* RDP (Remote Desktop)
|
||||
* VNC (Virtual Network Computing)
|
||||
* ICA (Independent Computing Architecture)
|
||||
* SSH (Secure Shell)
|
||||
* Telnet (TELecommunication NETwork)
|
||||
* HTTP/S (Hypertext Transfer Protocol)
|
||||
* Rlogin (Rlogin)
|
||||
* RAW
|
||||
|
||||
mRemoteNG can be installed on Windows 7 or later.
|
||||
|
||||
Windows 7 systems require RDP version 8:
|
||||
https://support.microsoft.com/en-us/kb/2592687
|
||||
OR
|
||||
https://support.microsoft.com/en-us/kb/2923545
|
||||
|
||||
Windows 8+ support RDP version 8+ out of the box.
|
||||
|
||||
RDP versions are backwards compatible, so an mRemoteNG client running on Windows 10 can connection successfully to a Windows 2003 host (for example).
|
||||
@@ -12,15 +12,14 @@ Currently these protocols are supported:
|
||||
* HTTP/S (Hypertext Transfer Protocol)
|
||||
* Rlogin (Rlogin)
|
||||
* RAW
|
||||
|
||||
|
||||
mRemoteNG can be installed on Windows 7 or later.
|
||||
|
||||
Windows 7 systems require RDP version 8:
|
||||
https://support.microsoft.com/en-us/kb/2592687
|
||||
OR
|
||||
https://support.microsoft.com/en-us/kb/2923545
|
||||
Windows 7 systems require RDP version 8:
|
||||
https://support.microsoft.com/en-us/kb/2592687
|
||||
OR
|
||||
https://support.microsoft.com/en-us/kb/2923545
|
||||
|
||||
Windows 8+ support RDP version 8+ out of the box.
|
||||
|
||||
RDP versions are backwards compatible, so an mRemoteNG client running on Windows 10 can
|
||||
connection successfully to a Windows 2003 host (for example).
|
||||
RDP versions are backwards compatible, so an mRemoteNG client running on Windows 10 can connection successfully to a Windows 2003 host (for example).
|
||||
@@ -1,6 +1,9 @@
|
||||
$sourcePath = $args[0]
|
||||
$destinationDir = $args[1]
|
||||
|
||||
Write-Host $sourcePath
|
||||
Write-Host $destinationDir
|
||||
|
||||
if (!(Test-Path -Path $destinationDir))
|
||||
{
|
||||
New-Item -Path $destinationDir -ItemType "directory"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#$solutionDir = $args[0] -replace "\\$"
|
||||
$solutionDir = "C:\Users\vsparda\Documents\Repositories\mRemoteNG Project\mRemoteNG\"
|
||||
#$renameTarget = $args[1]
|
||||
$renameTarget = "C:\Users\vsparda\Documents\Repositories\mRemoteNG Project\mRemoteNG\InstallerProjects\Installer\bin\Release\en-US\mRemoteNG-Installer.msi"
|
||||
$solutionDir = $args[0]
|
||||
$renameTarget = $solutionDir + "InstallerProjects\Installer\bin\Release\en-US\mRemoteNG-Installer.msi"
|
||||
|
||||
Write-Host $solutionDir
|
||||
Write-Host $renameTarget
|
||||
|
||||
$targetVersionedFile = "$solutionDir\mRemoteV1\bin\Release\mRemoteNG.exe"
|
||||
$version = &"$solutionDir\Tools\sigcheck.exe" /accepteula -q -n $targetVersionedFile
|
||||
|
||||
@@ -12,6 +14,8 @@ if ($renameTargetFileObject)
|
||||
# Build the new file name
|
||||
$oldFileName = $renameTargetFileObject.Name
|
||||
$newFileName = $oldFileName -replace "$("\"+$renameTargetFileObject.Extension)",$("-"+$version+$renameTargetFileObject.Extension)
|
||||
Write-Host $oldFileName
|
||||
Write-Host $newFileName
|
||||
|
||||
# Delete any items that already exist with the new name (effectively an overwrite)
|
||||
Remove-Item -Path "$($renameTargetFileObject.Directory.FullName)\$newFileName" -ErrorAction SilentlyContinue
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace mRemoteNGTests
|
||||
Assert.That(IsLargeAware(exePath), Is.True);
|
||||
}
|
||||
|
||||
static string GetTargetPath()
|
||||
static string GetTargetPath([System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "")
|
||||
{
|
||||
string debugOrRelease = "";
|
||||
string normalOrPortable = "";
|
||||
@@ -27,8 +27,9 @@ namespace mRemoteNGTests
|
||||
#else
|
||||
normalOrPortable = "";
|
||||
#endif
|
||||
string path = string.Format(".\\mRemoteV1\\bin\\{0}{1}\\mRemoteNG.exe", debugOrRelease, normalOrPortable);
|
||||
return path;
|
||||
var path = Path.GetDirectoryName(sourceFilePath);
|
||||
string FilePath = $"{path}\\..\\mRemoteV1\\bin\\{debugOrRelease}{normalOrPortable}\\mRemoteNG.exe";
|
||||
return FilePath;
|
||||
}
|
||||
|
||||
static bool IsLargeAware(string file)
|
||||
|
||||
58
mRemoteNGTests/Security/AeadCryptographyProviderTests.cs
Normal file
58
mRemoteNGTests/Security/AeadCryptographyProviderTests.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Security;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
||||
namespace mRemoteNGTests.Security
|
||||
{
|
||||
public class AeadCryptographyProviderTests
|
||||
{
|
||||
private ICryptographyProvider _cryptographyProvider;
|
||||
private SecureString _encryptionKey;
|
||||
private string _plainText;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_cryptographyProvider = new AeadCryptographyProvider();
|
||||
_encryptionKey = "mypassword111111".ConvertToSecureString();
|
||||
_plainText = "MySecret!";
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
_cryptographyProvider = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetBlockSizeReturnsProperValueForAes()
|
||||
{
|
||||
Assert.That(_cryptographyProvider.BlockSizeInBytes, Is.EqualTo(16));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncryptionOutputsBase64String()
|
||||
{
|
||||
var cipherText = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
Assert.That(cipherText.IsBase64String, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DecryptedTextIsEqualToOriginalPlainText()
|
||||
{
|
||||
var cipherText = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
var decryptedCipherText = _cryptographyProvider.Decrypt(cipherText, _encryptionKey);
|
||||
Assert.That(decryptedCipherText, Is.EqualTo(_plainText));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncryptingTheSameValueReturnsNewCipherTextEachTime()
|
||||
{
|
||||
var cipherText1 = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
var cipherText2 = _cryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
Assert.That(cipherText1, Is.Not.EqualTo(cipherText2));
|
||||
}
|
||||
}
|
||||
}
|
||||
112
mRemoteNGTests/Security/CryptographyProviderFactoryTests.cs
Normal file
112
mRemoteNGTests/Security/CryptographyProviderFactoryTests.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using mRemoteNG.Security;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
||||
namespace mRemoteNGTests.Security
|
||||
{
|
||||
[TestFixture]
|
||||
public class CryptographyProviderFactoryTests
|
||||
{
|
||||
private CryptographyProviderFactory _cryptographyProviderFactory;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_cryptographyProviderFactory = new CryptographyProviderFactory();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
_cryptographyProviderFactory = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateAesGcm()
|
||||
{
|
||||
var engine = BlockCipherEngines.AES;
|
||||
var mode = BlockCipherModes.GCM;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateAesCcm()
|
||||
{
|
||||
var engine = BlockCipherEngines.AES;
|
||||
var mode = BlockCipherModes.CCM;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateAesEax()
|
||||
{
|
||||
var engine = BlockCipherEngines.AES;
|
||||
var mode = BlockCipherModes.EAX;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateSerpentGcm()
|
||||
{
|
||||
var engine = BlockCipherEngines.Serpent;
|
||||
var mode = BlockCipherModes.GCM;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateSerpentCcm()
|
||||
{
|
||||
var engine = BlockCipherEngines.Serpent;
|
||||
var mode = BlockCipherModes.CCM;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateSerpentEax()
|
||||
{
|
||||
var engine = BlockCipherEngines.Serpent;
|
||||
var mode = BlockCipherModes.EAX;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateTwofishCcm()
|
||||
{
|
||||
var engine = BlockCipherEngines.Twofish;
|
||||
var mode = BlockCipherModes.CCM;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateTwofishEax()
|
||||
{
|
||||
var engine = BlockCipherEngines.Twofish;
|
||||
var mode = BlockCipherModes.EAX;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateTwofishGcm()
|
||||
{
|
||||
var engine = BlockCipherEngines.Twofish;
|
||||
var mode = BlockCipherModes.GCM;
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateAeadCryptographyProvider(engine, mode);
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo($"{engine}/{mode}"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanCreateLegacyRijndael()
|
||||
{
|
||||
var cryptoProvider = _cryptographyProviderFactory.CreateLegacyRijndaelCryptographyProvider();
|
||||
Assert.That(cryptoProvider.CipherEngine, Is.EqualTo("Rijndael"));
|
||||
}
|
||||
}
|
||||
}
|
||||
45
mRemoteNGTests/Security/EncryptedSecureStringTests.cs
Normal file
45
mRemoteNGTests/Security/EncryptedSecureStringTests.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using mRemoteNG.Security;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace mRemoteNGTests.Security
|
||||
{
|
||||
[TestFixture()]
|
||||
public class EncryptedSecureStringTests
|
||||
{
|
||||
private readonly string _clearTextData = "MySecureData";
|
||||
|
||||
[Test]
|
||||
public void CanCreateEncryptedSecureString()
|
||||
{
|
||||
Assert.That(new EncryptedSecureString(), Is.InstanceOf<EncryptedSecureString>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanAssignStringValue()
|
||||
{
|
||||
var encryptedSecString = new EncryptedSecureString();
|
||||
TestDelegate testDelegate = () => encryptedSecString.SetValue(_clearTextData);
|
||||
Assert.DoesNotThrow(testDelegate);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncryptedValueIsSameAsOriginalValue()
|
||||
{
|
||||
var encryptedSecString = new EncryptedSecureString();
|
||||
encryptedSecString.SetValue(_clearTextData);
|
||||
var decryptedData = encryptedSecString.GetClearTextValue();
|
||||
Assert.That(decryptedData, Is.EqualTo(_clearTextData));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreatingMultipleEncryptedSecureStrings()
|
||||
{
|
||||
var encString1 = new EncryptedSecureString();
|
||||
encString1.SetValue(_clearTextData);
|
||||
var encString2 = new EncryptedSecureString();
|
||||
encString2.SetValue("somevalue");
|
||||
var decryptedString = encString1.GetClearTextValue();
|
||||
Assert.That(decryptedString, Is.EqualTo(_clearTextData));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System.Security;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using NUnit.Framework;
|
||||
|
||||
|
||||
namespace mRemoteNGTests.Security
|
||||
{
|
||||
[TestFixture()]
|
||||
public class LegacyRijndaelCryptographyProviderTests
|
||||
{
|
||||
private ICryptographyProvider _rijndaelCryptographyProvider;
|
||||
private SecureString _encryptionKey;
|
||||
private string _plainText;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
_rijndaelCryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
_encryptionKey = "mR3m".ConvertToSecureString();
|
||||
_plainText = "MySecret!";
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
_rijndaelCryptographyProvider = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetBlockSizeReturnsProperValueForRijndael()
|
||||
{
|
||||
Assert.That(_rijndaelCryptographyProvider.BlockSizeInBytes, Is.EqualTo(16));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncryptionOutputsBase64String()
|
||||
{
|
||||
var cipherText = _rijndaelCryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
Assert.That(cipherText.IsBase64String, Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DecryptedTextIsEqualToOriginalPlainText()
|
||||
{
|
||||
var cipherText = _rijndaelCryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
var decryptedCipherText = _rijndaelCryptographyProvider.Decrypt(cipherText, _encryptionKey);
|
||||
Assert.That(decryptedCipherText, Is.EqualTo(_plainText));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EncryptingTheSameValueReturnsNewCipherTextEachTime()
|
||||
{
|
||||
var cipherText1 = _rijndaelCryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
var cipherText2 = _rijndaelCryptographyProvider.Encrypt(_plainText, _encryptionKey);
|
||||
Assert.That(cipherText1, Is.Not.EqualTo(cipherText2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,10 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>..\packages\BouncyCastle.1.8.1\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\mRemoteV1\References\log4net.dll</HintPath>
|
||||
@@ -62,8 +66,8 @@
|
||||
<HintPath>..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=3.2.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.4.1\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnitForms">
|
||||
@@ -74,9 +78,13 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WeifenLuo.WinFormsUI.Docking, Version=2.5.0.15095, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\mRemoteV1\References\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
|
||||
<Reference Include="WeifenLuo.WinFormsUI.Docking, Version=2.9.0.0, Culture=neutral, PublicKeyToken=5cded1a1a0a7b481, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DockPanelSuite.2.10.0\lib\net40\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="WeifenLuo.WinFormsUI.Docking.ThemeVS2012Light, Version=2.9.0.0, Culture=neutral, PublicKeyToken=5cded1a1a0a7b481, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DockPanelSuite.ThemeVS2012Light.2.10.0\lib\net40\WeifenLuo.WinFormsUI.Docking.ThemeVS2012Light.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
@@ -100,6 +108,10 @@
|
||||
<Compile Include="Config\Connections\SqlUpdateQueryBuilderTest.cs" />
|
||||
<Compile Include="Config\Connections\SqlUpdateTimerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Security\AeadCryptographyProviderTests.cs" />
|
||||
<Compile Include="Security\CryptographyProviderFactoryTests.cs" />
|
||||
<Compile Include="Security\EncryptedSecureStringTests.cs" />
|
||||
<Compile Include="Security\LegacyRijndaelCryptographyProviderTests.cs" />
|
||||
<Compile Include="UI\Controls\CustomListViewTests.cs" />
|
||||
<Compile Include="UI\Controls\TestForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BouncyCastle" version="1.8.1" targetFramework="net45" />
|
||||
<package id="DockPanelSuite" version="2.10.0" targetFramework="net45" />
|
||||
<package id="DockPanelSuite.ThemeVS2012Light" version="2.10.0" targetFramework="net45" />
|
||||
<package id="NSubstitute" version="1.10.0.0" targetFramework="net45" />
|
||||
<package id="NUnit" version="3.2.0" targetFramework="net45" />
|
||||
<package id="NUnit" version="3.4.1" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -10,11 +10,6 @@ namespace mRemoteNG.App
|
||||
{
|
||||
public class CompatibilityChecker
|
||||
{
|
||||
public CompatibilityChecker()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void CheckCompatibility()
|
||||
{
|
||||
CheckFipsPolicy();
|
||||
@@ -34,20 +29,18 @@ namespace mRemoteNG.App
|
||||
{
|
||||
var regKey = Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa");
|
||||
var fipsPolicy = regKey?.GetValue("FIPSAlgorithmPolicy");
|
||||
if (fipsPolicy != null && (int)fipsPolicy != 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
if (fipsPolicy == null) return false;
|
||||
fipsPolicy = Convert.ToInt32(fipsPolicy);
|
||||
return (int)fipsPolicy != 0;
|
||||
}
|
||||
|
||||
private bool FipsPolicyEnabledForServer2008AndNewer()
|
||||
{
|
||||
var regKey = Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa\\FIPSAlgorithmPolicy");
|
||||
var fipsPolicy = regKey?.GetValue("Enabled");
|
||||
if (fipsPolicy != null && (int)fipsPolicy != 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
if (fipsPolicy == null) return false;
|
||||
fipsPolicy = Convert.ToInt32(fipsPolicy);
|
||||
return (int)fipsPolicy != 0;
|
||||
}
|
||||
|
||||
private void CheckLenovoAutoScrollUtility()
|
||||
@@ -65,7 +58,7 @@ namespace mRemoteNG.App
|
||||
Runtime.MessageCollector.AddExceptionMessage("Error in CheckLenovoAutoScrollUtility", ex);
|
||||
}
|
||||
|
||||
if (proccesses?.Length > 0)
|
||||
if (proccesses.Length > 0)
|
||||
{
|
||||
CTaskDialog.MessageBox(Application.ProductName, Language.strCompatibilityProblemDetected, string.Format(Language.strCompatibilityLenovoAutoScrollUtilityDetected, Application.ProductName), "", "", Language.strCheckboxDoNotShowThisMessageAgain, ETaskDialogButtons.Ok, ESysIcons.Warning, ESysIcons.Warning);
|
||||
if (CTaskDialog.VerificationChecked)
|
||||
|
||||
@@ -2,8 +2,10 @@ using System.Collections.Generic;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.Security;
|
||||
using static System.Environment;
|
||||
|
||||
|
||||
@@ -19,7 +21,7 @@ namespace mRemoteNG.App.Info
|
||||
public static readonly string ProdName = Application.ProductName;
|
||||
public static readonly string copyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false)).Copyright;
|
||||
public static readonly string HomePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
public static readonly string EncryptionKey = "mR3m";
|
||||
public static readonly SecureString EncryptionKey = "mR3m".ConvertToSecureString();
|
||||
public static string ReportingFilePath = "";
|
||||
public static readonly string PuttyPath = HomePath + "\\PuTTYNG.exe";
|
||||
public static string UserAgent
|
||||
|
||||
@@ -17,6 +17,8 @@ using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.UI.Forms;
|
||||
using mRemoteNG.UI.Forms.Input;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
@@ -411,12 +413,12 @@ namespace mRemoteNG.App
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadConnectionsBG(bool WithDialog = false, bool Update = false)
|
||||
public static void LoadConnectionsBG(bool withDialog = false, bool update = false)
|
||||
{
|
||||
_withDialog = false;
|
||||
_loadUpdate = true;
|
||||
|
||||
Thread t = new Thread(LoadConnectionsBGd);
|
||||
var t = new Thread(LoadConnectionsBGd);
|
||||
t.SetApartmentState(ApartmentState.STA);
|
||||
t.Start();
|
||||
}
|
||||
@@ -430,12 +432,11 @@ namespace mRemoteNG.App
|
||||
|
||||
public static void LoadConnections(bool withDialog = false, bool update = false)
|
||||
{
|
||||
ConnectionsLoader connectionsLoader = new ConnectionsLoader();
|
||||
var connectionsLoader = new ConnectionsLoader();
|
||||
try
|
||||
{
|
||||
// disable sql update checking while we are loading updates
|
||||
if (SQLConnProvider != null)
|
||||
SQLConnProvider.Disable();
|
||||
SQLConnProvider?.Disable();
|
||||
|
||||
if (ConnectionList != null && ContainerList != null)
|
||||
{
|
||||
@@ -450,15 +451,9 @@ namespace mRemoteNG.App
|
||||
{
|
||||
if (withDialog)
|
||||
{
|
||||
OpenFileDialog loadDialog = Tools.Controls.ConnectionsLoadDialog();
|
||||
if (loadDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
connectionsLoader.ConnectionFileName = loadDialog.FileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
var loadDialog = Tools.Controls.ConnectionsLoadDialog();
|
||||
if (loadDialog.ShowDialog() != DialogResult.OK) return;
|
||||
connectionsLoader.ConnectionFileName = loadDialog.FileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -485,12 +480,13 @@ namespace mRemoteNG.App
|
||||
ConnectionTree.ResetTree();
|
||||
|
||||
connectionsLoader.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0];
|
||||
connectionsLoader.UseSQL = Settings.Default.UseSQLServer;
|
||||
connectionsLoader.SQLHost = Settings.Default.SQLHost;
|
||||
connectionsLoader.SQLDatabaseName = Settings.Default.SQLDatabaseName;
|
||||
connectionsLoader.SQLUsername = Settings.Default.SQLUser;
|
||||
connectionsLoader.SQLPassword = Security.Crypt.Decrypt(Convert.ToString(Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey);
|
||||
connectionsLoader.SQLUpdate = update;
|
||||
connectionsLoader.UseDatabase = Settings.Default.UseSQLServer;
|
||||
connectionsLoader.DatabaseHost = Settings.Default.SQLHost;
|
||||
connectionsLoader.DatabaseName = Settings.Default.SQLDatabaseName;
|
||||
connectionsLoader.DatabaseUsername = Settings.Default.SQLUser;
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
connectionsLoader.DatabasePassword = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey);
|
||||
connectionsLoader.DatabaseUpdate = update;
|
||||
connectionsLoader.LoadConnections(false);
|
||||
|
||||
if (Settings.Default.UseSQLServer)
|
||||
@@ -511,17 +507,14 @@ namespace mRemoteNG.App
|
||||
}
|
||||
|
||||
// re-enable sql update checking after updates are loaded
|
||||
if (Settings.Default.UseSQLServer && SQLConnProvider != null)
|
||||
{
|
||||
SQLConnProvider.Enable();
|
||||
}
|
||||
SQLConnProvider?.Enable();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (Settings.Default.UseSQLServer)
|
||||
{
|
||||
MessageCollector.AddExceptionMessage(Language.strLoadFromSqlFailed, ex);
|
||||
string commandButtons = string.Join("|", new[] { Language.strCommandTryAgain, Language.strCommandOpenConnectionFile, string.Format(Language.strCommandExitProgram, Application.ProductName) });
|
||||
var commandButtons = string.Join("|", Language.strCommandTryAgain, Language.strCommandOpenConnectionFile, string.Format(Language.strCommandExitProgram, Application.ProductName));
|
||||
CTaskDialog.ShowCommandBox(Application.ProductName, Language.strLoadFromSqlFailed, Language.strLoadFromSqlFailedContent, MiscTools.GetExceptionMessageRecursive(ex), "", "", commandButtons, false, ESysIcons.Error, ESysIcons.Error);
|
||||
switch (CTaskDialog.CommandButtonResult)
|
||||
{
|
||||
@@ -537,29 +530,24 @@ namespace mRemoteNG.App
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ex is FileNotFoundException && !withDialog)
|
||||
{
|
||||
MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoadedNew, connectionsLoader.ConnectionFileName), ex, MessageClass.InformationMsg);
|
||||
NewConnections(Convert.ToString(connectionsLoader.ConnectionFileName));
|
||||
return;
|
||||
}
|
||||
|
||||
MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoaded, connectionsLoader.ConnectionFileName), ex);
|
||||
if (connectionsLoader.ConnectionFileName != GetStartupConnectionFileName())
|
||||
{
|
||||
LoadConnections(withDialog, update);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ex is FileNotFoundException && !withDialog)
|
||||
{
|
||||
MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoadedNew, connectionsLoader.ConnectionFileName), ex, MessageClass.InformationMsg);
|
||||
NewConnections(Convert.ToString(connectionsLoader.ConnectionFileName));
|
||||
return;
|
||||
}
|
||||
|
||||
MessageCollector.AddExceptionMessage(string.Format(Language.strConnectionsFileCouldNotBeLoaded, connectionsLoader.ConnectionFileName), ex);
|
||||
if (connectionsLoader.ConnectionFileName != GetStartupConnectionFileName())
|
||||
{
|
||||
LoadConnections(withDialog, update);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show(frmMain.Default,
|
||||
string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine, Application.ProductName, GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)),
|
||||
"Could not load startup file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Application.Exit();
|
||||
return;
|
||||
}
|
||||
MessageBox.Show(frmMain.Default,
|
||||
string.Format(Language.strErrorStartupConnectionFileLoad, Environment.NewLine, Application.ProductName, GetStartupConnectionFileName(), MiscTools.GetExceptionMessageRecursive(ex)),
|
||||
"Could not load startup file.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -692,7 +680,8 @@ namespace mRemoteNG.App
|
||||
conS.SQLHost = Convert.ToString(Settings.Default.SQLHost);
|
||||
conS.SQLDatabaseName = Convert.ToString(Settings.Default.SQLDatabaseName);
|
||||
conS.SQLUsername = Convert.ToString(Settings.Default.SQLUser);
|
||||
conS.SQLPassword = Security.Crypt.Decrypt(Convert.ToString(Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
conS.SQLPassword = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.SQLPass), GeneralAppInfo.EncryptionKey);
|
||||
}
|
||||
|
||||
conS.SaveConnections();
|
||||
|
||||
@@ -6,6 +6,8 @@ using System.Threading;
|
||||
using mRemoteNG.Tools;
|
||||
using System.Reflection;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
|
||||
|
||||
namespace mRemoteNG.App.Update
|
||||
@@ -107,7 +109,15 @@ namespace mRemoteNG.App.Update
|
||||
|
||||
public void SetProxySettings()
|
||||
{
|
||||
SetProxySettings(Convert.ToBoolean(Settings.Default.UpdateUseProxy), Convert.ToString(Settings.Default.UpdateProxyAddress), Convert.ToInt32(Settings.Default.UpdateProxyPort), Convert.ToBoolean(Settings.Default.UpdateProxyUseAuthentication), Convert.ToString(Settings.Default.UpdateProxyAuthUser), Security.Crypt.Decrypt(Convert.ToString(Settings.Default.UpdateProxyAuthPass), GeneralAppInfo.EncryptionKey));
|
||||
var shouldWeUseProxy = Settings.Default.UpdateUseProxy;
|
||||
var proxyAddress = Settings.Default.UpdateProxyAddress;
|
||||
var port = Settings.Default.UpdateProxyPort;
|
||||
var useAuthentication = Settings.Default.UpdateProxyUseAuthentication;
|
||||
var username = Settings.Default.UpdateProxyAuthUser;
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
var password = cryptographyProvider.Decrypt(Settings.Default.UpdateProxyAuthPass, GeneralAppInfo.EncryptionKey);
|
||||
|
||||
SetProxySettings(shouldWeUseProxy, proxyAddress, port, useAuthentication, username, password);
|
||||
}
|
||||
|
||||
public void SetProxySettings(bool useProxy, string address, int port, bool useAuthentication, string username, string password)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
@@ -14,6 +15,7 @@ using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
@@ -37,7 +39,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
#region Private Properties
|
||||
private XmlTextWriter _xmlTextWriter;
|
||||
private string _password = "mR3m";
|
||||
private SecureString _password = GeneralAppInfo.EncryptionKey;
|
||||
|
||||
private SqlConnection _sqlConnection;
|
||||
private SqlCommand _sqlQuery;
|
||||
@@ -99,8 +101,7 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
bool isVerified = false;
|
||||
SqlDataReader sqlDataReader = null;
|
||||
Version databaseVersion = null;
|
||||
try
|
||||
try
|
||||
{
|
||||
SqlCommand sqlCommand = new SqlCommand("SELECT * FROM tblRoot", sqlConnection);
|
||||
sqlDataReader = sqlCommand.ExecuteReader();
|
||||
@@ -110,7 +111,7 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
sqlDataReader.Read();
|
||||
|
||||
databaseVersion = new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture));
|
||||
var databaseVersion = new Version(Convert.ToString(sqlDataReader["confVersion"], CultureInfo.InvariantCulture));
|
||||
|
||||
sqlDataReader.Close();
|
||||
|
||||
@@ -175,8 +176,9 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
_sqlConnection = new SqlConnection("Data Source=" + SQLHost + ";Initial Catalog=" + SQLDatabaseName + ";Integrated Security=True");
|
||||
}
|
||||
|
||||
_sqlConnection.Open();
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
|
||||
_sqlConnection.Open();
|
||||
|
||||
if (!VerifyDatabaseVersion(_sqlConnection))
|
||||
{
|
||||
@@ -191,17 +193,17 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
if (((RootNodeInfo) tN.Tag).Password)
|
||||
{
|
||||
_password = Convert.ToString(((RootNodeInfo) tN.Tag).PasswordString);
|
||||
strProtected = Crypt.Encrypt("ThisIsProtected", _password);
|
||||
_password = Convert.ToString(((RootNodeInfo) tN.Tag).PasswordString).ConvertToSecureString();
|
||||
strProtected = cryptographyProvider.Encrypt("ThisIsProtected", _password);
|
||||
}
|
||||
else
|
||||
{
|
||||
strProtected = Crypt.Encrypt("ThisIsNotProtected", _password);
|
||||
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", _password);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strProtected = Crypt.Encrypt("ThisIsNotProtected", _password);
|
||||
strProtected = cryptographyProvider.Encrypt("ThisIsNotProtected", _password);
|
||||
}
|
||||
|
||||
_sqlQuery = new SqlCommand("DELETE FROM tblRoot", _sqlConnection);
|
||||
@@ -231,7 +233,7 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
_currentNodeIndex++;
|
||||
|
||||
ConnectionInfo curConI = default(ConnectionInfo);
|
||||
ConnectionInfo curConI;
|
||||
_sqlQuery = new SqlCommand("INSERT INTO tblCons (Name, Type, Expanded, Description, Icon, Panel, Username, " + "DomainName, Password, Hostname, Protocol, PuttySession, " + "Port, ConnectToConsole, RenderingEngine, ICAEncryptionStrength, RDPAuthenticationLevel, LoadBalanceInfo, Colors, Resolution, AutomaticResize, DisplayWallpaper, " + "DisplayThemes, EnableFontSmoothing, EnableDesktopComposition, CacheBitmaps, RedirectDiskDrives, RedirectPorts, " + "RedirectPrinters, RedirectSmartCards, RedirectSound, RedirectKeys, " + "Connected, PreExtApp, PostExtApp, MacAddress, UserField, ExtApp, VNCCompression, VNCEncoding, VNCAuthMode, " + "VNCProxyType, VNCProxyIP, VNCProxyPort, VNCProxyUsername, VNCProxyPassword, " + "VNCColors, VNCSmartSizeMode, VNCViewOnly, " + "RDGatewayUsageMethod, RDGatewayHostname, RDGatewayUseConnectionCredentials, RDGatewayUsername, RDGatewayPassword, RDGatewayDomain, " + "UseCredSsp, " + "InheritCacheBitmaps, InheritColors, " + "InheritDescription, InheritDisplayThemes, InheritDisplayWallpaper, InheritEnableFontSmoothing, InheritEnableDesktopComposition, InheritDomain, " + "InheritIcon, InheritPanel, InheritPassword, InheritPort, " + "InheritProtocol, InheritPuttySession, InheritRedirectDiskDrives, " + "InheritRedirectKeys, InheritRedirectPorts, InheritRedirectPrinters, " + "InheritRedirectSmartCards, InheritRedirectSound, InheritResolution, InheritAutomaticResize, " + "InheritUseConsoleSession, InheritRenderingEngine, InheritUsername, InheritICAEncryptionStrength, InheritRDPAuthenticationLevel, InheritLoadBalanceInfo, " + "InheritPreExtApp, InheritPostExtApp, InheritMacAddress, InheritUserField, InheritExtApp, InheritVNCCompression, InheritVNCEncoding, " + "InheritVNCAuthMode, InheritVNCProxyType, InheritVNCProxyIP, InheritVNCProxyPort, " + "InheritVNCProxyUsername, InheritVNCProxyPassword, InheritVNCColors, " + "InheritVNCSmartSizeMode, InheritVNCViewOnly, " + "InheritRDGatewayUsageMethod, InheritRDGatewayHostname, InheritRDGatewayUseConnectionCredentials, InheritRDGatewayUsername, InheritRDGatewayPassword, InheritRDGatewayDomain, "
|
||||
+ "InheritUseCredSsp, " + "PositionID, ParentID, ConstantID, LastChange)" + "VALUES (", _sqlConnection
|
||||
);
|
||||
@@ -272,7 +274,8 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
private void SaveConnectionFieldsSQL(ConnectionInfo curConI)
|
||||
{
|
||||
ConnectionInfo with_1 = curConI;
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
ConnectionInfo with_1 = curConI;
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Description) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Icon) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(with_1.Panel) + "\',";
|
||||
@@ -297,7 +300,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
if (SaveSecurity.Password)
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(Crypt.Encrypt(with_1.Password, _password)) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + MiscTools.PrepareValueForDB(cryptographyProvider.Encrypt(with_1.Password, _password)) + "\',";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -350,7 +353,7 @@ namespace mRemoteNG.Config.Connections
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCProxyIP + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCProxyPort) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCProxyUsername + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Crypt.Encrypt(with_1.VNCProxyPassword, _password) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + cryptographyProvider.Encrypt(with_1.VNCProxyPassword, _password) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCColors + "\',";
|
||||
_sqlQuery.CommandText += "\'" + with_1.VNCSmartSizeMode + "\',";
|
||||
_sqlQuery.CommandText += "\'" + Convert.ToString(with_1.VNCViewOnly) + "\',";
|
||||
@@ -370,7 +373,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
if (SaveSecurity.Password)
|
||||
{
|
||||
_sqlQuery.CommandText += "\'" + Crypt.Encrypt(with_1.RDGatewayPassword, _password) + "\',";
|
||||
_sqlQuery.CommandText += "\'" + cryptographyProvider.Encrypt(with_1.RDGatewayPassword, _password) + "\',";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -536,15 +539,16 @@ namespace mRemoteNG.Config.Connections
|
||||
private void EncryptCompleteFile()
|
||||
{
|
||||
StreamReader streamReader = new StreamReader(ConnectionFileName);
|
||||
|
||||
string fileContents;
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
|
||||
string fileContents;
|
||||
fileContents = streamReader.ReadToEnd();
|
||||
streamReader.Close();
|
||||
|
||||
if (!string.IsNullOrEmpty(fileContents))
|
||||
{
|
||||
StreamWriter streamWriter = new StreamWriter(ConnectionFileName);
|
||||
streamWriter.Write(Crypt.Encrypt(fileContents, _password));
|
||||
streamWriter.Write(cryptographyProvider.Encrypt(fileContents, _password));
|
||||
streamWriter.Close();
|
||||
}
|
||||
}
|
||||
@@ -557,8 +561,8 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TreeNode treeNode = default(TreeNode);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
TreeNode treeNode;
|
||||
|
||||
if (ConnectionTreeNode.GetNodeType(RootTreeNode) == TreeNodeType.Root)
|
||||
{
|
||||
@@ -584,25 +588,24 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
if (Export)
|
||||
{
|
||||
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsNotProtected", _password));
|
||||
_xmlTextWriter.WriteAttributeString("Protected", "", cryptographyProvider.Encrypt("ThisIsNotProtected", _password));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((RootNodeInfo) treeNode.Tag).Password)
|
||||
{
|
||||
_password = Convert.ToString(((RootNodeInfo) treeNode.Tag).PasswordString);
|
||||
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsProtected", _password));
|
||||
_password = Convert.ToString(((RootNodeInfo) treeNode.Tag).PasswordString).ConvertToSecureString();
|
||||
_xmlTextWriter.WriteAttributeString("Protected", "", cryptographyProvider.Encrypt("ThisIsProtected", _password));
|
||||
}
|
||||
else
|
||||
{
|
||||
_xmlTextWriter.WriteAttributeString("Protected", "", Crypt.Encrypt("ThisIsNotProtected", _password));
|
||||
_xmlTextWriter.WriteAttributeString("Protected", "", cryptographyProvider.Encrypt("ThisIsNotProtected", _password));
|
||||
}
|
||||
}
|
||||
|
||||
_xmlTextWriter.WriteAttributeString("ConfVersion", "", ConnectionsFileInfo.ConnectionFileVersion.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
TreeNodeCollection treeNodeCollection = default(TreeNodeCollection);
|
||||
treeNodeCollection = treeNode.Nodes;
|
||||
|
||||
var treeNodeCollection = treeNode.Nodes;
|
||||
|
||||
SaveNode(treeNodeCollection);
|
||||
|
||||
@@ -626,8 +629,9 @@ namespace mRemoteNG.Config.Connections
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveToXml failed" + Environment.NewLine + ex.Message, false);
|
||||
}
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveToXml failed" + Environment.NewLine + ex.Message);
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "SaveToXml failed" + Environment.NewLine + ex.StackTrace, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveNode(TreeNodeCollection tNC)
|
||||
@@ -636,7 +640,7 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
foreach (TreeNode node in tNC)
|
||||
{
|
||||
ConnectionInfo curConI = default(ConnectionInfo);
|
||||
ConnectionInfo curConI;
|
||||
|
||||
if (ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Connection | ConnectionTreeNode.GetNodeType(node) == TreeNodeType.Container)
|
||||
{
|
||||
@@ -672,7 +676,8 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
try
|
||||
{
|
||||
_xmlTextWriter.WriteAttributeString("Descr", "", curConI.Description);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
_xmlTextWriter.WriteAttributeString("Descr", "", curConI.Description);
|
||||
|
||||
_xmlTextWriter.WriteAttributeString("Icon", "", curConI.Icon);
|
||||
|
||||
@@ -698,7 +703,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
if (SaveSecurity.Password)
|
||||
{
|
||||
_xmlTextWriter.WriteAttributeString("Password", "", Crypt.Encrypt(curConI.Password, _password));
|
||||
_xmlTextWriter.WriteAttributeString("Password", "", cryptographyProvider.Encrypt(curConI.Password, _password));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -775,7 +780,7 @@ namespace mRemoteNG.Config.Connections
|
||||
_xmlTextWriter.WriteAttributeString("VNCProxyIP", "", curConI.VNCProxyIP);
|
||||
_xmlTextWriter.WriteAttributeString("VNCProxyPort", "", Convert.ToString(curConI.VNCProxyPort));
|
||||
_xmlTextWriter.WriteAttributeString("VNCProxyUsername", "", curConI.VNCProxyUsername);
|
||||
_xmlTextWriter.WriteAttributeString("VNCProxyPassword", "", Crypt.Encrypt(curConI.VNCProxyPassword, _password));
|
||||
_xmlTextWriter.WriteAttributeString("VNCProxyPassword", "", cryptographyProvider.Encrypt(curConI.VNCProxyPassword, _password));
|
||||
_xmlTextWriter.WriteAttributeString("VNCColors", "", curConI.VNCColors.ToString());
|
||||
_xmlTextWriter.WriteAttributeString("VNCSmartSizeMode", "", curConI.VNCSmartSizeMode.ToString());
|
||||
_xmlTextWriter.WriteAttributeString("VNCViewOnly", "", Convert.ToString(curConI.VNCViewOnly));
|
||||
@@ -796,7 +801,7 @@ namespace mRemoteNG.Config.Connections
|
||||
|
||||
if (SaveSecurity.Password)
|
||||
{
|
||||
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", Crypt.Encrypt(curConI.RDGatewayPassword, _password));
|
||||
_xmlTextWriter.WriteAttributeString("RDGatewayPassword", "", cryptographyProvider.Encrypt(curConI.RDGatewayPassword, _password));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -936,12 +941,10 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TreeNode tN = default(TreeNode);
|
||||
tN = (TreeNode)RootTreeNode.Clone();
|
||||
|
||||
TreeNodeCollection tNC = default(TreeNodeCollection);
|
||||
tNC = tN.Nodes;
|
||||
|
||||
var tN = (TreeNode)RootTreeNode.Clone();
|
||||
|
||||
var tNC = tN.Nodes;
|
||||
|
||||
csvWr = new StreamWriter(ConnectionFileName);
|
||||
|
||||
@@ -1000,9 +1003,9 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
string nodePath = con.TreeNode.FullPath;
|
||||
|
||||
int firstSlash = nodePath.IndexOf("\\");
|
||||
int firstSlash = nodePath.IndexOf("\\", StringComparison.Ordinal);
|
||||
nodePath = nodePath.Remove(0, firstSlash + 1);
|
||||
int lastSlash = nodePath.LastIndexOf("\\");
|
||||
int lastSlash = nodePath.LastIndexOf("\\", StringComparison.Ordinal);
|
||||
|
||||
if (lastSlash > 0)
|
||||
{
|
||||
@@ -1051,12 +1054,10 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TreeNode tN = default(TreeNode);
|
||||
tN = (TreeNode)RootTreeNode.Clone();
|
||||
|
||||
TreeNodeCollection tNC = default(TreeNodeCollection);
|
||||
tNC = tN.Nodes;
|
||||
|
||||
var tN = (TreeNode)RootTreeNode.Clone();
|
||||
|
||||
var tNC = tN.Nodes;
|
||||
|
||||
csvWr = new StreamWriter(ConnectionFileName);
|
||||
|
||||
@@ -1089,9 +1090,9 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
string nodePath = con.TreeNode.FullPath;
|
||||
|
||||
int firstSlash = nodePath.IndexOf("\\");
|
||||
int firstSlash = nodePath.IndexOf("\\", StringComparison.Ordinal);
|
||||
nodePath = nodePath.Remove(0, firstSlash + 1);
|
||||
int lastSlash = nodePath.LastIndexOf("\\");
|
||||
int lastSlash = nodePath.LastIndexOf("\\", StringComparison.Ordinal);
|
||||
|
||||
if (lastSlash > 0)
|
||||
{
|
||||
@@ -1113,12 +1114,10 @@ namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TreeNode tN = default(TreeNode);
|
||||
tN = (TreeNode)RootTreeNode.Clone();
|
||||
|
||||
TreeNodeCollection tNC = default(TreeNodeCollection);
|
||||
tNC = tN.Nodes;
|
||||
|
||||
var tN = (TreeNode)RootTreeNode.Clone();
|
||||
|
||||
var tNC = tN.Nodes;
|
||||
|
||||
_xmlTextWriter = new XmlTextWriter(ConnectionFileName, Encoding.UTF8);
|
||||
_xmlTextWriter.Formatting = Formatting.Indented;
|
||||
|
||||
510
mRemoteV1/Config/Connections/SqlConnectionsLoader.cs
Normal file
510
mRemoteV1/Config/Connections/SqlConnectionsLoader.cs
Normal file
@@ -0,0 +1,510 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.Security;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Connection.Protocol.Http;
|
||||
using mRemoteNG.Connection.Protocol.ICA;
|
||||
using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Connection.Protocol.VNC;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using mRemoteNG.UI.Forms;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public class SqlConnectionsLoader
|
||||
{
|
||||
private SqlConnection _sqlConnection;
|
||||
private SqlCommand _sqlQuery;
|
||||
private SqlDataReader _sqlDataReader;
|
||||
private TreeNode _selectedTreeNode;
|
||||
private double _confVersion;
|
||||
private SecureString _pW = GeneralAppInfo.EncryptionKey;
|
||||
|
||||
|
||||
public string DatabaseHost { get; set; }
|
||||
public string DatabaseName { get; set; }
|
||||
public string DatabaseUsername { get; set; }
|
||||
public string DatabasePassword { get; set; }
|
||||
public bool DatabaseUpdate { get; set; }
|
||||
public string PreviousSelected { get; set; }
|
||||
public TreeNode RootTreeNode { get; set; }
|
||||
public ConnectionList ConnectionList { get; set; }
|
||||
public ContainerList ContainerList { get; set; }
|
||||
public ConnectionList PreviousConnectionList { get; set; }
|
||||
public ContainerList PreviousContainerList { get; set; }
|
||||
|
||||
|
||||
private delegate void LoadFromSqlDelegate();
|
||||
public void LoadFromSql()
|
||||
{
|
||||
if (Windows.treeForm == null || Windows.treeForm.tvConnections == null)
|
||||
return;
|
||||
if (Windows.treeForm.tvConnections.InvokeRequired)
|
||||
{
|
||||
Windows.treeForm.tvConnections.Invoke(new LoadFromSqlDelegate(LoadFromSql));
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Runtime.IsConnectionsFileLoaded = false;
|
||||
_sqlConnection = !string.IsNullOrEmpty(DatabaseUsername) ? new SqlConnection("Data Source=" + DatabaseHost + ";Initial Catalog=" + DatabaseName + ";User Id=" + DatabaseUsername + ";Password=" + DatabasePassword) : new SqlConnection("Data Source=" + DatabaseHost + ";Initial Catalog=" + DatabaseName + ";Integrated Security=True");
|
||||
|
||||
_sqlConnection.Open();
|
||||
_sqlQuery = new SqlCommand("SELECT * FROM tblRoot", _sqlConnection);
|
||||
_sqlDataReader = _sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
|
||||
_sqlDataReader.Read();
|
||||
|
||||
if (_sqlDataReader.HasRows == false)
|
||||
{
|
||||
Runtime.SaveConnections();
|
||||
_sqlQuery = new SqlCommand("SELECT * FROM tblRoot", _sqlConnection);
|
||||
_sqlDataReader = _sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
|
||||
_sqlDataReader.Read();
|
||||
}
|
||||
|
||||
_confVersion = Convert.ToDouble(_sqlDataReader["confVersion"], CultureInfo.InvariantCulture);
|
||||
const double maxSupportedSchemaVersion = 2.5;
|
||||
if (_confVersion > maxSupportedSchemaVersion)
|
||||
{
|
||||
CTaskDialog.ShowTaskDialogBox(
|
||||
frmMain.Default,
|
||||
Application.ProductName,
|
||||
"Incompatible database schema",
|
||||
$"The database schema on the server is not supported. Please upgrade to a newer version of {Application.ProductName}.",
|
||||
string.Format("Schema Version: {1}{0}Highest Supported Version: {2}", Environment.NewLine, _confVersion, maxSupportedSchemaVersion),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
ETaskDialogButtons.Ok,
|
||||
ESysIcons.Error,
|
||||
ESysIcons.Error
|
||||
);
|
||||
throw (new Exception($"Incompatible database schema (schema version {_confVersion})."));
|
||||
}
|
||||
|
||||
RootTreeNode.Name = Convert.ToString(_sqlDataReader["Name"]);
|
||||
|
||||
var rootInfo = new RootNodeInfo(RootNodeType.Connection)
|
||||
{
|
||||
Name = RootTreeNode.Name,
|
||||
TreeNode = RootTreeNode
|
||||
};
|
||||
|
||||
RootTreeNode.Tag = rootInfo;
|
||||
RootTreeNode.ImageIndex = (int)TreeImageType.Root;
|
||||
RootTreeNode.SelectedImageIndex = (int)TreeImageType.Root;
|
||||
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
if (cryptographyProvider.Decrypt(Convert.ToString(_sqlDataReader["Protected"]), _pW) != "ThisIsNotProtected")
|
||||
{
|
||||
if (Authenticate(Convert.ToString(_sqlDataReader["Protected"]), false, rootInfo) == false)
|
||||
{
|
||||
mRemoteNG.Settings.Default.LoadConsFromCustomLocation = false;
|
||||
mRemoteNG.Settings.Default.CustomConsPath = "";
|
||||
RootTreeNode.Remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_sqlDataReader.Close();
|
||||
Windows.treeForm.tvConnections.BeginUpdate();
|
||||
|
||||
// SECTION 3. Populate the TreeView with the DOM nodes.
|
||||
AddNodesFromSql(RootTreeNode);
|
||||
RootTreeNode.Expand();
|
||||
|
||||
//expand containers
|
||||
foreach (ContainerInfo contI in ContainerList)
|
||||
{
|
||||
if (contI.IsExpanded)
|
||||
contI.TreeNode.Expand();
|
||||
}
|
||||
|
||||
Windows.treeForm.tvConnections.EndUpdate();
|
||||
|
||||
//open connections from last mremote session
|
||||
if (mRemoteNG.Settings.Default.OpenConsFromLastSession && !mRemoteNG.Settings.Default.NoReconnect)
|
||||
{
|
||||
foreach (ConnectionInfo conI in ConnectionList)
|
||||
{
|
||||
if (conI.PleaseConnect)
|
||||
Runtime.OpenConnection(conI);
|
||||
}
|
||||
}
|
||||
|
||||
Runtime.IsConnectionsFileLoaded = true;
|
||||
Windows.treeForm.InitialRefresh();
|
||||
SetSelectedNode(_selectedTreeNode);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_sqlConnection?.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddNodesFromSql(TreeNode baseNode)
|
||||
{
|
||||
try
|
||||
{
|
||||
_sqlConnection.Open();
|
||||
_sqlQuery = new SqlCommand("SELECT * FROM tblCons ORDER BY PositionID ASC", _sqlConnection);
|
||||
_sqlDataReader = _sqlQuery.ExecuteReader(CommandBehavior.CloseConnection);
|
||||
|
||||
if (_sqlDataReader.HasRows == false)
|
||||
return;
|
||||
|
||||
while (_sqlDataReader.Read())
|
||||
{
|
||||
var tNode = new TreeNode(Convert.ToString(_sqlDataReader["Name"]));
|
||||
var nodeType = ConnectionTreeNode.GetNodeTypeFromString(Convert.ToString(_sqlDataReader["Type"]));
|
||||
|
||||
if (nodeType == TreeNodeType.Connection)
|
||||
AddConnectionToList(tNode);
|
||||
else if (nodeType == TreeNodeType.Container)
|
||||
AddContainerToList(tNode);
|
||||
|
||||
var parentId = Convert.ToString(_sqlDataReader["ParentID"].ToString().Trim());
|
||||
if (string.IsNullOrEmpty(parentId) || parentId == "0")
|
||||
{
|
||||
baseNode.Nodes.Add(tNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pNode = ConnectionTreeNode.GetNodeFromConstantID(Convert.ToString(_sqlDataReader["ParentID"]));
|
||||
if (pNode != null)
|
||||
{
|
||||
pNode.Nodes.Add(tNode);
|
||||
|
||||
switch (ConnectionTreeNode.GetNodeType(tNode))
|
||||
{
|
||||
case TreeNodeType.Connection:
|
||||
((ConnectionInfo) tNode.Tag).Parent = (ContainerInfo)pNode.Tag;
|
||||
break;
|
||||
case TreeNodeType.Container:
|
||||
((ContainerInfo) tNode.Tag).Parent = (ContainerInfo)pNode.Tag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
baseNode.Nodes.Add(tNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strAddNodesFromSqlFailed + Environment.NewLine + ex.Message, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddConnectionToList(TreeNode tNode)
|
||||
{
|
||||
var conI = GetConnectionInfoFromSql();
|
||||
conI.TreeNode = tNode;
|
||||
ConnectionList.Add(conI);
|
||||
tNode.Tag = conI;
|
||||
|
||||
if (DatabaseUpdate)
|
||||
{
|
||||
var prevCon = PreviousConnectionList.FindByConstantID(conI.ConstantID);
|
||||
if (prevCon != null)
|
||||
{
|
||||
foreach (ProtocolBase prot in prevCon.OpenConnections)
|
||||
{
|
||||
prot.InterfaceControl.Info = conI;
|
||||
conI.OpenConnections.Add(prot);
|
||||
}
|
||||
|
||||
if (conI.OpenConnections.Count > 0)
|
||||
{
|
||||
tNode.ImageIndex = (int) TreeImageType.ConnectionOpen;
|
||||
tNode.SelectedImageIndex = (int) TreeImageType.ConnectionOpen;
|
||||
}
|
||||
else
|
||||
{
|
||||
tNode.ImageIndex = (int) TreeImageType.ConnectionClosed;
|
||||
tNode.SelectedImageIndex = (int) TreeImageType.ConnectionClosed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tNode.ImageIndex = (int) TreeImageType.ConnectionClosed;
|
||||
tNode.SelectedImageIndex = (int) TreeImageType.ConnectionClosed;
|
||||
}
|
||||
|
||||
if (conI.ConstantID == PreviousSelected)
|
||||
_selectedTreeNode = tNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
tNode.ImageIndex = (int) TreeImageType.ConnectionClosed;
|
||||
tNode.SelectedImageIndex = (int) TreeImageType.ConnectionClosed;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddContainerToList(TreeNode tNode)
|
||||
{
|
||||
var contI = new ContainerInfo
|
||||
{
|
||||
TreeNode = tNode,
|
||||
Name = Convert.ToString(_sqlDataReader["Name"])
|
||||
};
|
||||
|
||||
var conI = GetConnectionInfoFromSql();
|
||||
conI.Parent = contI;
|
||||
conI.IsContainer = true;
|
||||
contI.ConnectionInfo = conI;
|
||||
|
||||
if (DatabaseUpdate)
|
||||
{
|
||||
var prevCont = PreviousContainerList.FindByConstantID(conI.ConstantID);
|
||||
if (prevCont != null)
|
||||
contI.IsExpanded = prevCont.IsExpanded;
|
||||
|
||||
if (conI.ConstantID == PreviousSelected)
|
||||
_selectedTreeNode = tNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
contI.IsExpanded = Convert.ToBoolean(_sqlDataReader["Expanded"]);
|
||||
}
|
||||
|
||||
ContainerList.Add(contI);
|
||||
ConnectionList.Add(conI);
|
||||
tNode.Tag = contI;
|
||||
tNode.ImageIndex = (int)TreeImageType.Container;
|
||||
tNode.SelectedImageIndex = (int)TreeImageType.Container;
|
||||
}
|
||||
|
||||
private ConnectionInfo GetConnectionInfoFromSql()
|
||||
{
|
||||
try
|
||||
{
|
||||
var connectionInfo = new ConnectionInfo
|
||||
{
|
||||
PositionID = Convert.ToInt32(_sqlDataReader["PositionID"]),
|
||||
ConstantID = Convert.ToString(_sqlDataReader["ConstantID"]),
|
||||
Name = Convert.ToString(_sqlDataReader["Name"]),
|
||||
Description = Convert.ToString(_sqlDataReader["Description"]),
|
||||
Hostname = Convert.ToString(_sqlDataReader["Hostname"]),
|
||||
Username = Convert.ToString(_sqlDataReader["Username"])
|
||||
};
|
||||
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
connectionInfo.Password = cryptographyProvider.Decrypt(Convert.ToString(_sqlDataReader["Password"]), _pW);
|
||||
connectionInfo.Domain = Convert.ToString(_sqlDataReader["DomainName"]);
|
||||
connectionInfo.DisplayWallpaper = Convert.ToBoolean(_sqlDataReader["DisplayWallpaper"]);
|
||||
connectionInfo.DisplayThemes = Convert.ToBoolean(_sqlDataReader["DisplayThemes"]);
|
||||
connectionInfo.CacheBitmaps = Convert.ToBoolean(_sqlDataReader["CacheBitmaps"]);
|
||||
connectionInfo.UseConsoleSession = Convert.ToBoolean(_sqlDataReader["ConnectToConsole"]);
|
||||
connectionInfo.RedirectDiskDrives = Convert.ToBoolean(_sqlDataReader["RedirectDiskDrives"]);
|
||||
connectionInfo.RedirectPrinters = Convert.ToBoolean(_sqlDataReader["RedirectPrinters"]);
|
||||
connectionInfo.RedirectPorts = Convert.ToBoolean(_sqlDataReader["RedirectPorts"]);
|
||||
connectionInfo.RedirectSmartCards = Convert.ToBoolean(_sqlDataReader["RedirectSmartCards"]);
|
||||
connectionInfo.RedirectKeys = Convert.ToBoolean(_sqlDataReader["RedirectKeys"]);
|
||||
connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPSounds), Convert.ToString(_sqlDataReader["RedirectSound"]));
|
||||
connectionInfo.Protocol = (ProtocolType)Tools.MiscTools.StringToEnum(typeof(ProtocolType), Convert.ToString(_sqlDataReader["Protocol"]));
|
||||
connectionInfo.Port = Convert.ToInt32(_sqlDataReader["Port"]);
|
||||
connectionInfo.PuttySession = Convert.ToString(_sqlDataReader["PuttySession"]);
|
||||
connectionInfo.Colors = (ProtocolRDP.RDPColors)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPColors), Convert.ToString(_sqlDataReader["Colors"]));
|
||||
connectionInfo.Resolution = (ProtocolRDP.RDPResolutions)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPResolutions), Convert.ToString(_sqlDataReader["Resolution"]));
|
||||
connectionInfo.Icon = Convert.ToString(_sqlDataReader["Icon"]);
|
||||
connectionInfo.Panel = Convert.ToString(_sqlDataReader["Panel"]);
|
||||
connectionInfo.Inheritance = new ConnectionInfoInheritance(connectionInfo)
|
||||
{
|
||||
CacheBitmaps = Convert.ToBoolean(_sqlDataReader["InheritCacheBitmaps"]),
|
||||
Colors = Convert.ToBoolean(_sqlDataReader["InheritColors"]),
|
||||
Description = Convert.ToBoolean(_sqlDataReader["InheritDescription"]),
|
||||
DisplayThemes = Convert.ToBoolean(_sqlDataReader["InheritDisplayThemes"]),
|
||||
DisplayWallpaper = Convert.ToBoolean(_sqlDataReader["InheritDisplayWallpaper"]),
|
||||
Domain = Convert.ToBoolean(_sqlDataReader["InheritDomain"]),
|
||||
Icon = Convert.ToBoolean(_sqlDataReader["InheritIcon"]),
|
||||
Panel = Convert.ToBoolean(_sqlDataReader["InheritPanel"]),
|
||||
Password = Convert.ToBoolean(_sqlDataReader["InheritPassword"]),
|
||||
Port = Convert.ToBoolean(_sqlDataReader["InheritPort"]),
|
||||
Protocol = Convert.ToBoolean(_sqlDataReader["InheritProtocol"]),
|
||||
PuttySession = Convert.ToBoolean(_sqlDataReader["InheritPuttySession"]),
|
||||
RedirectDiskDrives = Convert.ToBoolean(_sqlDataReader["InheritRedirectDiskDrives"]),
|
||||
RedirectKeys = Convert.ToBoolean(_sqlDataReader["InheritRedirectKeys"]),
|
||||
RedirectPorts = Convert.ToBoolean(_sqlDataReader["InheritRedirectPorts"]),
|
||||
RedirectPrinters = Convert.ToBoolean(_sqlDataReader["InheritRedirectPrinters"]),
|
||||
RedirectSmartCards = Convert.ToBoolean(_sqlDataReader["InheritRedirectSmartCards"]),
|
||||
RedirectSound = Convert.ToBoolean(_sqlDataReader["InheritRedirectSound"]),
|
||||
Resolution = Convert.ToBoolean(_sqlDataReader["InheritResolution"]),
|
||||
UseConsoleSession = Convert.ToBoolean(_sqlDataReader["InheritUseConsoleSession"]),
|
||||
Username = Convert.ToBoolean(_sqlDataReader["InheritUsername"])
|
||||
};
|
||||
|
||||
if (_confVersion > 1.5) //1.6
|
||||
{
|
||||
connectionInfo.ICAEncryption = (ProtocolICA.EncryptionStrength)Tools.MiscTools.StringToEnum(typeof(ProtocolICA.EncryptionStrength), Convert.ToString(_sqlDataReader["ICAEncryptionStrength"]));
|
||||
connectionInfo.Inheritance.ICAEncryption = Convert.ToBoolean(_sqlDataReader["InheritICAEncryptionStrength"]);
|
||||
connectionInfo.PreExtApp = Convert.ToString(_sqlDataReader["PreExtApp"]);
|
||||
connectionInfo.PostExtApp = Convert.ToString(_sqlDataReader["PostExtApp"]);
|
||||
connectionInfo.Inheritance.PreExtApp = Convert.ToBoolean(_sqlDataReader["InheritPreExtApp"]);
|
||||
connectionInfo.Inheritance.PostExtApp = Convert.ToBoolean(_sqlDataReader["InheritPostExtApp"]);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.6) //1.7
|
||||
{
|
||||
connectionInfo.VNCCompression = (ProtocolVNC.Compression)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Compression), Convert.ToString(_sqlDataReader["VNCCompression"]));
|
||||
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Encoding), Convert.ToString(_sqlDataReader["VNCEncoding"]));
|
||||
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.AuthMode), Convert.ToString(_sqlDataReader["VNCAuthMode"]));
|
||||
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.ProxyType), Convert.ToString(_sqlDataReader["VNCProxyType"]));
|
||||
connectionInfo.VNCProxyIP = Convert.ToString(_sqlDataReader["VNCProxyIP"]);
|
||||
connectionInfo.VNCProxyPort = Convert.ToInt32(_sqlDataReader["VNCProxyPort"]);
|
||||
connectionInfo.VNCProxyUsername = Convert.ToString(_sqlDataReader["VNCProxyUsername"]);
|
||||
connectionInfo.VNCProxyPassword = cryptographyProvider.Decrypt(Convert.ToString(_sqlDataReader["VNCProxyPassword"]), _pW);
|
||||
connectionInfo.VNCColors = (ProtocolVNC.Colors)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Colors), Convert.ToString(_sqlDataReader["VNCColors"]));
|
||||
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.SmartSizeMode), Convert.ToString(_sqlDataReader["VNCSmartSizeMode"]));
|
||||
connectionInfo.VNCViewOnly = Convert.ToBoolean(_sqlDataReader["VNCViewOnly"]);
|
||||
connectionInfo.Inheritance.VNCCompression = Convert.ToBoolean(_sqlDataReader["InheritVNCCompression"]);
|
||||
connectionInfo.Inheritance.VNCEncoding = Convert.ToBoolean(_sqlDataReader["InheritVNCEncoding"]);
|
||||
connectionInfo.Inheritance.VNCAuthMode = Convert.ToBoolean(_sqlDataReader["InheritVNCAuthMode"]);
|
||||
connectionInfo.Inheritance.VNCProxyType = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyType"]);
|
||||
connectionInfo.Inheritance.VNCProxyIP = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyIP"]);
|
||||
connectionInfo.Inheritance.VNCProxyPort = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyPort"]);
|
||||
connectionInfo.Inheritance.VNCProxyUsername = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyUsername"]);
|
||||
connectionInfo.Inheritance.VNCProxyPassword = Convert.ToBoolean(_sqlDataReader["InheritVNCProxyPassword"]);
|
||||
connectionInfo.Inheritance.VNCColors = Convert.ToBoolean(_sqlDataReader["InheritVNCColors"]);
|
||||
connectionInfo.Inheritance.VNCSmartSizeMode = Convert.ToBoolean(_sqlDataReader["InheritVNCSmartSizeMode"]);
|
||||
connectionInfo.Inheritance.VNCViewOnly = Convert.ToBoolean(_sqlDataReader["InheritVNCViewOnly"]);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.7) //1.8
|
||||
{
|
||||
connectionInfo.RDPAuthenticationLevel = (ProtocolRDP.AuthenticationLevel)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.AuthenticationLevel), Convert.ToString(_sqlDataReader["RDPAuthenticationLevel"]));
|
||||
connectionInfo.Inheritance.RDPAuthenticationLevel = Convert.ToBoolean(_sqlDataReader["InheritRDPAuthenticationLevel"]);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.8) //1.9
|
||||
{
|
||||
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Tools.MiscTools.StringToEnum(typeof(HTTPBase.RenderingEngine), Convert.ToString(_sqlDataReader["RenderingEngine"]));
|
||||
connectionInfo.MacAddress = Convert.ToString(_sqlDataReader["MacAddress"]);
|
||||
connectionInfo.Inheritance.RenderingEngine = Convert.ToBoolean(_sqlDataReader["InheritRenderingEngine"]);
|
||||
connectionInfo.Inheritance.MacAddress = Convert.ToBoolean(_sqlDataReader["InheritMacAddress"]);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.9) //2.0
|
||||
{
|
||||
connectionInfo.UserField = Convert.ToString(_sqlDataReader["UserField"]);
|
||||
connectionInfo.Inheritance.UserField = Convert.ToBoolean(_sqlDataReader["InheritUserField"]);
|
||||
}
|
||||
|
||||
if (_confVersion > 2.0) //2.1
|
||||
{
|
||||
connectionInfo.ExtApp = Convert.ToString(_sqlDataReader["ExtApp"]);
|
||||
connectionInfo.Inheritance.ExtApp = Convert.ToBoolean(_sqlDataReader["InheritExtApp"]);
|
||||
}
|
||||
|
||||
if (_confVersion >= 2.2)
|
||||
{
|
||||
connectionInfo.RDGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUsageMethod), Convert.ToString(_sqlDataReader["RDGatewayUsageMethod"]));
|
||||
connectionInfo.RDGatewayHostname = Convert.ToString(_sqlDataReader["RDGatewayHostname"]);
|
||||
connectionInfo.RDGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), Convert.ToString(_sqlDataReader["RDGatewayUseConnectionCredentials"]));
|
||||
connectionInfo.RDGatewayUsername = Convert.ToString(_sqlDataReader["RDGatewayUsername"]);
|
||||
connectionInfo.RDGatewayPassword = cryptographyProvider.Decrypt(Convert.ToString(_sqlDataReader["RDGatewayPassword"]), _pW);
|
||||
connectionInfo.RDGatewayDomain = Convert.ToString(_sqlDataReader["RDGatewayDomain"]);
|
||||
connectionInfo.Inheritance.RDGatewayUsageMethod = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayUsageMethod"]);
|
||||
connectionInfo.Inheritance.RDGatewayHostname = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayHostname"]);
|
||||
connectionInfo.Inheritance.RDGatewayUsername = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayUsername"]);
|
||||
connectionInfo.Inheritance.RDGatewayPassword = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayPassword"]);
|
||||
connectionInfo.Inheritance.RDGatewayDomain = Convert.ToBoolean(_sqlDataReader["InheritRDGatewayDomain"]);
|
||||
}
|
||||
|
||||
if (_confVersion >= 2.3)
|
||||
{
|
||||
connectionInfo.EnableFontSmoothing = Convert.ToBoolean(_sqlDataReader["EnableFontSmoothing"]);
|
||||
connectionInfo.EnableDesktopComposition = Convert.ToBoolean(_sqlDataReader["EnableDesktopComposition"]);
|
||||
connectionInfo.Inheritance.EnableFontSmoothing = Convert.ToBoolean(_sqlDataReader["InheritEnableFontSmoothing"]);
|
||||
connectionInfo.Inheritance.EnableDesktopComposition = Convert.ToBoolean(_sqlDataReader["InheritEnableDesktopComposition"]);
|
||||
}
|
||||
|
||||
if (_confVersion >= 2.4)
|
||||
{
|
||||
connectionInfo.UseCredSsp = Convert.ToBoolean(_sqlDataReader["UseCredSsp"]);
|
||||
connectionInfo.Inheritance.UseCredSsp = Convert.ToBoolean(_sqlDataReader["InheritUseCredSsp"]);
|
||||
}
|
||||
|
||||
if (_confVersion >= 2.5)
|
||||
{
|
||||
connectionInfo.LoadBalanceInfo = Convert.ToString(_sqlDataReader["LoadBalanceInfo"]);
|
||||
connectionInfo.AutomaticResize = Convert.ToBoolean(_sqlDataReader["AutomaticResize"]);
|
||||
connectionInfo.Inheritance.LoadBalanceInfo = Convert.ToBoolean(_sqlDataReader["InheritLoadBalanceInfo"]);
|
||||
connectionInfo.Inheritance.AutomaticResize = Convert.ToBoolean(_sqlDataReader["InheritAutomaticResize"]);
|
||||
}
|
||||
|
||||
if (DatabaseUpdate)
|
||||
connectionInfo.PleaseConnect = Convert.ToBoolean(_sqlDataReader["Connected"]);
|
||||
|
||||
return connectionInfo;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strGetConnectionInfoFromSqlFailed + Environment.NewLine + ex.Message, true);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private delegate void SetSelectedNodeDelegate(TreeNode treeNode);
|
||||
private static void SetSelectedNode(TreeNode treeNode)
|
||||
{
|
||||
if (ConnectionTree.TreeView != null && ConnectionTree.TreeView.InvokeRequired)
|
||||
{
|
||||
Windows.treeForm.Invoke(new SetSelectedNodeDelegate(SetSelectedNode), treeNode);
|
||||
return;
|
||||
}
|
||||
Windows.treeForm.tvConnections.SelectedNode = treeNode;
|
||||
}
|
||||
|
||||
private bool Authenticate(string value, bool compareToOriginalValue, RootNodeInfo rootInfo = null)
|
||||
{
|
||||
var passwordName = "";
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
passwordName = Language.strSQLServer.TrimEnd(':');
|
||||
|
||||
|
||||
if (compareToOriginalValue)
|
||||
{
|
||||
while (cryptographyProvider.Decrypt(value, _pW) == value)
|
||||
{
|
||||
_pW = Tools.MiscTools.PasswordDialog(passwordName, false);
|
||||
if (_pW.Length == 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (cryptographyProvider.Decrypt(value, _pW) != "ThisIsProtected")
|
||||
{
|
||||
_pW = Tools.MiscTools.PasswordDialog(passwordName, false);
|
||||
if (_pW.Length == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rootInfo == null) return true;
|
||||
rootInfo.Password = true;
|
||||
rootInfo.PasswordString = _pW.ConvertToUnsecureString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
648
mRemoteV1/Config/Connections/XmlConnectionsLoader.cs
Normal file
648
mRemoteV1/Config/Connections/XmlConnectionsLoader.cs
Normal file
@@ -0,0 +1,648 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Security;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.Connection.Protocol.Http;
|
||||
using mRemoteNG.Connection.Protocol.ICA;
|
||||
using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Connection.Protocol.VNC;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.Tree;
|
||||
using mRemoteNG.Tree.Root;
|
||||
using mRemoteNG.UI.Forms;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
|
||||
|
||||
namespace mRemoteNG.Config.Connections
|
||||
{
|
||||
public class XmlConnectionsLoader
|
||||
{
|
||||
private XmlDocument _xmlDocument;
|
||||
private double _confVersion;
|
||||
private SecureString _pW = GeneralAppInfo.EncryptionKey;
|
||||
private ContainerInfo _previousContainer;
|
||||
|
||||
|
||||
|
||||
public string ConnectionFileName { get; set; }
|
||||
public TreeNode RootTreeNode { get; set; }
|
||||
public ConnectionList ConnectionList { get; set; }
|
||||
public ContainerList ContainerList { get; set; }
|
||||
|
||||
|
||||
public void LoadFromXml(bool import)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!import)
|
||||
Runtime.IsConnectionsFileLoaded = false;
|
||||
|
||||
|
||||
// SECTION 1. Create a DOM Document and load the XML data into it.
|
||||
LoadXmlConnectionData();
|
||||
ValidateConnectionFileVersion();
|
||||
|
||||
// SECTION 2. Initialize the treeview control.
|
||||
var rootInfo = InitializeRootNode();
|
||||
|
||||
if (!ConnectionsFileIsAuthentic(rootInfo)) return;
|
||||
|
||||
if (import && !IsExportFile())
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strCannotImportNormalSessionFile);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsExportFile())
|
||||
{
|
||||
RootTreeNode.ImageIndex = (int)TreeImageType.Root;
|
||||
RootTreeNode.SelectedImageIndex = (int)TreeImageType.Root;
|
||||
}
|
||||
|
||||
// SECTION 3. Populate the TreeView with the DOM nodes.
|
||||
PopulateTreeview();
|
||||
RootTreeNode.EnsureVisible();
|
||||
Windows.treeForm.InitialRefresh();
|
||||
SetSelectedNode(RootTreeNode);
|
||||
|
||||
//open connections from last mremote session
|
||||
OpenConnectionsFromLastSession();
|
||||
|
||||
|
||||
if (!import)
|
||||
Runtime.IsConnectionsFileLoaded = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.IsConnectionsFileLoaded = false;
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strLoadFromXmlFailed + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace, true);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ConnectionsFileIsAuthentic(RootNodeInfo rootInfo)
|
||||
{
|
||||
if (!(_confVersion > 1.3)) return true;
|
||||
var protectedString = _xmlDocument.DocumentElement.Attributes["Protected"].Value;
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
var connectionsFileIsNotEncrypted = cryptographyProvider.Decrypt(protectedString, _pW) == "ThisIsNotProtected";
|
||||
if (connectionsFileIsNotEncrypted) return true;
|
||||
if (Authenticate(protectedString, false, rootInfo)) return true;
|
||||
mRemoteNG.Settings.Default.LoadConsFromCustomLocation = false;
|
||||
mRemoteNG.Settings.Default.CustomConsPath = "";
|
||||
RootTreeNode.Remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OpenConnectionsFromLastSession()
|
||||
{
|
||||
if (!mRemoteNG.Settings.Default.OpenConsFromLastSession || mRemoteNG.Settings.Default.NoReconnect) return;
|
||||
foreach (ConnectionInfo conI in ConnectionList)
|
||||
{
|
||||
if (conI.PleaseConnect)
|
||||
Runtime.OpenConnection(conI);
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulateTreeview()
|
||||
{
|
||||
Windows.treeForm.tvConnections.BeginUpdate();
|
||||
AddNodeFromXml(_xmlDocument.DocumentElement, RootTreeNode);
|
||||
RootTreeNode.Expand();
|
||||
ExpandPreviouslyOpenedFolders();
|
||||
Windows.treeForm.tvConnections.EndUpdate();
|
||||
}
|
||||
|
||||
private void AddNodeFromXml(XmlNode parentXmlNode, TreeNode parentTreeNode)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Loop through the XML nodes until the leaf is reached.
|
||||
// Add the nodes to the TreeView during the looping process.
|
||||
if (parentXmlNode.HasChildNodes)
|
||||
{
|
||||
foreach (XmlNode xmlNode in parentXmlNode.ChildNodes)
|
||||
{
|
||||
var treeNode = new TreeNode(xmlNode.Attributes?["Name"].Value);
|
||||
parentTreeNode.Nodes.Add(treeNode);
|
||||
var nodeType = ConnectionTreeNode.GetNodeTypeFromString(xmlNode.Attributes?["Type"].Value);
|
||||
|
||||
if (nodeType == TreeNodeType.Connection)
|
||||
AddConnectionToList(xmlNode, treeNode);
|
||||
else if (nodeType == TreeNodeType.Container)
|
||||
AddContainerToList(xmlNode, treeNode);
|
||||
|
||||
AddNodeFromXml(xmlNode, treeNode);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var nameAttribute = parentXmlNode.Attributes?["Name"];
|
||||
var nodeName = nameAttribute?.Value.Trim();
|
||||
parentTreeNode.Text = !string.IsNullOrEmpty(nodeName) ? nodeName : parentXmlNode.Name;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strAddNodeFromXmlFailed + Environment.NewLine + ex.Message + ex.StackTrace, true);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddConnectionToList(XmlNode xmlNode, TreeNode treeNode)
|
||||
{
|
||||
var connectionInfo = GetConnectionInfoFromXml(xmlNode);
|
||||
connectionInfo.TreeNode = treeNode;
|
||||
connectionInfo.Parent = _previousContainer; //NEW
|
||||
ConnectionList.Add(connectionInfo);
|
||||
treeNode.Tag = connectionInfo;
|
||||
treeNode.ImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
treeNode.SelectedImageIndex = (int)TreeImageType.ConnectionClosed;
|
||||
}
|
||||
|
||||
private void AddContainerToList(XmlNode xmlNode, TreeNode treeNode)
|
||||
{
|
||||
var containerInfo = new ContainerInfo();
|
||||
if (treeNode.Parent != null)
|
||||
{
|
||||
if (ConnectionTreeNode.GetNodeType(treeNode.Parent) == TreeNodeType.Container)
|
||||
containerInfo.Parent = (ContainerInfo) treeNode.Parent.Tag;
|
||||
}
|
||||
_previousContainer = containerInfo; //NEW
|
||||
containerInfo.TreeNode = treeNode;
|
||||
containerInfo.Name = xmlNode.Attributes["Name"].Value;
|
||||
|
||||
if (_confVersion >= 0.8)
|
||||
{
|
||||
containerInfo.IsExpanded = xmlNode.Attributes["Expanded"].Value == "True";
|
||||
}
|
||||
|
||||
var connectionInfo = _confVersion >= 0.9 ? GetConnectionInfoFromXml(xmlNode) : new ConnectionInfo();
|
||||
connectionInfo.Parent = containerInfo;
|
||||
connectionInfo.IsContainer = true;
|
||||
containerInfo.ConnectionInfo = connectionInfo;
|
||||
ContainerList.Add(containerInfo);
|
||||
treeNode.Tag = containerInfo;
|
||||
treeNode.ImageIndex = (int) TreeImageType.Container;
|
||||
treeNode.SelectedImageIndex = (int) TreeImageType.Container;
|
||||
}
|
||||
|
||||
private ConnectionInfo GetConnectionInfoFromXml(XmlNode xxNode)
|
||||
{
|
||||
var connectionInfo = new ConnectionInfo();
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
try
|
||||
{
|
||||
var xmlnode = xxNode;
|
||||
if (_confVersion > 0.1) //0.2
|
||||
{
|
||||
connectionInfo.Name = xmlnode.Attributes["Name"].Value;
|
||||
connectionInfo.Description = xmlnode.Attributes["Descr"].Value;
|
||||
connectionInfo.Hostname = xmlnode.Attributes["Hostname"].Value;
|
||||
connectionInfo.Username = xmlnode.Attributes["Username"].Value;
|
||||
connectionInfo.Password = cryptographyProvider.Decrypt(xmlnode.Attributes["Password"].Value, _pW);
|
||||
connectionInfo.Domain = xmlnode.Attributes["Domain"].Value;
|
||||
connectionInfo.DisplayWallpaper = bool.Parse(xmlnode.Attributes["DisplayWallpaper"].Value);
|
||||
connectionInfo.DisplayThemes = bool.Parse(xmlnode.Attributes["DisplayThemes"].Value);
|
||||
connectionInfo.CacheBitmaps = bool.Parse(xmlnode.Attributes["CacheBitmaps"].Value);
|
||||
|
||||
if (_confVersion < 1.1) //1.0 - 0.1
|
||||
{
|
||||
connectionInfo.Resolution = Convert.ToBoolean(xmlnode.Attributes["Fullscreen"].Value) ? ProtocolRDP.RDPResolutions.Fullscreen : ProtocolRDP.RDPResolutions.FitToWindow;
|
||||
}
|
||||
}
|
||||
|
||||
if (_confVersion > 0.2) //0.3
|
||||
{
|
||||
if (_confVersion < 0.7)
|
||||
{
|
||||
if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value))
|
||||
{
|
||||
connectionInfo.Protocol = ProtocolType.VNC;
|
||||
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionInfo.Protocol = ProtocolType.RDP;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionInfo.Port = (int)ProtocolRDP.Defaults.Port;
|
||||
connectionInfo.Protocol = ProtocolType.RDP;
|
||||
}
|
||||
|
||||
if (_confVersion > 0.3) //0.4
|
||||
{
|
||||
if (_confVersion < 0.7)
|
||||
{
|
||||
if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value))
|
||||
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["VNCPort"].Value);
|
||||
else
|
||||
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["RDPPort"].Value);
|
||||
}
|
||||
|
||||
connectionInfo.UseConsoleSession = bool.Parse(xmlnode.Attributes["ConnectToConsole"].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_confVersion < 0.7)
|
||||
{
|
||||
if (Convert.ToBoolean(xmlnode.Attributes["UseVNC"].Value))
|
||||
connectionInfo.Port = (int)ProtocolVNC.Defaults.Port;
|
||||
else
|
||||
connectionInfo.Port = (int)ProtocolRDP.Defaults.Port;
|
||||
}
|
||||
connectionInfo.UseConsoleSession = false;
|
||||
}
|
||||
|
||||
if (_confVersion > 0.4) //0.5 and 0.6
|
||||
{
|
||||
connectionInfo.RedirectDiskDrives = bool.Parse(xmlnode.Attributes["RedirectDiskDrives"].Value);
|
||||
connectionInfo.RedirectPrinters = bool.Parse(xmlnode.Attributes["RedirectPrinters"].Value);
|
||||
connectionInfo.RedirectPorts = bool.Parse(xmlnode.Attributes["RedirectPorts"].Value);
|
||||
connectionInfo.RedirectSmartCards = bool.Parse(xmlnode.Attributes["RedirectSmartCards"].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionInfo.RedirectDiskDrives = false;
|
||||
connectionInfo.RedirectPrinters = false;
|
||||
connectionInfo.RedirectPorts = false;
|
||||
connectionInfo.RedirectSmartCards = false;
|
||||
}
|
||||
|
||||
if (_confVersion > 0.6) //0.7
|
||||
{
|
||||
connectionInfo.Protocol = (ProtocolType)Tools.MiscTools.StringToEnum(typeof(ProtocolType), xmlnode.Attributes["Protocol"].Value);
|
||||
connectionInfo.Port = Convert.ToInt32(xmlnode.Attributes["Port"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 0.9) //1.0
|
||||
{
|
||||
connectionInfo.RedirectKeys = bool.Parse(xmlnode.Attributes["RedirectKeys"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.1) //1.2
|
||||
{
|
||||
connectionInfo.PuttySession = xmlnode.Attributes["PuttySession"].Value;
|
||||
}
|
||||
|
||||
if (_confVersion > 1.2) //1.3
|
||||
{
|
||||
connectionInfo.Colors = (ProtocolRDP.RDPColors)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPColors), xmlnode.Attributes["Colors"].Value);
|
||||
connectionInfo.Resolution = (ProtocolRDP.RDPResolutions)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPResolutions), Convert.ToString(xmlnode.Attributes["Resolution"].Value));
|
||||
connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDPSounds), Convert.ToString(xmlnode.Attributes["RedirectSound"].Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (Convert.ToInt32(xmlnode.Attributes["Colors"].Value))
|
||||
{
|
||||
case 0:
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors256;
|
||||
break;
|
||||
case 1:
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors16Bit;
|
||||
break;
|
||||
case 2:
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors24Bit;
|
||||
break;
|
||||
case 3:
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors32Bit;
|
||||
break;
|
||||
case 4:
|
||||
connectionInfo.Colors = ProtocolRDP.RDPColors.Colors15Bit;
|
||||
break;
|
||||
}
|
||||
|
||||
connectionInfo.RedirectSound = (ProtocolRDP.RDPSounds)Convert.ToInt32(xmlnode.Attributes["RedirectSound"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.2) //1.3
|
||||
{
|
||||
connectionInfo.Inheritance = new ConnectionInfoInheritance(connectionInfo)
|
||||
{
|
||||
CacheBitmaps = bool.Parse(xmlnode.Attributes["InheritCacheBitmaps"].Value),
|
||||
Colors = bool.Parse(xmlnode.Attributes["InheritColors"].Value),
|
||||
Description = bool.Parse(xmlnode.Attributes["InheritDescription"].Value),
|
||||
DisplayThemes = bool.Parse(xmlnode.Attributes["InheritDisplayThemes"].Value),
|
||||
DisplayWallpaper = bool.Parse(xmlnode.Attributes["InheritDisplayWallpaper"].Value),
|
||||
Domain = bool.Parse(xmlnode.Attributes["InheritDomain"].Value),
|
||||
Icon = bool.Parse(xmlnode.Attributes["InheritIcon"].Value),
|
||||
Panel = bool.Parse(xmlnode.Attributes["InheritPanel"].Value),
|
||||
Password = bool.Parse(xmlnode.Attributes["InheritPassword"].Value),
|
||||
Port = bool.Parse(xmlnode.Attributes["InheritPort"].Value),
|
||||
Protocol = bool.Parse(xmlnode.Attributes["InheritProtocol"].Value),
|
||||
PuttySession = bool.Parse(xmlnode.Attributes["InheritPuttySession"].Value),
|
||||
RedirectDiskDrives = bool.Parse(xmlnode.Attributes["InheritRedirectDiskDrives"].Value),
|
||||
RedirectKeys = bool.Parse(xmlnode.Attributes["InheritRedirectKeys"].Value),
|
||||
RedirectPorts = bool.Parse(xmlnode.Attributes["InheritRedirectPorts"].Value),
|
||||
RedirectPrinters = bool.Parse(xmlnode.Attributes["InheritRedirectPrinters"].Value),
|
||||
RedirectSmartCards = bool.Parse(xmlnode.Attributes["InheritRedirectSmartCards"].Value),
|
||||
RedirectSound = bool.Parse(xmlnode.Attributes["InheritRedirectSound"].Value),
|
||||
Resolution = bool.Parse(xmlnode.Attributes["InheritResolution"].Value),
|
||||
UseConsoleSession = bool.Parse(xmlnode.Attributes["InheritUseConsoleSession"].Value),
|
||||
Username = bool.Parse(xmlnode.Attributes["InheritUsername"].Value)
|
||||
};
|
||||
connectionInfo.Icon = xmlnode.Attributes["Icon"].Value;
|
||||
connectionInfo.Panel = xmlnode.Attributes["Panel"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionInfo.Inheritance = new ConnectionInfoInheritance(connectionInfo, Convert.ToBoolean(xmlnode.Attributes["Inherit"].Value));
|
||||
connectionInfo.Icon = Convert.ToString(xmlnode.Attributes["Icon"].Value.Replace(".ico", ""));
|
||||
connectionInfo.Panel = Language.strGeneral;
|
||||
}
|
||||
|
||||
if (_confVersion > 1.4) //1.5
|
||||
{
|
||||
connectionInfo.PleaseConnect = bool.Parse(xmlnode.Attributes["Connected"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.5) //1.6
|
||||
{
|
||||
connectionInfo.ICAEncryption = (ProtocolICA.EncryptionStrength)Tools.MiscTools.StringToEnum(typeof(ProtocolICA.EncryptionStrength), xmlnode.Attributes["ICAEncryptionStrength"].Value);
|
||||
connectionInfo.Inheritance.ICAEncryption = bool.Parse(xmlnode.Attributes["InheritICAEncryptionStrength"].Value);
|
||||
connectionInfo.PreExtApp = xmlnode.Attributes["PreExtApp"].Value;
|
||||
connectionInfo.PostExtApp = xmlnode.Attributes["PostExtApp"].Value;
|
||||
connectionInfo.Inheritance.PreExtApp = bool.Parse(xmlnode.Attributes["InheritPreExtApp"].Value);
|
||||
connectionInfo.Inheritance.PostExtApp = bool.Parse(xmlnode.Attributes["InheritPostExtApp"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.6) //1.7
|
||||
{
|
||||
connectionInfo.VNCCompression = (ProtocolVNC.Compression)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Compression), xmlnode.Attributes["VNCCompression"].Value);
|
||||
connectionInfo.VNCEncoding = (ProtocolVNC.Encoding)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Encoding), Convert.ToString(xmlnode.Attributes["VNCEncoding"].Value));
|
||||
connectionInfo.VNCAuthMode = (ProtocolVNC.AuthMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.AuthMode), xmlnode.Attributes["VNCAuthMode"].Value);
|
||||
connectionInfo.VNCProxyType = (ProtocolVNC.ProxyType)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.ProxyType), xmlnode.Attributes["VNCProxyType"].Value);
|
||||
connectionInfo.VNCProxyIP = xmlnode.Attributes["VNCProxyIP"].Value;
|
||||
connectionInfo.VNCProxyPort = Convert.ToInt32(xmlnode.Attributes["VNCProxyPort"].Value);
|
||||
connectionInfo.VNCProxyUsername = xmlnode.Attributes["VNCProxyUsername"].Value;
|
||||
connectionInfo.VNCProxyPassword = cryptographyProvider.Decrypt(xmlnode.Attributes["VNCProxyPassword"].Value, _pW);
|
||||
connectionInfo.VNCColors = (ProtocolVNC.Colors)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.Colors), xmlnode.Attributes["VNCColors"].Value);
|
||||
connectionInfo.VNCSmartSizeMode = (ProtocolVNC.SmartSizeMode)Tools.MiscTools.StringToEnum(typeof(ProtocolVNC.SmartSizeMode), xmlnode.Attributes["VNCSmartSizeMode"].Value);
|
||||
connectionInfo.VNCViewOnly = bool.Parse(xmlnode.Attributes["VNCViewOnly"].Value);
|
||||
connectionInfo.Inheritance.VNCCompression = bool.Parse(xmlnode.Attributes["InheritVNCCompression"].Value);
|
||||
connectionInfo.Inheritance.VNCEncoding = bool.Parse(xmlnode.Attributes["InheritVNCEncoding"].Value);
|
||||
connectionInfo.Inheritance.VNCAuthMode = bool.Parse(xmlnode.Attributes["InheritVNCAuthMode"].Value);
|
||||
connectionInfo.Inheritance.VNCProxyType = bool.Parse(xmlnode.Attributes["InheritVNCProxyType"].Value);
|
||||
connectionInfo.Inheritance.VNCProxyIP = bool.Parse(xmlnode.Attributes["InheritVNCProxyIP"].Value);
|
||||
connectionInfo.Inheritance.VNCProxyPort = bool.Parse(xmlnode.Attributes["InheritVNCProxyPort"].Value);
|
||||
connectionInfo.Inheritance.VNCProxyUsername = bool.Parse(xmlnode.Attributes["InheritVNCProxyUsername"].Value);
|
||||
connectionInfo.Inheritance.VNCProxyPassword = bool.Parse(xmlnode.Attributes["InheritVNCProxyPassword"].Value);
|
||||
connectionInfo.Inheritance.VNCColors = bool.Parse(xmlnode.Attributes["InheritVNCColors"].Value);
|
||||
connectionInfo.Inheritance.VNCSmartSizeMode = bool.Parse(xmlnode.Attributes["InheritVNCSmartSizeMode"].Value);
|
||||
connectionInfo.Inheritance.VNCViewOnly = bool.Parse(xmlnode.Attributes["InheritVNCViewOnly"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.7) //1.8
|
||||
{
|
||||
connectionInfo.RDPAuthenticationLevel = (ProtocolRDP.AuthenticationLevel)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.AuthenticationLevel), xmlnode.Attributes["RDPAuthenticationLevel"].Value);
|
||||
connectionInfo.Inheritance.RDPAuthenticationLevel = bool.Parse(xmlnode.Attributes["InheritRDPAuthenticationLevel"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.8) //1.9
|
||||
{
|
||||
connectionInfo.RenderingEngine = (HTTPBase.RenderingEngine)Tools.MiscTools.StringToEnum(typeof(HTTPBase.RenderingEngine), xmlnode.Attributes["RenderingEngine"].Value);
|
||||
connectionInfo.MacAddress = xmlnode.Attributes["MacAddress"].Value;
|
||||
connectionInfo.Inheritance.RenderingEngine = bool.Parse(xmlnode.Attributes["InheritRenderingEngine"].Value);
|
||||
connectionInfo.Inheritance.MacAddress = bool.Parse(xmlnode.Attributes["InheritMacAddress"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 1.9) //2.0
|
||||
{
|
||||
connectionInfo.UserField = xmlnode.Attributes["UserField"].Value;
|
||||
connectionInfo.Inheritance.UserField = bool.Parse(xmlnode.Attributes["InheritUserField"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 2.0) //2.1
|
||||
{
|
||||
connectionInfo.ExtApp = xmlnode.Attributes["ExtApp"].Value;
|
||||
connectionInfo.Inheritance.ExtApp = bool.Parse(xmlnode.Attributes["InheritExtApp"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 2.1) //2.2
|
||||
{
|
||||
// Get settings
|
||||
connectionInfo.RDGatewayUsageMethod = (ProtocolRDP.RDGatewayUsageMethod)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUsageMethod), Convert.ToString(xmlnode.Attributes["RDGatewayUsageMethod"].Value));
|
||||
connectionInfo.RDGatewayHostname = xmlnode.Attributes["RDGatewayHostname"].Value;
|
||||
connectionInfo.RDGatewayUseConnectionCredentials = (ProtocolRDP.RDGatewayUseConnectionCredentials)Tools.MiscTools.StringToEnum(typeof(ProtocolRDP.RDGatewayUseConnectionCredentials), Convert.ToString(xmlnode.Attributes["RDGatewayUseConnectionCredentials"].Value));
|
||||
connectionInfo.RDGatewayUsername = xmlnode.Attributes["RDGatewayUsername"].Value;
|
||||
connectionInfo.RDGatewayPassword = cryptographyProvider.Decrypt(Convert.ToString(xmlnode.Attributes["RDGatewayPassword"].Value), _pW);
|
||||
connectionInfo.RDGatewayDomain = xmlnode.Attributes["RDGatewayDomain"].Value;
|
||||
|
||||
// Get inheritance settings
|
||||
connectionInfo.Inheritance.RDGatewayUsageMethod = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsageMethod"].Value);
|
||||
connectionInfo.Inheritance.RDGatewayHostname = bool.Parse(xmlnode.Attributes["InheritRDGatewayHostname"].Value);
|
||||
connectionInfo.Inheritance.RDGatewayUseConnectionCredentials = bool.Parse(xmlnode.Attributes["InheritRDGatewayUseConnectionCredentials"].Value);
|
||||
connectionInfo.Inheritance.RDGatewayUsername = bool.Parse(xmlnode.Attributes["InheritRDGatewayUsername"].Value);
|
||||
connectionInfo.Inheritance.RDGatewayPassword = bool.Parse(xmlnode.Attributes["InheritRDGatewayPassword"].Value);
|
||||
connectionInfo.Inheritance.RDGatewayDomain = bool.Parse(xmlnode.Attributes["InheritRDGatewayDomain"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion > 2.2) //2.3
|
||||
{
|
||||
// Get settings
|
||||
connectionInfo.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["EnableFontSmoothing"].Value);
|
||||
connectionInfo.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["EnableDesktopComposition"].Value);
|
||||
|
||||
// Get inheritance settings
|
||||
connectionInfo.Inheritance.EnableFontSmoothing = bool.Parse(xmlnode.Attributes["InheritEnableFontSmoothing"].Value);
|
||||
connectionInfo.Inheritance.EnableDesktopComposition = bool.Parse(xmlnode.Attributes["InheritEnableDesktopComposition"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion >= 2.4)
|
||||
{
|
||||
connectionInfo.UseCredSsp = bool.Parse(xmlnode.Attributes["UseCredSsp"].Value);
|
||||
connectionInfo.Inheritance.UseCredSsp = bool.Parse(xmlnode.Attributes["InheritUseCredSsp"].Value);
|
||||
}
|
||||
|
||||
if (_confVersion >= 2.5)
|
||||
{
|
||||
connectionInfo.LoadBalanceInfo = xmlnode.Attributes["LoadBalanceInfo"].Value;
|
||||
connectionInfo.AutomaticResize = bool.Parse(xmlnode.Attributes["AutomaticResize"].Value);
|
||||
connectionInfo.Inheritance.LoadBalanceInfo = bool.Parse(xmlnode.Attributes["InheritLoadBalanceInfo"].Value);
|
||||
connectionInfo.Inheritance.AutomaticResize = bool.Parse(xmlnode.Attributes["InheritAutomaticResize"].Value);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.strGetConnectionInfoFromXmlFailed, connectionInfo.Name, ConnectionFileName, ex.Message));
|
||||
}
|
||||
return connectionInfo;
|
||||
}
|
||||
|
||||
|
||||
private void ExpandPreviouslyOpenedFolders()
|
||||
{
|
||||
foreach (ContainerInfo contI in ContainerList)
|
||||
{
|
||||
if (contI.IsExpanded)
|
||||
contI.TreeNode.Expand();
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsExportFile()
|
||||
{
|
||||
var isExportFile = false;
|
||||
if (!(_confVersion >= 1.0)) return isExportFile;
|
||||
if (Convert.ToBoolean(_xmlDocument.DocumentElement.Attributes["Export"].Value))
|
||||
isExportFile = true;
|
||||
return isExportFile;
|
||||
}
|
||||
|
||||
private RootNodeInfo InitializeRootNode()
|
||||
{
|
||||
var rootNodeName = "";
|
||||
if (_xmlDocument.DocumentElement.HasAttribute("Name"))
|
||||
rootNodeName = Convert.ToString(_xmlDocument.DocumentElement.Attributes["Name"].Value.Trim());
|
||||
RootTreeNode.Name = !string.IsNullOrEmpty(rootNodeName) ? rootNodeName : _xmlDocument.DocumentElement.Name;
|
||||
RootTreeNode.Text = RootTreeNode.Name;
|
||||
|
||||
var rootInfo = new RootNodeInfo(RootNodeType.Connection)
|
||||
{
|
||||
Name = RootTreeNode.Name,
|
||||
TreeNode = RootTreeNode
|
||||
};
|
||||
RootTreeNode.Tag = rootInfo;
|
||||
return rootInfo;
|
||||
}
|
||||
|
||||
private void LoadXmlConnectionData()
|
||||
{
|
||||
var connections = DecryptCompleteFile();
|
||||
_xmlDocument = new XmlDocument();
|
||||
if (connections != "")
|
||||
_xmlDocument.LoadXml(connections);
|
||||
else
|
||||
_xmlDocument.Load(ConnectionFileName);
|
||||
}
|
||||
|
||||
private void ValidateConnectionFileVersion()
|
||||
{
|
||||
if (_xmlDocument.DocumentElement.HasAttribute("ConfVersion"))
|
||||
_confVersion = Convert.ToDouble(_xmlDocument.DocumentElement.Attributes["ConfVersion"].Value.Replace(",", "."),
|
||||
CultureInfo.InvariantCulture);
|
||||
else
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.WarningMsg, Language.strOldConffile);
|
||||
|
||||
const double maxSupportedConfVersion = 2.5;
|
||||
if (!(_confVersion > maxSupportedConfVersion)) return;
|
||||
CTaskDialog.ShowTaskDialogBox(
|
||||
frmMain.Default,
|
||||
Application.ProductName,
|
||||
"Incompatible connection file format",
|
||||
$"The format of this connection file is not supported. Please upgrade to a newer version of {Application.ProductName}.",
|
||||
string.Format("{1}{0}File Format Version: {2}{0}Highest Supported Version: {3}", Environment.NewLine,
|
||||
ConnectionFileName, _confVersion, maxSupportedConfVersion),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
ETaskDialogButtons.Ok,
|
||||
ESysIcons.Error,
|
||||
ESysIcons.Error
|
||||
);
|
||||
throw (new Exception($"Incompatible connection file format (file format version {_confVersion})."));
|
||||
}
|
||||
|
||||
private delegate void SetSelectedNodeDelegate(TreeNode treeNode);
|
||||
private static void SetSelectedNode(TreeNode treeNode)
|
||||
{
|
||||
if (ConnectionTree.TreeView != null && ConnectionTree.TreeView.InvokeRequired)
|
||||
{
|
||||
Windows.treeForm.Invoke(new SetSelectedNodeDelegate(SetSelectedNode), treeNode);
|
||||
return;
|
||||
}
|
||||
Windows.treeForm.tvConnections.SelectedNode = treeNode;
|
||||
}
|
||||
|
||||
private string DecryptCompleteFile()
|
||||
{
|
||||
var sRd = new StreamReader(ConnectionFileName);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
var strCons = "";
|
||||
strCons = sRd.ReadToEnd();
|
||||
sRd.Close();
|
||||
|
||||
if (string.IsNullOrEmpty(strCons)) return "";
|
||||
var strDecr = "";
|
||||
bool notDecr;
|
||||
|
||||
if (strCons.Contains("<?xml version=\"1.0\" encoding=\"utf-8\"?>"))
|
||||
{
|
||||
strDecr = strCons;
|
||||
return strDecr;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
strDecr = cryptographyProvider.Decrypt(strCons, _pW);
|
||||
notDecr = strDecr == strCons;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
notDecr = true;
|
||||
}
|
||||
|
||||
if (notDecr)
|
||||
{
|
||||
if (Authenticate(strCons, true))
|
||||
{
|
||||
strDecr = cryptographyProvider.Decrypt(strCons, _pW);
|
||||
notDecr = false;
|
||||
}
|
||||
|
||||
if (notDecr == false)
|
||||
return strDecr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return strDecr;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private bool Authenticate(string value, bool compareToOriginalValue, RootNodeInfo rootInfo = null)
|
||||
{
|
||||
var passwordName = "";
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
passwordName = Path.GetFileName(ConnectionFileName);
|
||||
|
||||
if (compareToOriginalValue)
|
||||
{
|
||||
while (cryptographyProvider.Decrypt(value, _pW) == value)
|
||||
{
|
||||
_pW = Tools.MiscTools.PasswordDialog(passwordName, false);
|
||||
if (_pW.Length == 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (cryptographyProvider.Decrypt(value, _pW) != "ThisIsProtected")
|
||||
{
|
||||
_pW = Tools.MiscTools.PasswordDialog(passwordName, false);
|
||||
if (_pW.Length == 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rootInfo == null) return true;
|
||||
rootInfo.Password = true;
|
||||
rootInfo.PasswordString = _pW.ConvertToUnsecureString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ using System.Globalization;
|
||||
using mRemoteNG.Themes;
|
||||
using mRemoteNG.Connection.Protocol;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.UI.Forms;
|
||||
|
||||
|
||||
@@ -67,7 +69,8 @@ namespace mRemoteNG.Config.Settings
|
||||
|
||||
private static void SetConDefaultPassword()
|
||||
{
|
||||
mRemoteNG.Settings.Default.ConDefaultPassword = Security.Crypt.Decrypt(mRemoteNG.Settings.Default.ConDefaultPassword, GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
mRemoteNG.Settings.Default.ConDefaultPassword = cryptographyProvider.Decrypt(mRemoteNG.Settings.Default.ConDefaultPassword, GeneralAppInfo.EncryptionKey);
|
||||
}
|
||||
|
||||
private static void SetAlwaysShowPanelTabs()
|
||||
|
||||
@@ -7,6 +7,7 @@ using mRemoteNG.App;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.UI.Forms;
|
||||
|
||||
@@ -62,8 +63,9 @@ namespace mRemoteNG.Config.Settings
|
||||
}
|
||||
mRemoteNG.Settings.Default.QuickyTBVisible = with1.tsQuickConnect.Visible;
|
||||
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
mRemoteNG.Settings.Default.ConDefaultPassword =
|
||||
Crypt.Encrypt(Convert.ToString(mRemoteNG.Settings.Default.ConDefaultPassword), GeneralAppInfo.EncryptionKey);
|
||||
cryptographyProvider.Encrypt(Convert.ToString(mRemoteNG.Settings.Default.ConDefaultPassword), GeneralAppInfo.EncryptionKey);
|
||||
|
||||
mRemoteNG.Settings.Default.Save();
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using mRemoteNG.App.Info;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
|
||||
namespace mRemoteNG.Config
|
||||
{
|
||||
@@ -54,7 +56,8 @@ namespace mRemoteNG.Config
|
||||
_sqlHost = mRemoteNG.Settings.Default.SQLHost;
|
||||
_sqlCatalog = mRemoteNG.Settings.Default.SQLDatabaseName;
|
||||
_sqlUsername = mRemoteNG.Settings.Default.SQLUser;
|
||||
_sqlPassword = Security.Crypt.Decrypt(mRemoteNG.Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
_sqlPassword = cryptographyProvider.Decrypt(mRemoteNG.Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey);
|
||||
}
|
||||
|
||||
public void Connect()
|
||||
|
||||
@@ -4,8 +4,11 @@ using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using System.Threading;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.Connection.Protocol.RDP;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.UI.Forms;
|
||||
|
||||
|
||||
@@ -172,7 +175,8 @@ namespace mRemoteNG.Connection.Protocol.ICA
|
||||
{
|
||||
if (mRemoteNG.Settings.Default.DefaultPassword != "")
|
||||
{
|
||||
_ICAClient.SetProp("ClearPassword", Security.Crypt.Decrypt(Convert.ToString(mRemoteNG.Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey));
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
_ICAClient.SetProp("ClearPassword", cryptographyProvider.Decrypt(Settings.Default.DefaultPassword, GeneralAppInfo.EncryptionKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Connection;
|
||||
|
||||
|
||||
namespace mRemoteNG.Connection.Protocol
|
||||
@@ -10,12 +9,10 @@ namespace mRemoteNG.Connection.Protocol
|
||||
public abstract class ProtocolBase
|
||||
{
|
||||
#region Private Variables
|
||||
private string _Name;
|
||||
private UI.Window.ConnectionWindow _connectionWindow;
|
||||
|
||||
private UI.Window.ConnectionWindow _connectionWindow;
|
||||
private InterfaceControl _interfaceControl;
|
||||
private Control _Control;
|
||||
private ConnectionInfo.Force _Force;
|
||||
private ConnectingEventHandler ConnectingEvent;
|
||||
private ConnectingEventHandler ConnectingEvent;
|
||||
private ConnectedEventHandler ConnectedEvent;
|
||||
private DisconnectedEventHandler DisconnectedEvent;
|
||||
private ErrorOccuredEventHandler ErrorOccuredEvent;
|
||||
@@ -25,13 +22,9 @@ namespace mRemoteNG.Connection.Protocol
|
||||
|
||||
#region Public Properties
|
||||
#region Control
|
||||
public string Name
|
||||
{
|
||||
get { return this._Name; }
|
||||
set { this._Name = value; }
|
||||
}
|
||||
|
||||
public UI.Window.ConnectionWindow ConnectionWindow
|
||||
public string Name { get; set; }
|
||||
|
||||
protected UI.Window.ConnectionWindow ConnectionWindow
|
||||
{
|
||||
get { return _connectionWindow; }
|
||||
set
|
||||
@@ -52,22 +45,15 @@ namespace mRemoteNG.Connection.Protocol
|
||||
ConnectionWindow = _interfaceControl.GetContainerControl() as UI.Window.ConnectionWindow;
|
||||
}
|
||||
}
|
||||
|
||||
public Control Control
|
||||
{
|
||||
get { return this._Control; }
|
||||
set { this._Control = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public ConnectionInfo.Force Force
|
||||
{
|
||||
get { return this._Force; }
|
||||
set { this._Force = value; }
|
||||
}
|
||||
|
||||
public System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
|
||||
public ReconnectGroup ReconnectGroup;
|
||||
|
||||
protected Control Control { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public ConnectionInfo.Force Force { get; set; }
|
||||
|
||||
public readonly System.Timers.Timer tmrReconnect = new System.Timers.Timer(2000);
|
||||
protected ReconnectGroup ReconnectGroup;
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
@@ -77,23 +63,23 @@ namespace mRemoteNG.Connection.Protocol
|
||||
{
|
||||
try
|
||||
{
|
||||
this._Control.Focus();
|
||||
Control.Focus();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t focus Control (Connection.Protocol.Base)" + Environment.NewLine + ex.Message, true);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ResizeBegin(System.Object sender, EventArgs e)
|
||||
|
||||
public virtual void ResizeBegin(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void Resize(System.Object sender, EventArgs e)
|
||||
|
||||
public virtual void Resize(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ResizeEnd(System.Object sender, EventArgs e)
|
||||
|
||||
public virtual void ResizeEnd(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -101,19 +87,17 @@ namespace mRemoteNG.Connection.Protocol
|
||||
{
|
||||
try
|
||||
{
|
||||
this._interfaceControl.Parent.Tag = this._interfaceControl;
|
||||
this._interfaceControl.Show();
|
||||
|
||||
if (this._Control != null)
|
||||
{
|
||||
this._Control.Name = this._Name;
|
||||
this._Control.Parent = this._interfaceControl;
|
||||
this._Control.Location = this._interfaceControl.Location;
|
||||
this._Control.Size = this.InterfaceControl.Size;
|
||||
this._Control.Anchor = this._interfaceControl.Anchor;
|
||||
}
|
||||
|
||||
return true;
|
||||
_interfaceControl.Parent.Tag = _interfaceControl;
|
||||
_interfaceControl.Show();
|
||||
|
||||
if (Control == null) return true;
|
||||
Control.Name = Name;
|
||||
Control.Parent = _interfaceControl;
|
||||
Control.Location = _interfaceControl.Location;
|
||||
Control.Size = InterfaceControl.Size;
|
||||
Control.Anchor = _interfaceControl.Anchor;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -124,45 +108,37 @@ namespace mRemoteNG.Connection.Protocol
|
||||
|
||||
public virtual bool Connect()
|
||||
{
|
||||
if (InterfaceControl.Info.Protocol != ProtocolType.RDP)
|
||||
{
|
||||
if (ConnectedEvent != null)
|
||||
{
|
||||
ConnectedEvent(this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (InterfaceControl.Info.Protocol == ProtocolType.RDP) return false;
|
||||
if (ConnectedEvent == null) return false;
|
||||
ConnectedEvent(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual void Disconnect()
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
|
||||
public virtual void Close()
|
||||
{
|
||||
Thread t = new Thread(new System.Threading.ThreadStart(CloseBG));
|
||||
t.SetApartmentState(System.Threading.ApartmentState.STA);
|
||||
Thread t = new Thread(CloseBG);
|
||||
t.SetApartmentState(ApartmentState.STA);
|
||||
t.IsBackground = true;
|
||||
t.Start();
|
||||
}
|
||||
|
||||
private void CloseBG()
|
||||
{
|
||||
if (ClosedEvent != null)
|
||||
{
|
||||
ClosedEvent(this);
|
||||
}
|
||||
try
|
||||
ClosedEvent?.Invoke(this);
|
||||
try
|
||||
{
|
||||
tmrReconnect.Enabled = false;
|
||||
|
||||
if (this._Control != null)
|
||||
if (Control != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.DisposeControl();
|
||||
DisposeControl();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -170,19 +146,17 @@ namespace mRemoteNG.Connection.Protocol
|
||||
}
|
||||
}
|
||||
|
||||
if (this._interfaceControl != null)
|
||||
if (_interfaceControl != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this._interfaceControl.Parent != null)
|
||||
{
|
||||
if (this._interfaceControl.Parent.Tag != null)
|
||||
{
|
||||
this.SetTagToNothing();
|
||||
}
|
||||
if (_interfaceControl.Parent == null) return;
|
||||
if (_interfaceControl.Parent.Tag != null)
|
||||
{
|
||||
SetTagToNothing();
|
||||
}
|
||||
|
||||
this.DisposeInterface();
|
||||
}
|
||||
DisposeInterface();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -199,42 +173,42 @@ namespace mRemoteNG.Connection.Protocol
|
||||
private delegate void DisposeInterfaceCB();
|
||||
private void DisposeInterface()
|
||||
{
|
||||
if (this._interfaceControl.InvokeRequired)
|
||||
if (_interfaceControl.InvokeRequired)
|
||||
{
|
||||
DisposeInterfaceCB s = new DisposeInterfaceCB(DisposeInterface);
|
||||
this._interfaceControl.Invoke(s);
|
||||
_interfaceControl.Invoke(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._interfaceControl.Dispose();
|
||||
_interfaceControl.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private delegate void SetTagToNothingCB();
|
||||
private void SetTagToNothing()
|
||||
{
|
||||
if (this._interfaceControl.Parent.InvokeRequired)
|
||||
if (_interfaceControl.Parent.InvokeRequired)
|
||||
{
|
||||
SetTagToNothingCB s = new SetTagToNothingCB(SetTagToNothing);
|
||||
this._interfaceControl.Parent.Invoke(s);
|
||||
_interfaceControl.Parent.Invoke(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._interfaceControl.Parent.Tag = null;
|
||||
_interfaceControl.Parent.Tag = null;
|
||||
}
|
||||
}
|
||||
|
||||
private delegate void DisposeControlCB();
|
||||
private void DisposeControl()
|
||||
{
|
||||
if (this._Control.InvokeRequired)
|
||||
if (Control.InvokeRequired)
|
||||
{
|
||||
DisposeControlCB s = new DisposeControlCB(DisposeControl);
|
||||
this._Control.Invoke(s);
|
||||
Control.Invoke(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._Control.Dispose();
|
||||
Control.Dispose();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -243,83 +217,77 @@ namespace mRemoteNG.Connection.Protocol
|
||||
public delegate void ConnectingEventHandler(object sender);
|
||||
public event ConnectingEventHandler Connecting
|
||||
{
|
||||
add { ConnectingEvent = (ConnectingEventHandler) System.Delegate.Combine(ConnectingEvent, value); }
|
||||
remove { ConnectingEvent = (ConnectingEventHandler) System.Delegate.Remove(ConnectingEvent, value); }
|
||||
add { ConnectingEvent = (ConnectingEventHandler) Delegate.Combine(ConnectingEvent, value); }
|
||||
remove { ConnectingEvent = (ConnectingEventHandler) Delegate.Remove(ConnectingEvent, value); }
|
||||
}
|
||||
|
||||
public delegate void ConnectedEventHandler(object sender);
|
||||
public event ConnectedEventHandler Connected
|
||||
{
|
||||
add { ConnectedEvent = (ConnectedEventHandler) System.Delegate.Combine(ConnectedEvent, value); }
|
||||
remove { ConnectedEvent = (ConnectedEventHandler) System.Delegate.Remove(ConnectedEvent, value); }
|
||||
add { ConnectedEvent = (ConnectedEventHandler) Delegate.Combine(ConnectedEvent, value); }
|
||||
remove { ConnectedEvent = (ConnectedEventHandler) Delegate.Remove(ConnectedEvent, value); }
|
||||
}
|
||||
|
||||
public delegate void DisconnectedEventHandler(object sender, string DisconnectedMessage);
|
||||
public event DisconnectedEventHandler Disconnected
|
||||
{
|
||||
add { DisconnectedEvent = (DisconnectedEventHandler) System.Delegate.Combine(DisconnectedEvent, value); }
|
||||
remove { DisconnectedEvent = (DisconnectedEventHandler) System.Delegate.Remove(DisconnectedEvent, value); }
|
||||
add { DisconnectedEvent = (DisconnectedEventHandler) Delegate.Combine(DisconnectedEvent, value); }
|
||||
remove { DisconnectedEvent = (DisconnectedEventHandler) Delegate.Remove(DisconnectedEvent, value); }
|
||||
}
|
||||
|
||||
public delegate void ErrorOccuredEventHandler(object sender, string ErrorMessage);
|
||||
public event ErrorOccuredEventHandler ErrorOccured
|
||||
{
|
||||
add { ErrorOccuredEvent = (ErrorOccuredEventHandler) System.Delegate.Combine(ErrorOccuredEvent, value); }
|
||||
remove { ErrorOccuredEvent = (ErrorOccuredEventHandler) System.Delegate.Remove(ErrorOccuredEvent, value); }
|
||||
add { ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Combine(ErrorOccuredEvent, value); }
|
||||
remove { ErrorOccuredEvent = (ErrorOccuredEventHandler) Delegate.Remove(ErrorOccuredEvent, value); }
|
||||
}
|
||||
|
||||
public delegate void ClosingEventHandler(object sender);
|
||||
public event ClosingEventHandler Closing
|
||||
{
|
||||
add { ClosingEvent = (ClosingEventHandler) System.Delegate.Combine(ClosingEvent, value); }
|
||||
remove { ClosingEvent = (ClosingEventHandler) System.Delegate.Remove(ClosingEvent, value); }
|
||||
add { ClosingEvent = (ClosingEventHandler) Delegate.Combine(ClosingEvent, value); }
|
||||
remove { ClosingEvent = (ClosingEventHandler) Delegate.Remove(ClosingEvent, value); }
|
||||
}
|
||||
|
||||
public delegate void ClosedEventHandler(object sender);
|
||||
public event ClosedEventHandler Closed
|
||||
{
|
||||
add { ClosedEvent = (ClosedEventHandler) System.Delegate.Combine(ClosedEvent, value); }
|
||||
remove { ClosedEvent = (ClosedEventHandler) System.Delegate.Remove(ClosedEvent, value); }
|
||||
add { ClosedEvent = (ClosedEventHandler) Delegate.Combine(ClosedEvent, value); }
|
||||
remove { ClosedEvent = (ClosedEventHandler) Delegate.Remove(ClosedEvent, value); }
|
||||
}
|
||||
|
||||
|
||||
public void Event_Closing(object sender)
|
||||
{
|
||||
if (ClosingEvent != null)
|
||||
ClosingEvent(sender);
|
||||
ClosingEvent?.Invoke(sender);
|
||||
}
|
||||
|
||||
public void Event_Closed(object sender)
|
||||
{
|
||||
if (ClosedEvent != null)
|
||||
ClosedEvent(sender);
|
||||
}
|
||||
|
||||
public void Event_Connecting(object sender)
|
||||
{
|
||||
if (ConnectingEvent != null)
|
||||
ConnectingEvent(sender);
|
||||
}
|
||||
|
||||
public void Event_Connected(object sender)
|
||||
{
|
||||
if (ConnectedEvent != null)
|
||||
ConnectedEvent(sender);
|
||||
}
|
||||
|
||||
public void Event_Disconnected(object sender, string DisconnectedMessage)
|
||||
{
|
||||
if (DisconnectedEvent != null)
|
||||
DisconnectedEvent(sender, DisconnectedMessage);
|
||||
}
|
||||
|
||||
public void Event_ErrorOccured(object sender, string ErrorMsg)
|
||||
{
|
||||
if (ErrorOccuredEvent != null)
|
||||
ErrorOccuredEvent(sender, ErrorMsg);
|
||||
}
|
||||
|
||||
public void Event_ReconnectGroupCloseClicked()
|
||||
|
||||
protected void Event_Closed(object sender)
|
||||
{
|
||||
ClosedEvent?.Invoke(sender);
|
||||
}
|
||||
|
||||
protected void Event_Connecting(object sender)
|
||||
{
|
||||
ConnectingEvent?.Invoke(sender);
|
||||
}
|
||||
|
||||
protected void Event_Connected(object sender)
|
||||
{
|
||||
ConnectedEvent?.Invoke(sender);
|
||||
}
|
||||
|
||||
protected void Event_Disconnected(object sender, string DisconnectedMessage)
|
||||
{
|
||||
DisconnectedEvent?.Invoke(sender, DisconnectedMessage);
|
||||
}
|
||||
|
||||
protected void Event_ErrorOccured(object sender, string ErrorMsg)
|
||||
{
|
||||
ErrorOccuredEvent?.Invoke(sender, ErrorMsg);
|
||||
}
|
||||
|
||||
protected void Event_ReconnectGroupCloseClicked()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
|
||||
|
||||
namespace mRemoteNG.Connection.Protocol
|
||||
@@ -98,7 +101,8 @@ namespace mRemoteNG.Connection.Protocol
|
||||
{
|
||||
if (Settings.Default.EmptyCredentials == "custom")
|
||||
{
|
||||
password = Security.Crypt.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
password = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), GeneralAppInfo.EncryptionKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ using System.Threading;
|
||||
using System.ComponentModel;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using MSTSCLib;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.UI.Forms;
|
||||
@@ -341,21 +343,21 @@ namespace mRemoteNG.Connection.Protocol.RDP
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -438,7 +440,8 @@ namespace mRemoteNG.Connection.Protocol.RDP
|
||||
{
|
||||
if (Settings.Default.DefaultPassword != "")
|
||||
{
|
||||
_rdpClient.AdvancedSettings2.ClearTextPassword = Security.Crypt.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
_rdpClient.AdvancedSettings2.ClearTextPassword = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), App.Info.GeneralAppInfo.EncryptionKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -882,4 +885,4 @@ namespace mRemoteNG.Connection.Protocol.RDP
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
|
||||
// by using the '*' as shown below:
|
||||
// <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
[assembly:AssemblyVersion("1.74.*")]
|
||||
[assembly: AssemblyVersion("1.75.*")]
|
||||
|
||||
[assembly:NeutralResourcesLanguageAttribute("en")]
|
||||
|
||||
|
||||
BIN
mRemoteV1/References/VncSharp.dll
Normal file
BIN
mRemoteV1/References/VncSharp.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3107,6 +3107,15 @@ namespace mRemoteNG {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Reconnect All Open Connections.
|
||||
/// </summary>
|
||||
internal static string strMenuReconnectAll {
|
||||
get {
|
||||
return ResourceManager.GetString("strMenuReconnectAll", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Refresh Screen (VNC).
|
||||
/// </summary>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
@@ -105,17 +105,17 @@
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="strAbout" xml:space="preserve">
|
||||
<value>Über</value>
|
||||
@@ -2191,4 +2191,7 @@ mRemoteNG wird nun geschlossen und die Installation gestartet.</value>
|
||||
<data name="strYes" xml:space="preserve">
|
||||
<value>Ja</value>
|
||||
</data>
|
||||
<data name="strMenuReconnectAll" xml:space="preserve">
|
||||
<value>Wiederverbinden von allen offenen Verbindungen</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -179,7 +179,7 @@
|
||||
<value>Aspect</value>
|
||||
</data>
|
||||
<data name="strAutomaticallyGetSessionInfo" xml:space="preserve">
|
||||
<value>Automatically get session information</value>
|
||||
<value>セッション情報を自動的に取得する</value>
|
||||
</data>
|
||||
<data name="strAutoSaveEvery" xml:space="preserve">
|
||||
<value>自動保存の間隔:</value>
|
||||
@@ -206,7 +206,7 @@
|
||||
<value>Default Inheritance</value>
|
||||
</data>
|
||||
<data name="strButtonDefaultProperties" xml:space="preserve">
|
||||
<value>Default Properties</value>
|
||||
<value>デフォルトのプロパティ</value>
|
||||
</data>
|
||||
<data name="strButtonDisconnect" xml:space="preserve">
|
||||
<value>切断</value>
|
||||
@@ -286,7 +286,7 @@ Please use File - Load Connections for normal connection files!</value>
|
||||
<value>更新</value>
|
||||
</data>
|
||||
<data name="strCcCheckFailed" xml:space="preserve">
|
||||
<value>Check failed!</value>
|
||||
<value>確認に失敗しました</value>
|
||||
</data>
|
||||
<data name="strCcCheckSucceeded" xml:space="preserve">
|
||||
<value>Check succeeded!</value>
|
||||
@@ -451,38 +451,39 @@ VncSharpNG Control Version {0}</value>
|
||||
<value>btnIcon_Clickがエラーを発生しました</value>
|
||||
</data>
|
||||
<data name="strConfigPropertyGridHideItemsFailed" xml:space="preserve">
|
||||
<value>ShowHideGridItems failed!</value>
|
||||
<value>ShowHideGridItemsがエラーを発生しました</value>
|
||||
</data>
|
||||
<data name="strConfigPropertyGridMenuClickFailed" xml:space="preserve">
|
||||
<value>IconMenu_Click failed!</value>
|
||||
<value>IconMenu_Clickがエラーを発生しました</value>
|
||||
</data>
|
||||
<data name="strConfigPropertyGridObjectFailed" xml:space="preserve">
|
||||
<value>Property Grid object failed!</value>
|
||||
<value>プロパティを表示するグリッドがエラーを発生しました</value>
|
||||
</data>
|
||||
<data name="strConfigPropertyGridSetHostStatusFailed" xml:space="preserve">
|
||||
<value>SetHostStatus failed!</value>
|
||||
<value>SetHostStatusがエラーを発生しました</value>
|
||||
</data>
|
||||
<data name="strConfigPropertyGridValueFailed" xml:space="preserve">
|
||||
<value>pGrid_PopertyValueChanged failed!</value>
|
||||
<value>pGrid_PopertyValueChangedがエラーを発生しました</value>
|
||||
</data>
|
||||
<data name="strConfigUiLoadFailed" xml:space="preserve">
|
||||
<value>Config UI load failed!</value>
|
||||
<value>Config UI loadがエラーを発生しました</value>
|
||||
</data>
|
||||
<data name="strConfirmCloseConnectionMainInstruction" xml:space="preserve">
|
||||
<value>接続「{0}」を切断しますか?</value>
|
||||
<comment>Do you want to close the connection, "{0}"?</comment>
|
||||
</data>
|
||||
<data name="strConfirmCloseConnectionPanelMainInstruction" xml:space="preserve">
|
||||
<value>Are you sure you want to close the panel, "{0}"? Any connections that it contains will also be closed.</value>
|
||||
<value>パネル内で開いている接続も全て切断されますが、パネル「{0}」を閉じますか?</value>
|
||||
</data>
|
||||
<data name="strConfirmDeleteExternalTool" xml:space="preserve">
|
||||
<value>Are you sure you want to delete the external tool, "{0}"?</value>
|
||||
<value>外部ツール「{0}」を削除してもよろしいですか?</value>
|
||||
</data>
|
||||
<data name="strConfirmDeleteExternalToolMultiple" xml:space="preserve">
|
||||
<value>Are you sure you want to delete the {0} selected external tools?</value>
|
||||
<value>選択された外部ツール「{0}」を削除してもよろしいですか?</value>
|
||||
</data>
|
||||
<data name="strConfirmDeleteNodeConnection" xml:space="preserve">
|
||||
<value>Are you sure you want to delete the connection, "{0}"?</value>
|
||||
<value>接続「{0}」を削除してもよろしいですか?</value>
|
||||
<comment>Are you sure you want to delete the connection, "{0}"?</comment>
|
||||
</data>
|
||||
<data name="strConfirmDeleteNodeFolder" xml:space="preserve">
|
||||
<value>空のフォルダ「{0}」削除してもよろしいですか?</value>
|
||||
@@ -573,7 +574,8 @@ Starting with new connections file.</value>
|
||||
<value>接続イベントに失敗しました</value>
|
||||
</data>
|
||||
<data name="strConnenctionCloseEventFailed" xml:space="preserve">
|
||||
<value>Connection Event Closed failed!</value>
|
||||
<value />
|
||||
<comment>Connection Event Closed failed!</comment>
|
||||
</data>
|
||||
<data name="strCouldNotCreateNewConnectionsFile" xml:space="preserve">
|
||||
<value>Couldn't create new connections file!</value>
|
||||
@@ -630,10 +632,10 @@ Starting with new connections file.</value>
|
||||
<value>接続設定ファイルをすべて暗号化する</value>
|
||||
</data>
|
||||
<data name="strEndIP" xml:space="preserve">
|
||||
<value>End IP</value>
|
||||
<value>最終IPアドレス</value>
|
||||
</data>
|
||||
<data name="strEndPort" xml:space="preserve">
|
||||
<value>End Port</value>
|
||||
<value>最終ポート</value>
|
||||
</data>
|
||||
<data name="strErrorAddExternalToolsToToolBarFailed" xml:space="preserve">
|
||||
<value>AddExternalToolsToToolBar (frmMain) failed. {0}</value>
|
||||
@@ -651,7 +653,7 @@ Starting with new connections file.</value>
|
||||
<value>エラーコード:{0}</value>
|
||||
</data>
|
||||
<data name="strErrorConnectionListSaveFailed" xml:space="preserve">
|
||||
<value>The connection list could not be saved.</value>
|
||||
<value>接続リストが保存できませんでした</value>
|
||||
</data>
|
||||
<data name="strErrorCouldNotLaunchPutty" xml:space="preserve">
|
||||
<value>PuTTYの実行に失敗しました</value>
|
||||
@@ -700,7 +702,7 @@ See the Microsoft Support article at http://support.microsoft.com/kb/811833 for
|
||||
<value>Export mRemote/mRemoteNG XML</value>
|
||||
</data>
|
||||
<data name="strExportProperties" xml:space="preserve">
|
||||
<value>Export Properties</value>
|
||||
<value>プロパティのエクスポート</value>
|
||||
</data>
|
||||
<data name="strExportSelectedConnection" xml:space="preserve">
|
||||
<value>Export the currently selected connection</value>
|
||||
@@ -2033,16 +2035,20 @@ Message:
|
||||
<comment>Show full connections file path in window title</comment>
|
||||
</data>
|
||||
<data name="strShowLogonInfoOnTabs" xml:space="preserve">
|
||||
<value>Show logon information on tab names</value>
|
||||
<value>タブ名と一緒にログオン情報を表示する</value>
|
||||
<comment>Show logon information on tab names</comment>
|
||||
</data>
|
||||
<data name="strShowProtocolOnTabs" xml:space="preserve">
|
||||
<value>Show protocols on tab names</value>
|
||||
<value>タブ名と一緒にプロトコルを表示する</value>
|
||||
<comment>Show protocols on tab names</comment>
|
||||
</data>
|
||||
<data name="strSingleClickOnConnectionOpensIt" xml:space="preserve">
|
||||
<value>Single click on connection opens it</value>
|
||||
<value>ワンクリックで接続を開始する</value>
|
||||
<comment>Single click on connection opens it</comment>
|
||||
</data>
|
||||
<data name="strSingleClickOnOpenConnectionSwitchesToIt" xml:space="preserve">
|
||||
<value>Single click on opened connection switches to it</value>
|
||||
<value />
|
||||
<comment>Single click on opened connection switches to it</comment>
|
||||
</data>
|
||||
<data name="strSmartSizeModeAspect" xml:space="preserve">
|
||||
<value>Aspect</value>
|
||||
@@ -2343,10 +2349,11 @@ mRemoteNGを終了してインストールを開始します</value>
|
||||
<value>Use a smart card</value>
|
||||
</data>
|
||||
<data name="strUseSQLServer" xml:space="preserve">
|
||||
<value>Use SQL Server to load && save connections</value>
|
||||
<value>接続設定の保存にSQLサーバーを使用する</value>
|
||||
<comment>Use SQL Server to load && save connections</comment>
|
||||
</data>
|
||||
<data name="strVersion" xml:space="preserve">
|
||||
<value>Version</value>
|
||||
<value>バージョン</value>
|
||||
</data>
|
||||
<data name="strVisionAppRemoteDesktopCsv" xml:space="preserve">
|
||||
<value>visionapp Remote Desktop 2008 CSV</value>
|
||||
@@ -2355,13 +2362,13 @@ mRemoteNGを終了してインストールを開始します</value>
|
||||
<value>VNC</value>
|
||||
</data>
|
||||
<data name="strVncConnectionDisconnectFailed" xml:space="preserve">
|
||||
<value>VNC disconnect failed!</value>
|
||||
<value>VNCの切断に失敗しました</value>
|
||||
</data>
|
||||
<data name="strVncConnectionOpenFailed" xml:space="preserve">
|
||||
<value>Opening connection failed!</value>
|
||||
<value>接続に失敗しました</value>
|
||||
</data>
|
||||
<data name="strVncRefreshFailed" xml:space="preserve">
|
||||
<value>VNC Refresh Screen Failed!</value>
|
||||
<value>VNCのスクリーンの更新に失敗しました</value>
|
||||
</data>
|
||||
<data name="strVncSendSpecialKeysFailed" xml:space="preserve">
|
||||
<value>VNC SendSpecialKeys failed!</value>
|
||||
@@ -2382,7 +2389,7 @@ mRemoteNGを終了してインストールを開始します</value>
|
||||
<value>VNC Toggle ViewOnly Failed!</value>
|
||||
</data>
|
||||
<data name="strWarnIfAuthFails" xml:space="preserve">
|
||||
<value>Warn me if authentication fails</value>
|
||||
<value>認証に失敗した場合は警告する</value>
|
||||
</data>
|
||||
<data name="strWarnings" xml:space="preserve">
|
||||
<value>警告</value>
|
||||
|
||||
@@ -105,17 +105,17 @@
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="strAbout" xml:space="preserve">
|
||||
<value>About</value>
|
||||
@@ -2378,4 +2378,7 @@ mRemoteNG will now quit and begin with the installation.</value>
|
||||
<data name="strYes" xml:space="preserve">
|
||||
<value>Yes</value>
|
||||
</data>
|
||||
<data name="strMenuReconnectAll" xml:space="preserve">
|
||||
<value>Reconnect All Open Connections</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -59,7 +59,7 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
@@ -105,17 +105,17 @@
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="strAbout" xml:space="preserve">
|
||||
<value>О программе</value>
|
||||
@@ -2199,4 +2199,7 @@ mRemoteNG сейчас прекратит работу и начнет проц
|
||||
<data name="strYes" xml:space="preserve">
|
||||
<value>Да</value>
|
||||
</data>
|
||||
<data name="strMenuReconnectAll" xml:space="preserve">
|
||||
<value>Переподключить все открытые соединения</value>
|
||||
</data>
|
||||
</root>
|
||||
10
mRemoteV1/Security/BlockCipherEngines.cs
Normal file
10
mRemoteV1/Security/BlockCipherEngines.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace mRemoteNG.Security
|
||||
{
|
||||
public enum BlockCipherEngines
|
||||
{
|
||||
AES,
|
||||
Twofish,
|
||||
Serpent
|
||||
}
|
||||
}
|
||||
10
mRemoteV1/Security/BlockCipherModes.cs
Normal file
10
mRemoteV1/Security/BlockCipherModes.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace mRemoteNG.Security
|
||||
{
|
||||
public enum BlockCipherModes
|
||||
{
|
||||
GCM,
|
||||
CCM,
|
||||
EAX
|
||||
}
|
||||
}
|
||||
53
mRemoteV1/Security/CryptographyProviderFactory.cs
Normal file
53
mRemoteV1/Security/CryptographyProviderFactory.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.Crypto.Engines;
|
||||
using Org.BouncyCastle.Crypto.Modes;
|
||||
|
||||
namespace mRemoteNG.Security
|
||||
{
|
||||
public class CryptographyProviderFactory
|
||||
{
|
||||
public ICryptographyProvider CreateAeadCryptographyProvider(BlockCipherEngines engine, BlockCipherModes mode)
|
||||
{
|
||||
var cipherEngine = ChooseBlockCipherEngine(engine);
|
||||
var cipher = ChooseBlockCipherMode(mode, cipherEngine);
|
||||
return new AeadCryptographyProvider(cipher);
|
||||
}
|
||||
|
||||
public ICryptographyProvider CreateLegacyRijndaelCryptographyProvider()
|
||||
{
|
||||
return new LegacyRijndaelCryptographyProvider();
|
||||
}
|
||||
|
||||
private IBlockCipher ChooseBlockCipherEngine(BlockCipherEngines engine)
|
||||
{
|
||||
switch (engine)
|
||||
{
|
||||
case BlockCipherEngines.AES:
|
||||
return new AesEngine();
|
||||
case BlockCipherEngines.Twofish:
|
||||
return new TwofishEngine();
|
||||
case BlockCipherEngines.Serpent:
|
||||
return new SerpentEngine();
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(engine), engine, null);
|
||||
}
|
||||
}
|
||||
|
||||
private IAeadBlockCipher ChooseBlockCipherMode(BlockCipherModes mode, IBlockCipher blockCipher)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case BlockCipherModes.GCM:
|
||||
return new GcmBlockCipher(blockCipher);
|
||||
case BlockCipherModes.CCM:
|
||||
return new CcmBlockCipher(blockCipher);
|
||||
case BlockCipherModes.EAX:
|
||||
return new EaxBlockCipher(blockCipher);
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
54
mRemoteV1/Security/EncryptedSecureString.cs
Normal file
54
mRemoteV1/Security/EncryptedSecureString.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using Org.BouncyCastle.Security;
|
||||
|
||||
namespace mRemoteNG.Security
|
||||
{
|
||||
public class EncryptedSecureString
|
||||
{
|
||||
private static SecureString _machineKey;
|
||||
private SecureString _secureString;
|
||||
private readonly ICryptographyProvider _cryptographyProvider;
|
||||
|
||||
private static SecureString MachineKey => _machineKey ?? (_machineKey = GenerateNewMachineKey(32));
|
||||
|
||||
public EncryptedSecureString()
|
||||
{
|
||||
_secureString = new SecureString();
|
||||
_cryptographyProvider = new AeadCryptographyProvider();
|
||||
}
|
||||
|
||||
public EncryptedSecureString(ICryptographyProvider cryptographyProvider)
|
||||
{
|
||||
_secureString = new SecureString();
|
||||
_cryptographyProvider = cryptographyProvider;
|
||||
}
|
||||
|
||||
public string GetClearTextValue()
|
||||
{
|
||||
var encryptedText = _secureString.ConvertToUnsecureString();
|
||||
var clearText = _cryptographyProvider.Decrypt(encryptedText, MachineKey);
|
||||
return clearText;
|
||||
}
|
||||
|
||||
public void SetValue(string value)
|
||||
{
|
||||
var cipherText = _cryptographyProvider.Encrypt(value, MachineKey);
|
||||
_secureString = cipherText.ConvertToSecureString();
|
||||
}
|
||||
|
||||
private static SecureString GenerateNewMachineKey(int keySize)
|
||||
{
|
||||
var random = new SecureRandom();
|
||||
random.SetSeed(random.GenerateSeed(128));
|
||||
|
||||
var machineKeyString = "";
|
||||
for (var x = 0; x < keySize; x++)
|
||||
{
|
||||
machineKeyString += (char)random.Next(33, 126);
|
||||
}
|
||||
|
||||
return machineKeyString.ConvertToSecureString();
|
||||
}
|
||||
}
|
||||
}
|
||||
15
mRemoteV1/Security/ICryptographyProvider.cs
Normal file
15
mRemoteV1/Security/ICryptographyProvider.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Security;
|
||||
|
||||
namespace mRemoteNG.Security
|
||||
{
|
||||
public interface ICryptographyProvider
|
||||
{
|
||||
int BlockSizeInBytes { get; }
|
||||
|
||||
string CipherEngine { get; }
|
||||
|
||||
string Encrypt(string plainText, SecureString encryptionKey);
|
||||
|
||||
string Decrypt(string cipherText, SecureString decryptionKey);
|
||||
}
|
||||
}
|
||||
64
mRemoteV1/Security/SecureStringExtensions.cs
Normal file
64
mRemoteV1/Security/SecureStringExtensions.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace mRemoteNG.Security
|
||||
{
|
||||
public static class SecureStringExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Method to marshall a SecureString out of protected memory into a standard String object that is required by most other functions.
|
||||
/// Code initially taken from Fabio Pintos
|
||||
/// Source: https://blogs.msdn.microsoft.com/fpintos/2009/06/12/how-to-properly-convert-securestring-to-string/
|
||||
/// </summary>
|
||||
/// <param name="securePassword"></param>
|
||||
/// <returns></returns>
|
||||
public static string ConvertToUnsecureString(this SecureString securePassword)
|
||||
{
|
||||
if (securePassword == null)
|
||||
throw new ArgumentNullException(nameof(securePassword));
|
||||
|
||||
var unmanagedString = IntPtr.Zero;
|
||||
try
|
||||
{
|
||||
unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(securePassword);
|
||||
return Marshal.PtrToStringUni(unmanagedString);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Marshal.ZeroFreeGlobalAllocUnicode(unmanagedString);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConvertToEncryptedString(this SecureString secureString)
|
||||
{
|
||||
return "TEST ENCRYPTION";
|
||||
}
|
||||
|
||||
public static SecureString ConvertFromEncryptedString(this SecureString secureString, string encryptedString)
|
||||
{
|
||||
var unencryptedString = encryptedString;
|
||||
return unencryptedString.ConvertToSecureString();
|
||||
}
|
||||
|
||||
public static SecureString ConvertToSecureString(this string unsecuredPassword)
|
||||
{
|
||||
if (unsecuredPassword == null)
|
||||
throw new ArgumentNullException(nameof(unsecuredPassword));
|
||||
|
||||
var secureString = new SecureString();
|
||||
foreach (var character in unsecuredPassword.ToCharArray())
|
||||
secureString.AppendChar(character);
|
||||
// ReSharper disable once RedundantAssignment
|
||||
unsecuredPassword = null;
|
||||
return secureString;
|
||||
}
|
||||
|
||||
public static bool IsBase64String(this string s)
|
||||
{
|
||||
s = s.Trim();
|
||||
return (s.Length % 4 == 0) && Regex.IsMatch(s, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.My;
|
||||
|
||||
|
||||
namespace mRemoteNG.Security
|
||||
{
|
||||
public class Crypt
|
||||
{
|
||||
public static string Encrypt(string StrToEncrypt, string StrSecret)
|
||||
{
|
||||
if (StrToEncrypt == "" || StrSecret == "")
|
||||
{
|
||||
return StrToEncrypt;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
RijndaelManaged rd = new RijndaelManaged();
|
||||
|
||||
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
|
||||
byte[] key = md5.ComputeHash(Encoding.UTF8.GetBytes(StrSecret));
|
||||
|
||||
md5.Clear();
|
||||
rd.Key = key;
|
||||
rd.GenerateIV();
|
||||
|
||||
byte[] iv = rd.IV;
|
||||
MemoryStream ms = new MemoryStream();
|
||||
|
||||
ms.Write(iv, 0, iv.Length);
|
||||
|
||||
CryptoStream cs = new CryptoStream(ms, rd.CreateEncryptor(), CryptoStreamMode.Write);
|
||||
byte[] data = System.Text.Encoding.UTF8.GetBytes(StrToEncrypt);
|
||||
|
||||
cs.Write(data, 0, data.Length);
|
||||
cs.FlushFinalBlock();
|
||||
|
||||
byte[] encdata = ms.ToArray();
|
||||
cs.Close();
|
||||
rd.Clear();
|
||||
|
||||
return Convert.ToBase64String(encdata);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, string.Format(Language.strErrorEncryptionFailed, ex.Message));
|
||||
}
|
||||
|
||||
return StrToEncrypt;
|
||||
}
|
||||
|
||||
public static string Decrypt(string ciphertextBase64, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ciphertextBase64) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
return ciphertextBase64;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
string plaintext = "";
|
||||
|
||||
using (RijndaelManaged rijndaelManaged = new RijndaelManaged())
|
||||
{
|
||||
using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
|
||||
{
|
||||
byte[] key = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
|
||||
rijndaelManaged.Key = key;
|
||||
}
|
||||
|
||||
|
||||
byte[] ciphertext = Convert.FromBase64String(ciphertextBase64);
|
||||
|
||||
using (MemoryStream memoryStream = new MemoryStream(ciphertext))
|
||||
{
|
||||
const int ivLength = 16;
|
||||
byte[] iv = new byte[ivLength - 1 + 1];
|
||||
memoryStream.Read(iv, 0, ivLength);
|
||||
rijndaelManaged.IV = iv;
|
||||
|
||||
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, rijndaelManaged.CreateDecryptor(), CryptoStreamMode.Read))
|
||||
{
|
||||
using (StreamReader streamReader = new StreamReader(cryptoStream, System.Text.Encoding.UTF8, true))
|
||||
{
|
||||
plaintext = streamReader.ReadToEnd();
|
||||
}
|
||||
|
||||
rijndaelManaged.Clear();
|
||||
} // cryptoStream
|
||||
|
||||
} // memoryStream
|
||||
|
||||
} // rijndaelManaged
|
||||
|
||||
|
||||
return plaintext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Ignore CryptographicException "Padding is invalid and cannot be removed." when password is incorrect.
|
||||
if (!(ex is CryptographicException))
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, string.Format(Language.strErrorDecryptionFailed, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
return ciphertextBase64;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Initial work:
|
||||
* This work (Modern Encryption of a String C#, by James Tuley),
|
||||
* identified by James Tuley, is free of known copyright restrictions.
|
||||
* https://gist.github.com/4336842
|
||||
* http://creativecommons.org/publicdomain/mark/1.0/
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using Org.BouncyCastle.Crypto.Engines;
|
||||
using Org.BouncyCastle.Crypto.Generators;
|
||||
using Org.BouncyCastle.Crypto.Modes;
|
||||
using Org.BouncyCastle.Crypto.Parameters;
|
||||
using Org.BouncyCastle.Security;
|
||||
|
||||
namespace mRemoteNG.Security.SymmetricEncryption
|
||||
{
|
||||
public class AeadCryptographyProvider : ICryptographyProvider
|
||||
{
|
||||
private readonly IAeadBlockCipher _aeadBlockCipher;
|
||||
private readonly Encoding _encoding;
|
||||
private readonly SecureRandom _random = new SecureRandom();
|
||||
|
||||
//Preconfigured Encryption Parameters
|
||||
private readonly int NonceBitSize = 128;
|
||||
private readonly int MacBitSize = 128;
|
||||
private readonly int KeyBitSize = 256;
|
||||
|
||||
//Preconfigured Password Key Derivation Parameters
|
||||
private readonly int SaltBitSize = 128;
|
||||
private readonly int Iterations = 10000;
|
||||
private readonly int MinPasswordLength = 12;
|
||||
|
||||
public int BlockSizeInBytes => _aeadBlockCipher.GetBlockSize();
|
||||
|
||||
public string CipherEngine => _aeadBlockCipher.AlgorithmName;
|
||||
|
||||
public AeadCryptographyProvider()
|
||||
{
|
||||
_aeadBlockCipher = new GcmBlockCipher(new AesEngine());
|
||||
_encoding = Encoding.UTF8;
|
||||
}
|
||||
|
||||
public AeadCryptographyProvider(Encoding encoding)
|
||||
{
|
||||
_aeadBlockCipher = new GcmBlockCipher(new AesEngine());
|
||||
_encoding = encoding;
|
||||
}
|
||||
|
||||
public AeadCryptographyProvider(IAeadBlockCipher aeadBlockCipher)
|
||||
{
|
||||
_aeadBlockCipher = aeadBlockCipher;
|
||||
_encoding = Encoding.UTF8;
|
||||
}
|
||||
|
||||
public AeadCryptographyProvider(IAeadBlockCipher aeadBlockCipher, Encoding encoding)
|
||||
{
|
||||
_aeadBlockCipher = aeadBlockCipher;
|
||||
_encoding = encoding;
|
||||
}
|
||||
|
||||
|
||||
public string Encrypt(string plainText, SecureString encryptionKey)
|
||||
{
|
||||
var encryptedText = SimpleEncryptWithPassword(plainText, encryptionKey.ConvertToUnsecureString());
|
||||
return encryptedText;
|
||||
}
|
||||
|
||||
private string SimpleEncryptWithPassword(string secretMessage, string password, byte[] nonSecretPayload = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(secretMessage))
|
||||
throw new ArgumentException(@"Secret Message Required!", nameof(secretMessage));
|
||||
|
||||
var plainText = _encoding.GetBytes(secretMessage);
|
||||
var cipherText = SimpleEncryptWithPassword(plainText, password, nonSecretPayload);
|
||||
return Convert.ToBase64String(cipherText);
|
||||
}
|
||||
|
||||
private byte[] SimpleEncryptWithPassword(byte[] secretMessage, string password, byte[] nonSecretPayload = null)
|
||||
{
|
||||
nonSecretPayload = nonSecretPayload ?? new byte[] { };
|
||||
|
||||
//User Error Checks
|
||||
if (string.IsNullOrWhiteSpace(password) || password.Length < MinPasswordLength)
|
||||
throw new ArgumentException($"Must have a password of at least {MinPasswordLength} characters!", nameof(password));
|
||||
|
||||
if (secretMessage == null || secretMessage.Length == 0)
|
||||
throw new ArgumentException(@"Secret Message Required!", nameof(secretMessage));
|
||||
|
||||
var generator = new Pkcs5S2ParametersGenerator();
|
||||
|
||||
//Use Random Salt to minimize pre-generated weak password attacks.
|
||||
var salt = new byte[SaltBitSize / 8];
|
||||
_random.NextBytes(salt);
|
||||
|
||||
generator.Init(
|
||||
PbeParametersGenerator.Pkcs5PasswordToBytes(password.ToCharArray()),
|
||||
salt,
|
||||
Iterations);
|
||||
|
||||
//Generate Key
|
||||
var key = (KeyParameter)generator.GenerateDerivedMacParameters(KeyBitSize);
|
||||
|
||||
//Create Full Non Secret Payload
|
||||
var payload = new byte[salt.Length + nonSecretPayload.Length];
|
||||
Array.Copy(nonSecretPayload, payload, nonSecretPayload.Length);
|
||||
Array.Copy(salt, 0, payload, nonSecretPayload.Length, salt.Length);
|
||||
|
||||
return SimpleEncrypt(secretMessage, key.GetKey(), payload);
|
||||
}
|
||||
|
||||
private byte[] SimpleEncrypt(byte[] secretMessage, byte[] key, byte[] nonSecretPayload = null)
|
||||
{
|
||||
//User Error Checks
|
||||
if (key == null || key.Length != KeyBitSize / 8)
|
||||
throw new ArgumentException($"Key needs to be {KeyBitSize} bit!", nameof(key));
|
||||
|
||||
if (secretMessage == null || secretMessage.Length == 0)
|
||||
throw new ArgumentException(@"Secret Message Required!", nameof(secretMessage));
|
||||
|
||||
//Non-secret Payload Optional
|
||||
nonSecretPayload = nonSecretPayload ?? new byte[] { };
|
||||
|
||||
//Using random nonce large enough not to repeat
|
||||
var nonce = new byte[NonceBitSize / 8];
|
||||
_random.NextBytes(nonce, 0, nonce.Length);
|
||||
|
||||
var parameters = new AeadParameters(new KeyParameter(key), MacBitSize, nonce, nonSecretPayload);
|
||||
_aeadBlockCipher.Init(true, parameters);
|
||||
|
||||
//Generate Cipher Text With Auth Tag
|
||||
var cipherText = new byte[_aeadBlockCipher.GetOutputSize(secretMessage.Length)];
|
||||
var len = _aeadBlockCipher.ProcessBytes(secretMessage, 0, secretMessage.Length, cipherText, 0);
|
||||
_aeadBlockCipher.DoFinal(cipherText, len);
|
||||
|
||||
//Assemble Message
|
||||
using (var combinedStream = new MemoryStream())
|
||||
{
|
||||
using (var binaryWriter = new BinaryWriter(combinedStream))
|
||||
{
|
||||
//Prepend Authenticated Payload
|
||||
binaryWriter.Write(nonSecretPayload);
|
||||
//Prepend Nonce
|
||||
binaryWriter.Write(nonce);
|
||||
//Write Cipher Text
|
||||
binaryWriter.Write(cipherText);
|
||||
}
|
||||
return combinedStream.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string Decrypt(string cipherText, SecureString decryptionKey)
|
||||
{
|
||||
var decryptedText = SimpleDecryptWithPassword(cipherText, decryptionKey);
|
||||
return decryptedText;
|
||||
}
|
||||
|
||||
private string SimpleDecryptWithPassword(string encryptedMessage, SecureString decryptionKey, int nonSecretPayloadLength = 0)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(encryptedMessage))
|
||||
throw new ArgumentException(@"Encrypted Message Required!", nameof(encryptedMessage));
|
||||
|
||||
var cipherText = Convert.FromBase64String(encryptedMessage);
|
||||
var plainText = SimpleDecryptWithPassword(cipherText, decryptionKey.ConvertToUnsecureString(), nonSecretPayloadLength);
|
||||
return plainText == null ? null : _encoding.GetString(plainText);
|
||||
}
|
||||
|
||||
private byte[] SimpleDecryptWithPassword(byte[] encryptedMessage, string password, int nonSecretPayloadLength = 0)
|
||||
{
|
||||
//User Error Checks
|
||||
if (string.IsNullOrWhiteSpace(password) || password.Length < MinPasswordLength)
|
||||
throw new ArgumentException($"Must have a password of at least {MinPasswordLength} characters!", nameof(password));
|
||||
|
||||
if (encryptedMessage == null || encryptedMessage.Length == 0)
|
||||
throw new ArgumentException(@"Encrypted Message Required!", nameof(encryptedMessage));
|
||||
|
||||
var generator = new Pkcs5S2ParametersGenerator();
|
||||
|
||||
//Grab Salt from Payload
|
||||
var salt = new byte[SaltBitSize / 8];
|
||||
Array.Copy(encryptedMessage, nonSecretPayloadLength, salt, 0, salt.Length);
|
||||
|
||||
generator.Init(
|
||||
PbeParametersGenerator.Pkcs5PasswordToBytes(password.ToCharArray()),
|
||||
salt,
|
||||
Iterations);
|
||||
|
||||
//Generate Key
|
||||
var key = (KeyParameter)generator.GenerateDerivedMacParameters(KeyBitSize);
|
||||
|
||||
return SimpleDecrypt(encryptedMessage, key.GetKey(), salt.Length + nonSecretPayloadLength);
|
||||
}
|
||||
|
||||
private byte[] SimpleDecrypt(byte[] encryptedMessage, byte[] key, int nonSecretPayloadLength = 0)
|
||||
{
|
||||
//User Error Checks
|
||||
if (key == null || key.Length != KeyBitSize / 8)
|
||||
throw new ArgumentException($"Key needs to be {KeyBitSize} bit!", nameof(key));
|
||||
|
||||
if (encryptedMessage == null || encryptedMessage.Length == 0)
|
||||
throw new ArgumentException(@"Encrypted Message Required!", nameof(encryptedMessage));
|
||||
|
||||
using (var cipherStream = new MemoryStream(encryptedMessage))
|
||||
using (var cipherReader = new BinaryReader(cipherStream))
|
||||
{
|
||||
//Grab Payload
|
||||
var nonSecretPayload = cipherReader.ReadBytes(nonSecretPayloadLength);
|
||||
|
||||
//Grab Nonce
|
||||
var nonce = cipherReader.ReadBytes(NonceBitSize / 8);
|
||||
|
||||
var parameters = new AeadParameters(new KeyParameter(key), MacBitSize, nonce, nonSecretPayload);
|
||||
_aeadBlockCipher.Init(false, parameters);
|
||||
|
||||
//Decrypt Cipher Text
|
||||
var cipherText = cipherReader.ReadBytes(encryptedMessage.Length - nonSecretPayloadLength - nonce.Length);
|
||||
var plainText = new byte[_aeadBlockCipher.GetOutputSize(cipherText.Length)];
|
||||
|
||||
try
|
||||
{
|
||||
var len = _aeadBlockCipher.ProcessBytes(cipherText, 0, cipherText.Length, plainText, 0);
|
||||
_aeadBlockCipher.DoFinal(plainText, len);
|
||||
}
|
||||
catch (InvalidCipherTextException)
|
||||
{
|
||||
//Return null if it doesn't authenticate
|
||||
return null;
|
||||
}
|
||||
|
||||
return plainText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Messages;
|
||||
|
||||
namespace mRemoteNG.Security.SymmetricEncryption
|
||||
{
|
||||
public class LegacyRijndaelCryptographyProvider : ICryptographyProvider
|
||||
{
|
||||
public int BlockSizeInBytes { get; }
|
||||
|
||||
public string CipherEngine { get; }
|
||||
|
||||
public LegacyRijndaelCryptographyProvider()
|
||||
{
|
||||
CipherEngine = "Rijndael";
|
||||
BlockSizeInBytes = 16;
|
||||
}
|
||||
|
||||
|
||||
public string Encrypt(string strToEncrypt, SecureString strSecret)
|
||||
{
|
||||
if (strToEncrypt == "" || strSecret.Length == 0)
|
||||
return strToEncrypt;
|
||||
|
||||
try
|
||||
{
|
||||
var rd = new RijndaelManaged();
|
||||
|
||||
var md5 = new MD5CryptoServiceProvider();
|
||||
var key = md5.ComputeHash(Encoding.UTF8.GetBytes(strSecret.ConvertToUnsecureString()));
|
||||
|
||||
md5.Clear();
|
||||
rd.Key = key;
|
||||
rd.GenerateIV();
|
||||
|
||||
var iv = rd.IV;
|
||||
var ms = new MemoryStream();
|
||||
|
||||
ms.Write(iv, 0, iv.Length);
|
||||
|
||||
var cs = new CryptoStream(ms, rd.CreateEncryptor(), CryptoStreamMode.Write);
|
||||
var data = Encoding.UTF8.GetBytes(strToEncrypt);
|
||||
|
||||
cs.Write(data, 0, data.Length);
|
||||
cs.FlushFinalBlock();
|
||||
|
||||
var encdata = ms.ToArray();
|
||||
cs.Close();
|
||||
rd.Clear();
|
||||
|
||||
return Convert.ToBase64String(encdata);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.strErrorEncryptionFailed, ex.Message));
|
||||
}
|
||||
|
||||
return strToEncrypt;
|
||||
}
|
||||
|
||||
public string Decrypt(string ciphertextBase64, SecureString password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ciphertextBase64) || password.Length == 0)
|
||||
return ciphertextBase64;
|
||||
|
||||
try
|
||||
{
|
||||
var plaintext = "";
|
||||
|
||||
using (var rijndaelManaged = new RijndaelManaged())
|
||||
{
|
||||
using (var md5 = new MD5CryptoServiceProvider())
|
||||
{
|
||||
var key = md5.ComputeHash(Encoding.UTF8.GetBytes(password.ConvertToUnsecureString()));
|
||||
rijndaelManaged.Key = key;
|
||||
}
|
||||
|
||||
var ciphertext = Convert.FromBase64String(ciphertextBase64);
|
||||
|
||||
using (var memoryStream = new MemoryStream(ciphertext))
|
||||
{
|
||||
var iv = new byte[BlockSizeInBytes];
|
||||
memoryStream.Read(iv, 0, iv.Length);
|
||||
rijndaelManaged.IV = iv;
|
||||
|
||||
using (var cryptoStream = new CryptoStream(memoryStream, rijndaelManaged.CreateDecryptor(), CryptoStreamMode.Read))
|
||||
using (var streamReader = new StreamReader(cryptoStream, Encoding.UTF8, true))
|
||||
{
|
||||
plaintext = streamReader.ReadToEnd();
|
||||
rijndaelManaged.Clear();
|
||||
}
|
||||
} // memoryStream
|
||||
} // rijndaelManaged
|
||||
|
||||
return plaintext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Ignore CryptographicException "Padding is invalid and cannot be removed." when password is incorrect.
|
||||
if (!(ex is CryptographicException))
|
||||
{
|
||||
Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, string.Format(Language.strErrorDecryptionFailed, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
return ciphertextBase64;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,12 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
using mRemoteNG.Forms;
|
||||
using mRemoteNG.Messages;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.UI.Window;
|
||||
using static System.String;
|
||||
|
||||
@@ -58,11 +60,11 @@ namespace mRemoteNG.Tools
|
||||
|
||||
|
||||
|
||||
public static string PasswordDialog(string passwordName = null, bool verify = true)
|
||||
public static SecureString PasswordDialog(string passwordName = null, bool verify = true)
|
||||
{
|
||||
PasswordForm passwordForm = new PasswordForm(passwordName, verify);
|
||||
|
||||
return passwordForm.ShowDialog() == DialogResult.OK ? passwordForm.Password : "";
|
||||
return passwordForm.ShowDialog() == DialogResult.OK ? passwordForm.Password.ConvertToSecureString() : "".ConvertToSecureString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace mRemoteNG.UI.Controls.FilteredPropertyGrid
|
||||
internal class ObjectWrapper : ICustomTypeDescriptor
|
||||
{
|
||||
/// <summary>Contain a reference to the selected objet that will linked to the parent PropertyGrid.</summary>
|
||||
private object m_SelectedObject = null;
|
||||
private object m_SelectedObject;
|
||||
/// <summary>Contain a reference to the collection of properties to show in the parent PropertyGrid.</summary>
|
||||
/// <remarks>By default, m_PropertyDescriptors contain all the properties of the object. </remarks>
|
||||
List<PropertyDescriptor> m_PropertyDescriptors = new List<PropertyDescriptor>();
|
||||
@@ -22,7 +22,7 @@ namespace mRemoteNG.UI.Controls.FilteredPropertyGrid
|
||||
/// <summary>Get or set a reference to the selected objet that will linked to the parent PropertyGrid.</summary>
|
||||
public object SelectedObject {
|
||||
get { return m_SelectedObject; }
|
||||
set { if(m_SelectedObject != value) m_SelectedObject = value; }
|
||||
set { m_SelectedObject = value; }
|
||||
}
|
||||
|
||||
/// <summary>Get or set a reference to the collection of properties to show in the parent PropertyGrid.</summary>
|
||||
|
||||
@@ -3,6 +3,7 @@ using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Config;
|
||||
using mRemoteNG.My;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
|
||||
namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
{
|
||||
@@ -76,8 +77,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
}
|
||||
|
||||
txtCredentialsUsername.Text = Convert.ToString(mRemoteNG.Settings.Default.DefaultUsername);
|
||||
txtCredentialsPassword.Text = Crypt.Decrypt(Convert.ToString(mRemoteNG.Settings.Default.DefaultPassword),
|
||||
GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
txtCredentialsPassword.Text = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.DefaultPassword), GeneralAppInfo.EncryptionKey);
|
||||
txtCredentialsDomain.Text = Convert.ToString(mRemoteNG.Settings.Default.DefaultDomain);
|
||||
|
||||
if (mRemoteNG.Settings.Default.ConfirmCloseConnection == (int) ConfirmCloseEnum.Never)
|
||||
@@ -132,7 +133,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
}
|
||||
|
||||
mRemoteNG.Settings.Default.DefaultUsername = txtCredentialsUsername.Text;
|
||||
mRemoteNG.Settings.Default.DefaultPassword = Crypt.Encrypt(txtCredentialsPassword.Text, GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
mRemoteNG.Settings.Default.DefaultPassword = cryptographyProvider.Encrypt(txtCredentialsPassword.Text, GeneralAppInfo.EncryptionKey);
|
||||
mRemoteNG.Settings.Default.DefaultDomain = txtCredentialsDomain.Text;
|
||||
|
||||
if (radCloseWarnAll.Checked)
|
||||
|
||||
@@ -4,6 +4,7 @@ using mRemoteNG.App.Info;
|
||||
using mRemoteNG.Config.Connections;
|
||||
using mRemoteNG.My;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
|
||||
namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
{
|
||||
@@ -42,7 +43,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
txtSQLServer.Text = mRemoteNG.Settings.Default.SQLHost;
|
||||
txtSQLDatabaseName.Text = mRemoteNG.Settings.Default.SQLDatabaseName;
|
||||
txtSQLUsername.Text = mRemoteNG.Settings.Default.SQLUser;
|
||||
txtSQLPassword.Text = Crypt.Decrypt(mRemoteNG.Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
txtSQLPassword.Text = cryptographyProvider.Decrypt(Settings.Default.SQLPass, GeneralAppInfo.EncryptionKey);
|
||||
}
|
||||
|
||||
public override void SaveSettings()
|
||||
@@ -53,7 +55,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
mRemoteNG.Settings.Default.SQLHost = txtSQLServer.Text;
|
||||
mRemoteNG.Settings.Default.SQLDatabaseName = txtSQLDatabaseName.Text;
|
||||
mRemoteNG.Settings.Default.SQLUser = txtSQLUsername.Text;
|
||||
mRemoteNG.Settings.Default.SQLPass = Crypt.Encrypt(txtSQLPassword.Text, GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
mRemoteNG.Settings.Default.SQLPass = cryptographyProvider.Encrypt(txtSQLPassword.Text, GeneralAppInfo.EncryptionKey);
|
||||
ReinitializeSqlUpdater();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using mRemoteNG.App.Info;
|
||||
using mRemoteNG.App.Update;
|
||||
using mRemoteNG.My;
|
||||
using mRemoteNG.Security;
|
||||
using mRemoteNG.Security.SymmetricEncryption;
|
||||
using mRemoteNG.Tools;
|
||||
using mRemoteNG.UI.TaskDialog;
|
||||
using mRemoteNG.UI.Window;
|
||||
@@ -100,8 +101,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
chkUseProxyAuthentication.Checked = Convert.ToBoolean(Settings.Default.UpdateProxyUseAuthentication);
|
||||
pnlProxyAuthentication.Enabled = Convert.ToBoolean(Settings.Default.UpdateProxyUseAuthentication);
|
||||
txtProxyUsername.Text = Convert.ToString(Settings.Default.UpdateProxyAuthUser);
|
||||
txtProxyPassword.Text = Crypt.Decrypt(Convert.ToString(Settings.Default.UpdateProxyAuthPass),
|
||||
GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
txtProxyPassword.Text = cryptographyProvider.Decrypt(Convert.ToString(Settings.Default.UpdateProxyAuthPass), GeneralAppInfo.EncryptionKey);
|
||||
|
||||
btnTestProxy.Enabled = Convert.ToBoolean(Settings.Default.UpdateUseProxy);
|
||||
|
||||
@@ -140,7 +141,8 @@ namespace mRemoteNG.UI.Forms.OptionsPages
|
||||
|
||||
Settings.Default.UpdateProxyUseAuthentication = chkUseProxyAuthentication.Checked;
|
||||
Settings.Default.UpdateProxyAuthUser = txtProxyUsername.Text;
|
||||
Settings.Default.UpdateProxyAuthPass = Crypt.Encrypt(txtProxyPassword.Text, GeneralAppInfo.EncryptionKey);
|
||||
var cryptographyProvider = new LegacyRijndaelCryptographyProvider();
|
||||
Settings.Default.UpdateProxyAuthPass = cryptographyProvider.Encrypt(txtProxyPassword.Text, GeneralAppInfo.EncryptionKey);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
43
mRemoteV1/UI/Forms/frmMain.Designer.cs
generated
43
mRemoteV1/UI/Forms/frmMain.Designer.cs
generated
@@ -89,7 +89,10 @@ namespace mRemoteNG.UI.Forms
|
||||
this.mMenFileRename.Click += new System.EventHandler(mMenFileRename_Click);
|
||||
this.mMenFileDuplicate = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mMenFileDuplicate.Click += new System.EventHandler(mMenFileDuplicate_Click);
|
||||
this.mMenFileSep4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mMenFileSep4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mMenReconnectAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mMenReconnectAll.Click += new System.EventHandler(mMenReconnectAll_Click);
|
||||
this.mMenFileSep5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mMenFileExit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mMenFileExit.Click += new System.EventHandler(mMenFileExit_Click);
|
||||
this.mMenView = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -266,7 +269,7 @@ namespace mRemoteNG.UI.Forms
|
||||
//
|
||||
//mMenFile
|
||||
//
|
||||
this.mMenFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.mMenFileNewConnection, this.mMenFileNewFolder, this.mMenFileSep1, this.mMenFileNew, this.mMenFileLoad, this.mMenFileSave, this.mMenFileSaveAs, this.mMenFileSep2, this.mMenFileDelete, this.mMenFileRename, this.mMenFileDuplicate, this.mMenFileSep3, this.mMenFileImport, this.mMenFileExport, this.mMenFileSep4, this.mMenFileExit});
|
||||
this.mMenFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {this.mMenFileNewConnection, this.mMenFileNewFolder, this.mMenFileSep1, this.mMenFileNew, this.mMenFileLoad, this.mMenFileSave, this.mMenFileSaveAs, this.mMenFileSep2, this.mMenFileDelete, this.mMenFileRename, this.mMenFileDuplicate, this.mMenFileSep4, this.mMenReconnectAll, this.mMenFileSep3, this.mMenFileImport, this.mMenFileExport, this.mMenFileSep5, this.mMenFileExit});
|
||||
this.mMenFile.Name = "mMenFile";
|
||||
this.mMenFile.Size = new System.Drawing.Size(37, 20);
|
||||
this.mMenFile.Text = "&File";
|
||||
@@ -386,15 +389,27 @@ namespace mRemoteNG.UI.Forms
|
||||
this.mMenFileDuplicate.Name = "mMenFileDuplicate";
|
||||
this.mMenFileDuplicate.Size = new System.Drawing.Size(281, 22);
|
||||
this.mMenFileDuplicate.Text = "Duplicate";
|
||||
//
|
||||
//mMenFileSep4
|
||||
//
|
||||
this.mMenFileSep4.Name = "mMenFileSep4";
|
||||
//
|
||||
//mMenFileReconnectAll
|
||||
//
|
||||
this.mMenReconnectAll.Image = Resources.Refresh;
|
||||
this.mMenReconnectAll.Name = "mMenFileReconnectAll";
|
||||
this.mMenReconnectAll.Size = new System.Drawing.Size(281, 22);
|
||||
this.mMenReconnectAll.Text = "Reconnect All Connections";
|
||||
//
|
||||
//mMenFileSep4
|
||||
//
|
||||
this.mMenFileSep4.Name = "mMenFileSep4";
|
||||
this.mMenFileSep4.Size = new System.Drawing.Size(278, 6);
|
||||
//
|
||||
//mMenFileExit
|
||||
//
|
||||
this.mMenFileExit.Image = Resources.Quit;
|
||||
//
|
||||
//mMenFileSep5
|
||||
//
|
||||
this.mMenFileSep5.Name = "mMenFileSep5";
|
||||
this.mMenFileSep5.Size = new System.Drawing.Size(278, 6);
|
||||
//
|
||||
//mMenFileExit
|
||||
//
|
||||
this.mMenFileExit.Image = Resources.Quit;
|
||||
this.mMenFileExit.Name = "mMenFileExit";
|
||||
this.mMenFileExit.ShortcutKeys = (System.Windows.Forms.Keys) (System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4);
|
||||
this.mMenFileExit.Size = new System.Drawing.Size(281, 22);
|
||||
@@ -933,13 +948,15 @@ namespace mRemoteNG.UI.Forms
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenToolsUpdate;
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenViewResetLayout;
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenFileDuplicate;
|
||||
internal System.Windows.Forms.ToolStripSeparator mMenFileSep2;
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenReconnectAll;
|
||||
internal System.Windows.Forms.ToolStripSeparator mMenFileSep2;
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenFileNewConnection;
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenFileNewFolder;
|
||||
internal System.Windows.Forms.ToolStripSeparator mMenFileSep3;
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenFileDelete;
|
||||
internal System.Windows.Forms.ToolStripSeparator mMenFileSep4;
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenFileDelete;
|
||||
internal System.Windows.Forms.ToolStripMenuItem mMenFileRename;
|
||||
internal System.Windows.Forms.ToolStripSeparator mMenFileSep4;
|
||||
internal System.Windows.Forms.ToolStripSeparator mMenFileSep5;
|
||||
internal System.Windows.Forms.ToolStrip ToolStrip1;
|
||||
internal System.Windows.Forms.ToolStripButton ToolStripButton1;
|
||||
internal System.Windows.Forms.ToolStripButton ToolStripButton2;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user