refactor: Apply the async logic for Credentials and Updates registry settings, remove obsolete code

- Moved async registry loading logic to OptRegistryCredentialsPage and OptRegistryUpdatesPage to improve structure and maintainability.
- Removed obsolete logic and redundant code that is no longer needed due to the new asynchronous architecture.
- Enhanced settings management to take advantage of the just-in-time loading mechanism.
- Improved performance by ensuring registry settings are loaded asynchronously right before they are needed by the UI or application logic, minimizing unnecessary loads.
- Update documents
This commit is contained in:
xRushG
2024-10-01 12:19:41 +02:00
parent 9b28b7057d
commit 5e3bce9a92
13 changed files with 763 additions and 631 deletions

View File

@@ -16,17 +16,72 @@ namespace mRemoteNG.App.Info
#region Key Locations
// StartupExit
// Registry subkey for general application startup and exit settings
// Registry subkey for startup and exit options page settings
public const string StartupExit = RootKey + "\\StartupExit";
public const string StartupExitOptions = StartupExit + "\\" + OptionsSubKey;
// Appearance
// Registry subkey for general application appearance settings
// Registry subkey for appearance options page settings
public const string Appearance = RootKey + "\\Appearance";
public const string AppearanceOptions = Appearance + "\\" + OptionsSubKey;
// Connections
// Registry subkey for general application connection settings
// Registry subkey for connections options page settings
public const string Connection = RootKey + "\\Connections";
public const string ConnectionOptions = Connection + "\\" + OptionsSubKey;
// Tabs & Panels
// Registry subkey for general application tabs and panels settings
// Registry subkey for tabs and panels options page settings
public const string TabsAndPanels = RootKey + "\\TabsAndPanels";
public const string TabsAndPanelsOptions = TabsAndPanels + "\\" + OptionsSubKey;
// Notifications
// Registry subkey for general application notifications settings
// Registry subkey for notifications options page settings
public const string Notification = RootKey + "\\Notifications";
public const string NotificationOptions = Notification + "\\" + OptionsSubKey;
// Credential
// Registry subkey for general application credentials settings
// Registry subkey for credentials options page settings
public const string Credential = RootKey + "\\Credentials";
public const string CredentialOptions = Credential + "\\" + OptionsSubKey;
// SQL Server
// Registry subkey for general application SQL server settings
// Registry subkey for SQL server options page settings
public const string SQLServer = RootKey + "\\SQLServer";
public const string SQLServerOptions = SQLServer + "\\" + OptionsSubKey;
// Updates
// Registry subkey for general application update settings
// Registry subkey for updates options page settings
public const string Update = RootKey + "\\Updates";
public const string UpdateOptions = Update + "\\" + OptionsSubKey;
// Security
// Registry subkey for general application security settings
// Registry subkey for security options page settings
public const string Security = RootKey + "\\Security";
public const string SecurityOptions = Security + "\\" + OptionsSubKey;
// Advanced
// Registry subkey for general application advanced settings
// Registry subkey for advanced options page settings
public const string Advanced = RootKey + "\\Advanced";
public const string AdvancedOptions = Advanced + "\\" + OptionsSubKey;
// Backup
// Registry subkey for general application backup settings
// Registry subkey for backup options page settings
public const string Backup = RootKey + "\\Backup";
public const string BackupOptions = Backup + "\\" + OptionsSubKey;
#endregion
}
}

View File

@@ -6,9 +6,6 @@ using mRemoteNG.Tools.WindowsRegistry;
namespace mRemoteNG.Config.Settings.Registry
{
[SupportedOSPlatform("windows")]
/// Static utility class that provides access to and management of registry settings on the local machine.
/// It abstracts complex registry operations and centralizes the handling of various registry keys.
/// Benefits: Simplified code, enhances maintainability, and ensures consistency. #ReadOnly
public static class CommonRegistrySettings
{
#region general update registry settings
@@ -37,10 +34,6 @@ namespace mRemoteNG.Config.Settings.Registry
/// </remarks>
public static bool AllowCheckForUpdatesManual { get; }
/// <summary>
/// Specifies whether a question about checking for updates is displayed at startup.
/// </summary>
public static bool AllowPromptForUpdatesPreference { get; }
#endregion
@@ -70,21 +63,21 @@ namespace mRemoteNG.Config.Settings.Registry
static CommonRegistrySettings()
{
IRegistry regValueUtility = new WinRegistry();
IRegistryRead regValueUtility = new WinRegistry();
RegistryHive hive = WindowsRegistryInfo.Hive;
#region update registry settings setup
#region update registry settings
string updateSubkey = WindowsRegistryInfo.Update;
AllowCheckForUpdates = regValueUtility.GetBoolValue(hive, updateSubkey, nameof(AllowCheckForUpdates), true);
AllowCheckForUpdatesAutomatical = regValueUtility.GetBoolValue(hive, updateSubkey, nameof(AllowCheckForUpdatesAutomatical), AllowCheckForUpdates);
AllowCheckForUpdatesManual = regValueUtility.GetBoolValue(hive, updateSubkey, nameof(AllowCheckForUpdatesManual), AllowCheckForUpdates);
AllowPromptForUpdatesPreference = regValueUtility.GetBoolValue(hive, updateSubkey, nameof(AllowPromptForUpdatesPreference), AllowCheckForUpdates);
#endregion
#region credential registry settings setup
#region credential registry settings
string credentialSubkey = WindowsRegistryInfo.Credential;

View File

@@ -1,30 +1,24 @@
using System.Runtime.Versioning;
using Microsoft.Win32;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools.WindowsRegistry;
namespace mRemoteNG.Config.Settings.Registry
{
[SupportedOSPlatform("windows")]
/// Static utility class that provides access to and management of registry settings on the local machine.
/// It abstracts complex registry operations and centralizes the handling of various registry keys.
/// Benefits: Simplified code, enhances maintainability, and ensures consistency. #ReadOnly
public sealed partial class OptRegistryCredentialsPage
{
#region option page credential registry settings
/// <summary>
/// Indicates whether modifying credential page settings is enabled.
/// </summary>
public bool CredentialPageEnabled { get; }
/// <summary>
/// Specifies the radio button is set to none, windows or custom on the credentials page.
/// </summary>
/// <remarks>
/// When set to noinfo or windows, WindowsCredentials and CustomCredentials are not evaluated and disabled.
/// </remarks>
public WinRegistryEntry<string> UseCredentials { get; }
public WinRegistryEntry<string> UseCredentials { get; private set; }
/// <summary>
/// Specifies the user set via API as the default username.
@@ -32,7 +26,7 @@ namespace mRemoteNG.Config.Settings.Registry
/// <remarks>
/// Only avaiable if UseCredentials is set to custom!
/// </remarks>
public WinRegistryEntry<string> UserViaAPIDefault { get; }
public WinRegistryEntry<string> UserViaAPIDefault { get; private set; }
/// <summary>
/// Specifies the default username.
@@ -40,7 +34,7 @@ namespace mRemoteNG.Config.Settings.Registry
/// <remarks>
/// Only avaiable if UseCredentials is set to custom!
/// </remarks>
public WinRegistryEntry<string> DefaultUsername { get; }
public WinRegistryEntry<string> DefaultUsername { get; private set; }
/// <summary>
/// Specifies the default password.
@@ -48,7 +42,7 @@ namespace mRemoteNG.Config.Settings.Registry
/// <remarks>
/// Only avaiable if UseCredentials is set to custom!
/// </remarks>
public WinRegistryEntry<string> DefaultPassword { get; }
public WinRegistryEntry<string> DefaultPassword { get; private set; }
/// <summary>
/// Specifies the default domain.
@@ -56,27 +50,129 @@ namespace mRemoteNG.Config.Settings.Registry
/// <remarks>
/// Only avaiable if UseCredentials is set to custom!
/// </remarks>
public WinRegistryEntry<string> DefaultDomain { get; }
public WinRegistryEntry<string> DefaultDomain { get; private set; }
/// <summary>
/// Specifies that entering the custom default username field is enabled.
/// </summary>
public bool DefaultUsernameEnabled { get; private set; }
/// <summary>
/// Specifies that entering the custom default password field is enabled.
/// </summary>
public bool DefaultPasswordEnabled { get; private set; }
/// <summary>
/// Specifies that entering the custom default api user field is enabled.
/// </summary>
public bool DefaultUserViaAPIEnabled { get; private set; }
#endregion
public OptRegistryCredentialsPage()
{
IRegistry regValueUtility = new WinRegistry();
IRegistryRead regValueUtility = new WinRegistry();
RegistryHive hive = WindowsRegistryInfo.Hive;
string subKey = WindowsRegistryInfo.CredentialOptions;
CredentialPageEnabled = regValueUtility.GetBoolValue(hive, subKey, nameof(CredentialPageEnabled), true);
UseCredentials = new WinRegistryEntry<string>(hive, subKey, nameof(UseCredentials)).SetValidation(
new string[] {
"noinfo",
"windows",
"custom"
}).Read();
UseCredentials = new WinRegistryEntry<string>(hive, subKey, nameof(UseCredentials)).Read();
UserViaAPIDefault = new WinRegistryEntry<string>(hive, subKey, nameof(UserViaAPIDefault)).Read();
DefaultUsername = new WinRegistryEntry<string>(hive, subKey, nameof(DefaultUsername)).Read();
DefaultPassword = new WinRegistryEntry<string>(hive, subKey, nameof(DefaultPassword)).Read();
DefaultDomain = new WinRegistryEntry<string>(hive, subKey, nameof(DefaultDomain)).Read();
DefaultUsernameEnabled = regValueUtility.GetBoolValue(hive, subKey, nameof(DefaultUsernameEnabled), true);
DefaultPasswordEnabled = regValueUtility.GetBoolValue(hive, subKey, nameof(DefaultPasswordEnabled), true);
DefaultUserViaAPIEnabled = regValueUtility.GetBoolValue(hive, subKey, nameof(DefaultUserViaAPIEnabled), true);
SetupValidation();
Apply();
}
/// <summary>
/// Configures validation settings for various parameters
/// </summary>
private void SetupValidation()
{
UseCredentials.SetValidation(
new string[] {
"noinfo",
"windows",
"custom"
});
}
/// <summary>
/// Applies registry settings and overrides various properties.
/// </summary>
private void Apply()
{
// UseCredentials musst be present in registry.
if (! UseCredentials.IsSet)
return;
ApplyUseCredentials();
// UseCredentials musst be set to custom.
if (UseCredentials.Value != "custom")
return;
ApplyDefaultUsername();
ApplyDefaultPassword();
ApplyDefaultDomain();
ApplyUserViaAPIDefault();
}
private void ApplyUseCredentials()
{
if (UseCredentials.IsValid)
Properties.OptionsCredentialsPage.Default.EmptyCredentials = UseCredentials.Value;
}
private void ApplyDefaultUsername()
{
if (DefaultUsername.IsSet && DefaultUsernameEnabled)
Properties.OptionsCredentialsPage.Default.DefaultUsername = DefaultUsername.Value;
else if (!DefaultUsernameEnabled)
Properties.OptionsCredentialsPage.Default.DefaultUsername = "";
}
private void ApplyDefaultPassword()
{
if (DefaultPassword.IsSet && DefaultPasswordEnabled)
{
try
{
LegacyRijndaelCryptographyProvider cryptographyProvider = new();
string decryptedPassword;
string defaultPassword = DefaultPassword.Value;
decryptedPassword = cryptographyProvider.Decrypt(defaultPassword, Runtime.EncryptionKey);
Properties.OptionsCredentialsPage.Default.DefaultPassword = defaultPassword;
}
catch
{
// Fire-and-forget: The DefaultPassword in the registry is not encrypted.
DefaultPassword.Clear();
}
}
else if (!DefaultPasswordEnabled)
{
Properties.OptionsCredentialsPage.Default.DefaultPassword = "";
}
}
private void ApplyDefaultDomain()
{
if (DefaultDomain.IsSet)
Properties.OptionsCredentialsPage.Default.DefaultDomain = DefaultDomain.Value;
}
private void ApplyUserViaAPIDefault()
{
if (UserViaAPIDefault.IsSet && DefaultUserViaAPIEnabled)
Properties.OptionsCredentialsPage.Default.UserViaAPIDefault = UserViaAPIDefault.Value;
else if (!DefaultUserViaAPIEnabled)
Properties.OptionsCredentialsPage.Default.UserViaAPIDefault = "";
}
}
}

View File

@@ -1,20 +1,24 @@
using System.Runtime.Versioning;
using Microsoft.Win32;
using mRemoteNG.App;
using mRemoteNG.App.Info;
using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Tools.WindowsRegistry;
namespace mRemoteNG.Config.Settings.Registry
{
[SupportedOSPlatform("windows")]
/// Static utility class that provides access to and management of registry settings on the local machine.
/// It abstracts complex registry operations and centralizes the handling of various registry keys.
/// Benefits: Simplified code, enhances maintainability, and ensures consistency. #ReadOnly
public sealed partial class OptRegistryUpdatesPage
{
/// <summary>
/// Specifies whether a popup is shown to configure update preferences at startup.
/// </summary>
public WinRegistryEntry<bool> DisallowPromptForUpdatesPreference { get; private set; }
/// <summary>
/// Specifies the number of days between update checks.
/// </summary>
public WinRegistryEntry<int> CheckForUpdatesFrequencyDays { get; }
public WinRegistryEntry<int> CheckForUpdatesFrequencyDays { get; private set; }
/// <summary>
/// Specifies the update channel for updates.
@@ -22,58 +26,213 @@ namespace mRemoteNG.Config.Settings.Registry
/// <remarks>
/// The update channel should be one of the predefined values: Stable, Preview, Nightly.
/// </remarks>
public WinRegistryEntry<string> UpdateChannel { get; }
public WinRegistryEntry<string> UpdateChannel { get; private set; }
/// <summary>
/// Indicates whether proxy usage for updates is enabled.
/// </summary>
public WinRegistryEntry<bool> UseProxyForUpdates { get; }
public WinRegistryEntry<bool> UseProxyForUpdates { get; private set; }
/// <summary>
/// Specifies the proxy address for updates.
/// </summary>
public WinRegistryEntry<string> ProxyAddress { get; }
public WinRegistryEntry<string> ProxyAddress { get; private set; }
/// <summary>
/// Specifies the proxy port for updates.
/// </summary>
public WinRegistryEntry<int> ProxyPort { get; }
public WinRegistryEntry<int> ProxyPort { get; private set; }
/// <summary>
/// Indicates whether proxy authentication is enabled.
/// </summary>
public WinRegistryEntry<bool> UseProxyAuthentication { get; }
public WinRegistryEntry<bool> UseProxyAuthentication { get; private set; }
/// <summary>
/// Specifies the authentication username for the proxy.
/// </summary>
public WinRegistryEntry<string> ProxyAuthUser { get; }
public WinRegistryEntry<string> ProxyAuthUser { get; private set; }
/// <summary>
/// Specifies the authentication password for the proxy.
/// </summary>
public WinRegistryEntry<string> ProxyAuthPass { get; }
public WinRegistryEntry<string> ProxyAuthPass { get; private set; }
public OptRegistryUpdatesPage()
{
RegistryHive hive = WindowsRegistryInfo.Hive;
string subKey = WindowsRegistryInfo.UpdateOptions;
DisallowPromptForUpdatesPreference = new WinRegistryEntry<bool>(hive, subKey, nameof(DisallowPromptForUpdatesPreference)).Read();
CheckForUpdatesFrequencyDays = new WinRegistryEntry<int>(hive, subKey, nameof(CheckForUpdatesFrequencyDays)).Read();
UpdateChannel = new WinRegistryEntry<string>(hive, subKey, nameof(UpdateChannel))
.SetValidation(new string[] {
UpdateChannelInfo.STABLE,
UpdateChannelInfo.PREVIEW,
UpdateChannelInfo.NIGHTLY
}).Read();
UpdateChannel = new WinRegistryEntry<string>(hive, subKey, nameof(UpdateChannel)).Read();
UseProxyForUpdates = new WinRegistryEntry<bool>(hive, subKey, nameof(UseProxyForUpdates)).Read();
ProxyAddress = new WinRegistryEntry<string>(hive, subKey, nameof(ProxyAddress)).Read();
ProxyPort = new WinRegistryEntry<int>(hive, subKey, nameof(ProxyPort)).Read();
UseProxyAuthentication = new WinRegistryEntry<bool>(hive, subKey, nameof(UseProxyAuthentication)).Read();
ProxyAuthUser = new WinRegistryEntry<string>(hive, subKey, nameof(ProxyAuthUser)).Read();
ProxyAuthPass = new WinRegistryEntry<string>(hive, subKey, nameof(ProxyAuthPass)).Read();
SetupValidation();
Apply();
}
/// <summary>
/// Configures validation settings for various parameters
/// </summary>
private void SetupValidation()
{
var connectionsPage = new UI.Forms.OptionsPages.UpdatesPage();
UpdateChannel.SetValidation(new string[] {
UpdateChannelInfo.STABLE,
UpdateChannelInfo.PREVIEW,
UpdateChannelInfo.NIGHTLY
});
int proxyPortMin = (int)connectionsPage.numProxyPort.Minimum;
int proxyPortMax = (int)connectionsPage.numProxyPort.Maximum;
ProxyPort.SetValidation(proxyPortMin, proxyPortMax);
}
/// <summary>
/// Applies registry settings and overrides various properties.
/// </summary>
private void Apply()
{
// Common settings were applied, all update settings are disabled.
if (ApplyCommonUpdateCheckSettings())
return;
ApplyAllowPromptForUpdatesPreference();
ApplyCheckForUpdatesOnStartup();
ApplyCheckForUpdatesFrequencyDays();
ApplyUpdateChannel();
ApplyProxyForUpdates();
ApplyAuthentication();
}
private static bool ApplyCommonUpdateCheckSettings()
{
bool updatesNotAllowed =
!CommonRegistrySettings.AllowCheckForUpdates
|| (!CommonRegistrySettings.AllowCheckForUpdatesAutomatical
&& !CommonRegistrySettings.AllowCheckForUpdatesManual);
if (updatesNotAllowed)
{
Properties.OptionsUpdatesPage.Default.CheckForUpdatesAsked = true;
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = false;
Properties.OptionsUpdatesPage.Default.CheckForUpdatesFrequencyDays = 14;
Properties.OptionsUpdatesPage.Default.UpdateUseProxy = false;
Properties.OptionsUpdatesPage.Default.UpdateProxyAddress = "";
Properties.OptionsUpdatesPage.Default.UpdateProxyPort = 80;
Properties.OptionsUpdatesPage.Default.UpdateProxyUseAuthentication = false;
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthUser = "";
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthPass = "";
}
return updatesNotAllowed;
}
private void ApplyAllowPromptForUpdatesPreference()
{
if (DisallowPromptForUpdatesPreference.IsSet && DisallowPromptForUpdatesPreference.Value == true)
Properties.OptionsUpdatesPage.Default.CheckForUpdatesAsked = true;
}
private void ApplyCheckForUpdatesOnStartup()
{
if (!CommonRegistrySettings.AllowCheckForUpdatesAutomatical)
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = false;
}
private void ApplyCheckForUpdatesFrequencyDays()
{
if (CommonRegistrySettings.AllowCheckForUpdatesAutomatical && CheckForUpdatesFrequencyDays.IsSet)
{
if (CheckForUpdatesFrequencyDays.Value < 0)
{
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = false;
}
else if (CheckForUpdatesFrequencyDays.IsValid)
{
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = true;
Properties.OptionsUpdatesPage.Default.CheckForUpdatesFrequencyDays = CheckForUpdatesFrequencyDays.Value;
}
}
}
private void ApplyUpdateChannel()
{
if (UpdateChannel.IsValid)
Properties.OptionsUpdatesPage.Default.UpdateChannel = UpdateChannel.Value;
}
private void ApplyProxyForUpdates()
{
if (UseProxyForUpdates.IsSet)
{
Properties.OptionsUpdatesPage.Default.UpdateUseProxy = UseProxyForUpdates.Value;
if (!UseProxyForUpdates.Value)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyAddress = "";
Properties.OptionsUpdatesPage.Default.UpdateProxyPort = 80;
Properties.OptionsUpdatesPage.Default.UpdateProxyUseAuthentication = false;
}
if (ProxyAddress.IsSet && UseProxyForUpdates.Value)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyAddress = ProxyAddress.Value;
}
if (ProxyPort.IsValid && UseProxyForUpdates.Value)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyPort = ProxyPort.Value;
}
}
}
private void ApplyAuthentication()
{
if (UseProxyForUpdates.Value && UseProxyAuthentication.IsSet)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyUseAuthentication = UseProxyAuthentication.Value;
if (!UseProxyAuthentication.Value)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthUser = "";
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthPass = "";
}
if (ProxyAuthUser.IsSet && UseProxyAuthentication.Value)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthUser = ProxyAuthUser.Value;
}
if (ProxyAuthPass.IsSet && UseProxyAuthentication.Value)
{
try
{
LegacyRijndaelCryptographyProvider cryptographyProvider = new();
string decryptedPassword;
string proxyAuthPass = ProxyAuthPass.Value;
decryptedPassword = cryptographyProvider.Decrypt(proxyAuthPass, Runtime.EncryptionKey);
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthPass = decryptedPassword;
}
catch
{
// The password in the registry is not encrypted.
}
}
}
}
}
}

View File

@@ -5,17 +5,13 @@ using mRemoteNG.Security.SymmetricEncryption;
using mRemoteNG.Resources.Language;
using System.Runtime.Versioning;
using mRemoteNG.Config.Settings.Registry;
using System.DirectoryServices;
namespace mRemoteNG.UI.Forms.OptionsPages
{
[SupportedOSPlatform("windows")]
public sealed partial class CredentialsPage : OptionsPage
{
#region Private Fields
private readonly OptRegistryCredentialsPage _RegistrySettings = new();
#endregion
private OptRegistryCredentialsPage pageRegSettingsInstance;
public CredentialsPage()
{
InitializeComponent();
@@ -44,9 +40,6 @@ namespace mRemoteNG.UI.Forms.OptionsPages
public override void LoadSettings()
{
if (!_RegistrySettings.CredentialPageEnabled)
return;
// ReSharper disable once SwitchStatementMissingSomeCases
switch (Properties.OptionsCredentialsPage.Default.EmptyCredentials)
{
@@ -92,156 +85,101 @@ namespace mRemoteNG.UI.Forms.OptionsPages
public override void LoadRegistrySettings()
{
// CredentialPageEnabled reg setting: enabled/default: true; Disabled: false.
if (!_RegistrySettings.CredentialPageEnabled)
{
DisablePage();
Type settingsType = typeof(OptRegistryCredentialsPage);
RegistryLoader.RegistrySettings.TryGetValue(settingsType, out var settings);
pageRegSettingsInstance = settings as OptRegistryCredentialsPage;
RegistryLoader.Cleanup(settingsType);
// Show registry settings info if any common setting is used.
lblRegistrySettingsUsedInfo.Visible = CommonRegistrySettingsUsed();
// UseCredentials reg setting must be set (and valid).
if (!pageRegSettingsInstance.UseCredentials.IsValid)
return;
}
// UseCredentials reg setting with validation:
// 1. Is not set or valid, stop processing.
// 2. Set the 'EmptyCredentials' option based on value
// 3. Only proceed when "custom"
if (!_RegistrySettings.UseCredentials.IsValid) { return; }
else if (_RegistrySettings.UseCredentials.IsValid)
lblRegistrySettingsUsedInfo.Visible = true;
// UseCredentials reg setting:
// Disable the radio controls based on value.
// Only proceed when "custom".
switch (pageRegSettingsInstance.UseCredentials.Value)
{
Properties.OptionsCredentialsPage.Default.EmptyCredentials = _RegistrySettings.UseCredentials.Value;
switch (Properties.OptionsCredentialsPage.Default.EmptyCredentials)
{
case "noinfo":
DisableControl(radCredentialsWindows);
DisableControl(radCredentialsCustom);
SetVisibilitySettingsUsedInfo();
return;
case "windows":
DisableControl(radCredentialsNoInfo);
DisableControl(radCredentialsCustom);
SetVisibilitySettingsUsedInfo();
return;
case "custom":
DisableControl(radCredentialsNoInfo);
DisableControl(radCredentialsWindows);
break;
}
case "noinfo":
DisableControl(radCredentialsWindows);
DisableControl(radCredentialsCustom);
return;
case "windows":
DisableControl(radCredentialsNoInfo);
DisableControl(radCredentialsCustom);
return;
case "custom":
DisableControl(radCredentialsNoInfo);
DisableControl(radCredentialsWindows);
break;
default:
return;
}
// ***
// The following is only used when set to custom!
// DefaultUsername reg setting: set DefaultUsername option based on value
if (_RegistrySettings.DefaultUsername.IsSet)
{
Properties.OptionsCredentialsPage.Default.DefaultUsername = _RegistrySettings.DefaultUsername.Value;
// Disable controls based on the registry settings.
//
if (pageRegSettingsInstance.DefaultUsername.IsSet)
DisableControl(txtCredentialsUsername);
}
// DefaultPassword reg setting:
// 1. Test decription works to prevents potential issues
// 2. Set DefaultPassword option based on value
// 3. Clears reg setting if fails
if (_RegistrySettings.DefaultPassword.IsSet)
{
try
{
LegacyRijndaelCryptographyProvider cryptographyProvider = new();
string decryptedPassword;
string defaultPassword = _RegistrySettings.DefaultPassword.Value;
if (pageRegSettingsInstance.DefaultPassword.IsSet)
DisableControl(txtCredentialsPassword);
decryptedPassword = cryptographyProvider.Decrypt(defaultPassword, Runtime.EncryptionKey);
Properties.OptionsCredentialsPage.Default.DefaultPassword = defaultPassword;
DisableControl(txtCredentialsPassword);
}
catch
{
// Fire-and-forget: The DefaultPassword in the registry is not encrypted.
_RegistrySettings.DefaultPassword.Clear();
}
}
// DefaultDomain reg setting: set DefaultDomain option based on value
if (_RegistrySettings.DefaultDomain.IsSet)
{
Properties.OptionsCredentialsPage.Default.DefaultDomain = _RegistrySettings.DefaultDomain.Value;
if (pageRegSettingsInstance.DefaultDomain.IsSet)
DisableControl(txtCredentialsDomain);
}
// UserViaAPIDefault reg setting: set UserViaAPIDefault option based on value
if (_RegistrySettings.UserViaAPIDefault.IsSet)
{
Properties.OptionsCredentialsPage.Default.UserViaAPIDefault = _RegistrySettings.UserViaAPIDefault.Value;
if (pageRegSettingsInstance.UserViaAPIDefault.IsSet)
DisableControl(txtCredentialsUserViaAPI);
}
SetVisibilitySettingsUsedInfo();
}
/// <summary>
/// Checks if any credantil registry settings are being used.
/// Checks if any registry common setting is used.
/// </summary>
/// <returns>
/// True if any relevant registry settings are used; otherwise, false.
/// </returns>
public override bool ShowRegistrySettingsUsedInfo()
private static bool CommonRegistrySettingsUsed()
{
return !CommonRegistrySettings.AllowExportPasswords
|| !CommonRegistrySettings.AllowExportUsernames
|| !CommonRegistrySettings.AllowSavePasswords
|| !CommonRegistrySettings.AllowSaveUsernames
|| !_RegistrySettings.CredentialPageEnabled
|| _RegistrySettings.UseCredentials.IsValid;
/*
* Checking these values is unnecessary because UseCredentials must be valid and set to Custom.
*
||_RegistrySettings.DefaultUsername.IsSet
|| _RegistrySettings.DefaultPassword.IsSet
|| _RegistrySettings.DefaultDomain.IsSet
|| _RegistrySettings.UserViaAPIDefault.IsSet;
*/
}
/// <summary>
/// Disables the page by setting default values and disabling controls.
/// </summary>
public override void DisablePage()
{
Properties.OptionsCredentialsPage.Default.EmptyCredentials = "noinfo";
radCredentialsWindows.Enabled = false;
radCredentialsCustom.Enabled = false;
txtCredentialsUsername.Enabled = false;
txtCredentialsPassword.Enabled = false;
txtCredentialsDomain.Enabled = false;
txtCredentialsUserViaAPI.Enabled = false;
SetVisibilitySettingsUsedInfo();
|| !CommonRegistrySettings.AllowSaveUsernames;
}
#region Event Handlers
/// <summary>
/// Handles the CheckedChanged event for the custom credentials radio button.
/// Enables or disables credential input fields based on the state of the radio button
/// and the availability of saved settings in the registry.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">Event data containing information about the event.</param>
private void radCredentialsCustom_CheckedChanged(object sender, EventArgs e)
{
if (!_RegistrySettings.DefaultUsername.IsSet && CommonRegistrySettings.AllowSaveUsernames)
if (!pageRegSettingsInstance.DefaultUsername.IsSet && pageRegSettingsInstance.DefaultUsernameEnabled)
{
lblCredentialsUsername.Enabled = radCredentialsCustom.Checked;
txtCredentialsUsername.Enabled = radCredentialsCustom.Checked;
}
if (!_RegistrySettings.DefaultPassword.IsSet && CommonRegistrySettings.AllowSavePasswords)
if (!pageRegSettingsInstance.DefaultPassword.IsSet && pageRegSettingsInstance.DefaultPasswordEnabled)
{
lblCredentialsPassword.Enabled = radCredentialsCustom.Checked;
txtCredentialsPassword.Enabled = radCredentialsCustom.Checked;
}
if (!_RegistrySettings.DefaultDomain.IsSet)
if (!pageRegSettingsInstance.DefaultDomain.IsSet)
{
lblCredentialsDomain.Enabled = radCredentialsCustom.Checked;
txtCredentialsDomain.Enabled = radCredentialsCustom.Checked;
}
if (!_RegistrySettings.UserViaAPIDefault.IsSet && CommonRegistrySettings.AllowSaveUsernames)
if (!pageRegSettingsInstance.UserViaAPIDefault.IsSet && pageRegSettingsInstance.DefaultUserViaAPIEnabled)
{
lblCredentialsUserViaAPI.Enabled = radCredentialsCustom.Checked;
txtCredentialsUserViaAPI.Enabled = radCredentialsCustom.Checked;
@@ -250,16 +188,5 @@ namespace mRemoteNG.UI.Forms.OptionsPages
#endregion
#region Private Methods
/// <summary>
/// Updates the visibility of the information label indicating whether registry settings are used.
/// </summary>
private void SetVisibilitySettingsUsedInfo()
{
lblRegistrySettingsUsedInfo.Visible = ShowRegistrySettingsUsedInfo();
}
#endregion
}
}

View File

@@ -45,29 +45,13 @@ namespace mRemoteNG.UI.Forms.OptionsPages
}
/// <summary>
/// Loads registry settings related to update options and proxy configurations.
/// This method retrieves values from the registry and initializes the corresponding controls
/// on the page with these values. It also updates internal flags and properties accordingly.
/// Checks if registry settings were applied and disables the corresponding UI controls.
/// If any settings are applied, it also displays an information label.
/// </summary>
public virtual void LoadRegistrySettings()
{
}
/// <summary>
/// Determines if any registry settings are being used.
/// </summary>
/// <returns>
/// A boolean value indicating whether registry settings are used, as determined by the configuration on the options page.
/// </returns>
public virtual bool ShowRegistrySettingsUsedInfo()
{
return false;
}
public virtual void DisablePage()
{
}
#endregion
protected virtual void ApplyTheme()

View File

@@ -1,5 +1,4 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using mRemoteNG.App;
using mRemoteNG.App.Info;
@@ -20,7 +19,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
#region Private Fields
private AppUpdater _appUpdate;
private readonly OptRegistryUpdatesPage _RegistrySettings = new();
private OptRegistryUpdatesPage pageRegSettingsInstance;
#endregion
@@ -66,18 +65,15 @@ namespace mRemoteNG.UI.Forms.OptionsPages
public override void LoadSettings()
{
// Checks the combination of the following registry settings:
// 1. AllowCheckForUpdates is false.
// 2. AllowCheckForUpdatesAutomatical and AllowCheckForUpdatesManual are false.
// 3. Disable page and stop processing at this point.
if (UpdatesForbidden())
return;
chkCheckForUpdatesOnStartup.Checked = Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup;
InitialiseCheckForUpdatesOnStartupComboBox();
InitialiseReleaseChannelComboBox();
// Checks updates are generaly disallowed
if (UpdatesForbidden())
return; // not required to continue
chkCheckForUpdatesOnStartup.Checked = Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup;
chkUseProxyForAutomaticUpdates.Checked = Properties.OptionsUpdatesPage.Default.UpdateUseProxy;
tblProxyBasic.Enabled = Properties.OptionsUpdatesPage.Default.UpdateUseProxy;
txtProxyAddress.Text = Properties.OptionsUpdatesPage.Default.UpdateProxyAddress;
@@ -97,12 +93,9 @@ namespace mRemoteNG.UI.Forms.OptionsPages
{
base.SaveSettings();
// Checks the combination of the following registry settings:
// 1. AllowCheckForUpdates is false.
// 2. AllowCheckForUpdatesAutomatical and AllowCheckForUpdatesManual are false.
// 3. Disable page and stop processing at this point.
// Checks updates are generaly disallowed
if (UpdatesForbidden())
return;
return; // not required to continue
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = chkCheckForUpdatesOnStartup.Checked;
@@ -138,160 +131,85 @@ namespace mRemoteNG.UI.Forms.OptionsPages
public override void LoadRegistrySettings()
{
// Checks the combination of the following registry settings:
// 1. AllowCheckForUpdates is false.
// 2. AllowCheckForUpdatesAutomatical and AllowCheckForUpdatesManual are false.
// 3. Disable page and stop processing at this point.
if (UpdatesForbidden())
return;
Type settingsType = typeof(OptRegistryUpdatesPage);
RegistryLoader.RegistrySettings.TryGetValue(settingsType, out var settings);
pageRegSettingsInstance = settings as OptRegistryUpdatesPage;
// AllowCheckForUpdatesAutomatical reg setting:
// 1. Allowed/default: true; Disabled: false.
// 2. Disable the option "check for updates on startup".
RegistryLoader.Cleanup(settingsType);
// Checks updates are generaly disallowed.
if (UpdatesForbidden())
{
DisableControl(chkCheckForUpdatesOnStartup);
DisableControl(cboUpdateCheckFrequency);
DisableControl(btnUpdateCheckNow);
DisableControl(cboReleaseChannel);
DisableControl(chkUseProxyForAutomaticUpdates);
DisableControl(tblProxyBasic);
DisableControl(txtProxyAddress);
DisableControl(numProxyPort);
DisableControl(chkUseProxyAuthentication);
DisableControl(tblProxyAuthentication);
DisableControl(txtProxyUsername);
DisableControl(txtProxyPassword);
DisableControl(btnTestProxy);
lblRegistrySettingsUsedInfo.Visible = true;
return; // not required to continue
}
// Disable the option "check for updates on startup" if auto updates is disallowed.
if (!CommonRegistrySettings.AllowCheckForUpdatesAutomatical)
{
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = false;
DisableControl(chkCheckForUpdatesOnStartup);
DisableControl(cboUpdateCheckFrequency);
}
// CheckForUpdatesFrequencyDays reg setting:
// 1. Is 0 or less, than CheckForUpdatesOnStartup will be disabled.
// 2. Is Valid than set CheckForUpdatesFrequencyDays option based on value.
if (CommonRegistrySettings.AllowCheckForUpdatesAutomatical && _RegistrySettings.CheckForUpdatesFrequencyDays.IsSet)
{
if (_RegistrySettings.CheckForUpdatesFrequencyDays.Value < 0)
{
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = false;
DisableControl(chkCheckForUpdatesOnStartup);
}
else if (_RegistrySettings.CheckForUpdatesFrequencyDays.IsValid)
{
Properties.OptionsUpdatesPage.Default.CheckForUpdatesOnStartup = true;
DisableControl(chkCheckForUpdatesOnStartup);
Properties.OptionsUpdatesPage.Default.CheckForUpdatesFrequencyDays = _RegistrySettings.CheckForUpdatesFrequencyDays.Value;
DisableControl(cboUpdateCheckFrequency);
}
}
// Enable or disable the "Update Check" button if allowed or not.
// Set Update Check button state based on manual update allow state.
btnUpdateCheckNow.Enabled = CommonRegistrySettings.AllowCheckForUpdatesManual;
// UpdateChannel reg setting: set UpdateChannel option based on value
if (_RegistrySettings.UpdateChannel.IsValid)
// Disable "CheckForUpdatesFrequencyDays" based on auto update allow state.
if (pageRegSettingsInstance.CheckForUpdatesFrequencyDays.IsSet && CommonRegistrySettings.AllowCheckForUpdatesAutomatical)
{
Properties.OptionsUpdatesPage.Default.UpdateChannel = _RegistrySettings.UpdateChannel.Value;
DisableControl(cboReleaseChannel);
DisableControl(chkCheckForUpdatesOnStartup);
DisableControl(cboUpdateCheckFrequency);
}
// UseProxyForUpdates reg setting: set UseProxyForUpdates option based on value
// 1. Continues with the options checks for "ProxyAddress" and "ProxyPort"
// 2. Moved on to the "UseProxyAuthentication" options if true
if (_RegistrySettings.UseProxyForUpdates.IsSet)
{
bool UseProxy = _RegistrySettings.UseProxyForUpdates.Value;
Properties.OptionsUpdatesPage.Default.UpdateUseProxy = UseProxy;
// ***
// Disable controls based on the registry settings.
//
if (pageRegSettingsInstance.UpdateChannel.IsSet)
DisableControl(cboReleaseChannel);
if (pageRegSettingsInstance.UseProxyForUpdates.IsSet)
DisableControl(chkUseProxyForAutomaticUpdates);
// If the proxy is not used, reset the proxy address, port, and authentication settings to defaults.
if (!UseProxy)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyAddress = "";
Properties.OptionsUpdatesPage.Default.UpdateProxyPort = 80;
Properties.OptionsUpdatesPage.Default.UpdateProxyUseAuthentication = false;
}
if (pageRegSettingsInstance.ProxyAddress.IsSet)
DisableControl(txtProxyAddress);
// ProxyAddress reg setting: set ProxyAddress option based on value
if (_RegistrySettings.ProxyAddress.IsSet && UseProxy)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyAddress = _RegistrySettings.ProxyAddress.Value;
DisableControl(txtProxyAddress);
}
if (pageRegSettingsInstance.ProxyPort.IsSet)
DisableControl(numProxyPort);
// ProxyPort reg setting: set ProxyPort option based on value
if (_RegistrySettings.ProxyPort.IsSet && UseProxy)
{
_RegistrySettings.ProxyPort.SetValidation((int)numProxyPort.Minimum, (int)numProxyPort.Maximum);
if (_RegistrySettings.ProxyPort.IsValid)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyPort = _RegistrySettings.ProxyPort.Value;
DisableControl(numProxyPort);
}
}
}
// UseProxyAuthentication reg setting: set UseProxyAuthentication option based on value
// 1. Only applied when UpdateUseProxy is true
// 2. Continues with the options checks for "ProxyAuthUser" and "ProxyAuthPass"
if (Properties.OptionsUpdatesPage.Default.UpdateUseProxy && _RegistrySettings.UseProxyAuthentication.IsSet)
{
bool UseProxyAuth = _RegistrySettings.UseProxyAuthentication.Value;
Properties.OptionsUpdatesPage.Default.UpdateProxyUseAuthentication = UseProxyAuth;
if (pageRegSettingsInstance.UseProxyAuthentication.IsSet)
DisableControl(chkUseProxyAuthentication);
// If proxy authentication is not used, reset the proxy authentication username and password to defaults.
if (!UseProxyAuth)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthUser = "";
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthPass = "";
}
if (pageRegSettingsInstance.ProxyAuthUser.IsSet)
DisableControl(txtProxyUsername);
// ProxyAuthUser reg setting: set ProxyAuthUser option based on value
if (_RegistrySettings.ProxyAuthUser.IsSet && UseProxyAuth)
{
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthUser = _RegistrySettings.ProxyAuthUser.Value;
DisableControl(txtProxyUsername);
}
// ProxyAuthPass reg setting:
// 1. Test decription works to prevents potential issues
// 2. Set ProxyAuthPass option based on value
if (_RegistrySettings.ProxyAuthPass.IsSet && UseProxyAuth)
{
// Prevents potential issues when using UpdateProxyAuthPass later.
try
{
LegacyRijndaelCryptographyProvider cryptographyProvider = new();
string decryptedPassword;
string ProxyAuthPass = _RegistrySettings.ProxyAuthPass.Value;
decryptedPassword = cryptographyProvider.Decrypt(ProxyAuthPass, Runtime.EncryptionKey);
Properties.OptionsUpdatesPage.Default.UpdateProxyAuthPass = ProxyAuthPass;
DisableControl(txtProxyPassword);
}
catch
{
// Fire-and-forget: The password in the registry is not encrypted.
}
}
}
if (pageRegSettingsInstance.ProxyAuthPass.IsSet)
DisableControl(txtProxyPassword);
// Updates the visibility of the information label indicating whether registry settings are used.
lblRegistrySettingsUsedInfo.Visible = ShowRegistrySettingsUsedInfo();
}
public override bool ShowRegistrySettingsUsedInfo()
{
return !CommonRegistrySettings.AllowCheckForUpdatesAutomatical
|| !CommonRegistrySettings.AllowCheckForUpdatesManual
|| _RegistrySettings.CheckForUpdatesFrequencyDays.IsSet
|| _RegistrySettings.UpdateChannel.IsValid
|| _RegistrySettings.UseProxyForUpdates.IsSet
|| _RegistrySettings.ProxyAddress.IsSet
|| _RegistrySettings.ProxyPort.IsValid
|| _RegistrySettings.UseProxyAuthentication.IsSet
|| _RegistrySettings.ProxyAuthUser.IsSet
|| _RegistrySettings.ProxyAuthPass.IsSet;
}
#endregion
#region Event Handlers
private void chkCheckForUpdatesOnStartup_CheckedChanged(object sender, EventArgs e)
{
if (!_RegistrySettings.CheckForUpdatesFrequencyDays.IsValid)
if (pageRegSettingsInstance?.CheckForUpdatesFrequencyDays?.IsSet == false)
cboUpdateCheckFrequency.Enabled = chkCheckForUpdatesOnStartup.Checked;
InitialiseCheckForUpdatesOnStartupComboBox();
@@ -311,7 +229,7 @@ namespace mRemoteNG.UI.Forms.OptionsPages
// Enables/disables proxy authentication controls
bool useProxyAuth = chkUseProxyAuthentication.Checked;
bool useProxyAuthRegIsSet = _RegistrySettings.UseProxyAuthentication.IsSet;
bool useProxyAuthRegIsSet = pageRegSettingsInstance.UseProxyAuthentication?.IsSet ?? false;
chkUseProxyAuthentication.Enabled = useProxy && !useProxyAuthRegIsSet;
tblProxyAuthentication.Enabled = useProxy && useProxyAuth && !useProxyAuthRegIsSet;
}
@@ -436,65 +354,30 @@ namespace mRemoteNG.UI.Forms.OptionsPages
}
/// <summary>
/// Determines if updates are forbidden based on registry settings.
/// Checks if updates are forbidden based on registry settings.
/// </summary>
/// <returns>
/// True if updates are forbidden; otherwise, false.
/// </returns>
private bool UpdatesForbidden()
private static bool UpdatesForbidden()
{
bool disablePage = !CommonRegistrySettings.AllowCheckForUpdates
return !CommonRegistrySettings.AllowCheckForUpdates
|| (!CommonRegistrySettings.AllowCheckForUpdatesAutomatical
&& !CommonRegistrySettings.AllowCheckForUpdatesManual);
if (disablePage)
{
DisablePage();
// Ensure the UI (CheckFrequency ComboBox) appears correct when disabled
cboUpdateCheckFrequency.Items.Clear();
int nNever = cboUpdateCheckFrequency.Items.Add(Language.Never);
cboUpdateCheckFrequency.SelectedIndex = nNever;
// Ensure the UI (ReleaseChannel ComboBox) appears correct when disabled
cboReleaseChannel.Items.Clear();
int stable = cboReleaseChannel.Items.Add(UpdateChannelInfo.STABLE);
cboReleaseChannel.SelectedIndex = stable;
}
return disablePage;
}
/// <summary>
/// Disables all controls on the page related to update settings and proxy configurations.
/// Checks if specific registry settings related to updates page are used.
/// </summary>
public override void DisablePage()
private bool ShowRegistrySettingsUsedInfo()
{
chkCheckForUpdatesOnStartup.Checked = false;
chkCheckForUpdatesOnStartup.Enabled = false;
cboUpdateCheckFrequency.Enabled = false;
btnUpdateCheckNow.Enabled = false;
cboReleaseChannel.Enabled = false;
chkUseProxyForAutomaticUpdates.Checked = false;
chkUseProxyForAutomaticUpdates.Enabled = false;
tblProxyBasic.Enabled = false;
txtProxyAddress.Enabled = false;
txtProxyAddress.ReadOnly = true;
numProxyPort.Enabled = false;
chkUseProxyAuthentication.Checked = false;
chkUseProxyAuthentication.Enabled = false;
tblProxyAuthentication.Enabled = false;
txtProxyUsername.Enabled = false;
txtProxyUsername.ReadOnly = true;
txtProxyPassword.Enabled = false;
txtProxyPassword.ReadOnly = true;
btnTestProxy.Enabled = false;
lblRegistrySettingsUsedInfo.Visible = true;
return !CommonRegistrySettings.AllowCheckForUpdatesAutomatical
|| !CommonRegistrySettings.AllowCheckForUpdatesManual
|| pageRegSettingsInstance.CheckForUpdatesFrequencyDays.IsSet
|| pageRegSettingsInstance.UpdateChannel.IsSet
|| pageRegSettingsInstance.UseProxyForUpdates.IsSet
|| pageRegSettingsInstance.ProxyAddress.IsSet
|| pageRegSettingsInstance.ProxyPort.IsSet
|| pageRegSettingsInstance.UseProxyAuthentication.IsSet
|| pageRegSettingsInstance.ProxyAuthUser.IsSet
|| pageRegSettingsInstance.ProxyAuthPass.IsSet;
}
#endregion

View File

@@ -348,7 +348,6 @@ namespace mRemoteNG.UI.Forms
{
if (!CommonRegistrySettings.AllowCheckForUpdates) return;
if (!CommonRegistrySettings.AllowCheckForUpdatesAutomatical) return;
if (!CommonRegistrySettings.AllowPromptForUpdatesPreference) return;
if (Properties.OptionsUpdatesPage.Default.CheckForUpdatesAsked) return;
string[] commandButtons =

View File

@@ -11,7 +11,6 @@ Welcome to mRemoteNG's documentation!
protocols.rst
keyboard_shortcuts.rst
sql_configuration.rst
registry_settings_information.rst
registry_settings_guide.rst
command_line_switches.rst
themes.rst

View File

@@ -1,5 +1,3 @@
.. _credential_settings:
*********************
Credential Settings
*********************
@@ -8,178 +6,209 @@ Credential Settings
.. warning::
Before proceeding with any changes to the Windows Registry, it is imperative that you carefully read and comprehend the
**Modifying the Registry**, **Restricted Registry Settings** and **Disclaimer**
on :doc:`Registry Settings Infromation </registry_settings_information>`.
on :doc:`Registry Settings Infromation <registry_settings_information>`.
Common settings
===============
These settings are defined for global configuration.
Common
======
- Registry Hive: ``HKEY_LOCAL_MACHINE``
- Registry Path: ``SOFTWARE\mRemoteNG\Credentials``
AllowExportUsernames
--------------------
Allow Export Usernames
----------------------
Determines whether exporting usernames is allowed.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials
- **Value Name:** AllowExportUsernames
- **Value Type:** REG_SZ
- **Value Name:** ``AllowExportUsernames``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- **Enable (default):** true
- **Disable:** false
- Disallow: ``false``
AllowExportPasswords
--------------------
Allow Export Passwords
----------------------
Determines whether exporting passwords is allowed.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials
- **Value Name:** AllowExportPasswords
- **Value Type:** REG_SZ
- **Value Name:** ``AllowExportPasswords``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- **Enable (default):** true
- **Disable:** false
- Disallow: ``false``
AllowSaveUsernames
------------------
Allow Save Usernames
--------------------
Determines whether saving usernames is allowed.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials
- **Value Name:** AllowSaveUsernames
- **Value Type:** REG_SZ
- **Value Name:** ``AllowSaveUsernames``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- **Enable (default):** true
- **Disable:** false
- Disallow: ``false``
.. note::
If 'AllowSaveUsernames' is set to false, stored user names in the connection persist until the connection goes through modification or usage.
If **AllowSaveUsernames** is set to ``false``,
stored user names in the connection persist until the connection goes through modification or usage.
Subsequently, stored user names are removed.
Additionally, new connections will not be able to store usernames.
AllowSavePasswords
------------------
Allow Save Passwords
--------------------
Determines whether saving passwords is allowed.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials
- **Value Name:** AllowSavePasswords
- **Value Type:** REG_SZ
- **Value Name:** ``AllowSavePasswords``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- **Enable (default):** true
- **Disable:** false
- Disallow: ``false``
.. note::
If 'AllowSavePasswords' is set to false, stored passwords in the connection persist until the connection goes through modification or usage.
If **AllowSavePasswords** is set to ``false``,
stored passwords in the connection persist until the connection goes through modification or usage.
Subsequently, stored passwords are removed.
Additionally, new connections will not be able to store passwords.
AllowModifyCredentialSettings
-----------------------------
Specifies if the 'Credentials' option page is configurable.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials
- **Value Name:** AllowModifyCredentialSettings
- **Value Type:** REG_SZ
- **Values:**
- **Enable (default):** true
- **Disable:** false
.. note::
If 'AllowModifyCredentialSettings' is set to false, 'UseCredentials' is automatically set to 'None' (noinfo).
Option Page Settings
====================
Options
=======
Configure the options page to modify functionalities as described.
UseCredentials
--------------
- **Registry Hive:** ``HKEY_LOCAL_MACHINE``
- **Registry Path:** ``SOFTWARE\mRemoteNG\Credentials\Options``
Use Credentials
---------------
Specifies the radio button state on the credentials page to prefill empty credential fields:
- "None" is selected to leave the fields unfilled.
- "Windows Logon Information" is chosen to autofill with Single Sign-On (SSO) data.
- "Custom" is opted for utilizing the defined information.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials\\Options
- **Value Name:** UseCredentials
- **Value Type:** REG_SZ
(1) "None" is selected to leave the fields unfilled.
(2) "Windows Logon Information" is chosen to autofill with Single Sign-On (SSO) data.
(3) "Custom" is opted for utilizing the defined information.
- **Value Name:** ``UseCredentials``
- **Value Type:** ``REG_SZ``
- **Values:**
- Radio (1) None: `noinfo`
- Radio (2) Windows Logon: `windows`
- Radio (3) Custom: `custom`
- (1): ``noinfo``
- (2): ``windows``
- (3): ``custom``
UserViaAPIDefault
-----------------
User Via API Default
--------------------
Specifies the user set via API as the default username.
Important: only used when "UseCredentials" is set to "Custom".
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials\\Options
- **Value Name:** UserViaAPIDefault
- **Value Type:** REG_SZ
- **Value Name:** ``UserViaAPIDefault``
- **Value Type:** ``REG_SZ``
.. note::
Only takes effect if 'UseCredentials' is set to custom.
Only takes effect if *UseCredentials* is set to ``custom`` or *DefaultUserViaAPIEnabled* is set to ``false``.
DefaultUsername
---------------
Default Username
----------------
Specifies the default username.
Important: only used when "UseCredentials" is set to "Custom".
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials\\Options
- **Value Name:** DefaultUsername
- **Value Type:** REG_SZ
- **Value Name:** ``DefaultUsername``
- **Value Type:** ``REG_SZ``
.. note::
Only takes effect if 'UseCredentials' is set to custom.
Only takes effect if *UseCredentials* is set to ``custom`` or *DefaultUsernameEnabled* is set to ``false``.
DefaultPassword
---------------
(currently not supported)
Default Password
----------------
Specifies the default password.
- **Value Name:** ``DefaultPassword``
- **Value Type:** ``REG_SZ``
.. warning::
Plain-text passwords are not supported.
Do not store decrypted passwords in the registry!
Storing decrypted passwords in the registry poses a significant security risk and is strongly discouraged. It can expose sensitive information, compromise user credentials, and lead to unauthorized access. Always follow best security practices and avoid storing plaintext passwords in any form, including the registry.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials\\Options
- **Value Name:** DefaultPassword
- **Value Type:** REG_SZ
.. note::
Only takes effect if 'UseCredentials' is set to custom.
Only takes effect if *UseCredentials* is set to ``custom`` or *DefaultPasswordEnabled* is set to ``false``.
DefaultDomain
-------------
Default Domain
--------------
Specifies the default domain.
Important: only used when "UseCredentials" is set to "Custom".
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Credentials\\Options
- **Value Name:** DefaultDomain
- **Value Type:** REG_SZ
- **Value Name:** ``DefaultDomain``
- **Value Type:** ``REG_SZ``
.. note::
Only takes effect if 'UseCredentials' is set to custom.
Only takes effect if *UseCredentials* is set to ``custom``.
Default Username Enabled
------------------------
Specifies that entering the custom default username field is enabled.
- **Value Name:** ``DefaultUsernameEnabled``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- to disable: ``false``
Default Password Enabled
------------------------
Specifies that entering the custom default password field is enabled.
- **Value Name:** ``DefaultPasswordEnabled``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- to disable: ``false``
Default User Via API Enabled
----------------------------
Specifies that entering the custom default api user field is enabled.
- **Value Name:** ``DefaultUserViaAPIEnabled``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- to disable: ``false``
Registry Template
=================
.. code::
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\mRemoteNG\Credentials]
"AllowExportPasswords"="false"
"AllowExportUsernames"="false"
"AllowSavePasswords"="false"
"AllowSaveUsernames"="false"
[HKEY_LOCAL_MACHINE\SOFTWARE\mRemoteNG\Credentials\Options]
"UseCredentials"="custom"
"UserViaAPIDefault"=""
"DefaultUsername"=""
"DefaultPassword"=""
"DefaultDomain"=""
"DefaultUsernameEnabled"="false"
"DefaultPasswordEnabled"="false"
"DefaultUserViaAPIEnabled"="false"

View File

@@ -1,3 +1,4 @@
.. _registry_settings_information:
*****************************

View File

@@ -1,5 +1,3 @@
.. _updates_settings:
******************
Updates Settings
******************
@@ -8,199 +6,202 @@ Updates Settings
.. warning::
Before proceeding with any changes to the Windows Registry, it is imperative that you carefully read and comprehend the
**Modifying the Registry**, **Restricted Registry Settings** and **Disclaimer**
on :doc:`Registry Settings Infromation </registry_settings_information>`.
on :doc:`Registry Settings Infromation <registry_settings_information>`.
Common settings
===============
These settings are defined for global configuration.
Common
======
- Registry Hive: ``HKEY_LOCAL_MACHINE``
- Registry Path: ``SOFTWARE\mRemoteNG\Updates``
AllowCheckForUpdates
--------------------
Allow Check For Updates
-----------------------
Allows or disallows checking for updates.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates
- **Value Name:** AllowCheckForUpdates
- **Value Type:** REG_SZ
- **Value Name:** ``AllowCheckForUpdates``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- **Enable (default):** true
- **Disable:** false
- Disallow: ``false``
AllowCheckForUpdatesAutomatical
-------------------------------
Allow Check For Updates Automatical
-----------------------------------
Allows or disallows automatic search for updates.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates
- **Value Name:** AllowCheckForUpdatesAutomatical
- **Value Type:** REG_SZ
- **Value Name:** ``AllowCheckForUpdatesAutomatical``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- **Enable (default):** true
- **Disable:** false
- Disallow: ``false``
.. note::
If "AllowCheckForUpdates" is set to false, the automatic update check is already disabled.
If **AllowCheckForUpdates** is set to ``false``, the automatic update check is already disabled.
AllowCheckForUpdatesManual
--------------------------
Allow Check For Updates Manual
------------------------------
Allows or disallows manual search for updates.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates
- **Value Name:** AllowCheckForUpdatesManual
- **Value Type:** REG_SZ
- **Value Name:** ``AllowCheckForUpdatesManual``
- **Value Type:** ``REG_SZ``
- **Default value:** ``true``
- **Values:**
- **Enable (default):** true
- **Disable:** false
- Disallow: ``false``
.. note::
If "AllowCheckForUpdates" is set to false, the automatic update check is already disabled.
If **AllowCheckForUpdates** is set to ``false``, the automatic update check is already disabled.
AllowPromptForUpdatesPreference
-------------------------------
Controls whether a prompt for checking the updates preferences is displayed at startup.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates
- **Value Name:** AllowPromptForUpdatesPreference
- **Value Type:** REG_SZ
- **Values:**
- **Enable:** true
- **Disable:** false
Option Page Settings
====================
Options
=======
Configure the options page to modify functionalities as described.
- **Registry Hive:** ``HKEY_LOCAL_MACHINE``
- **Registry Path:** ``SOFTWARE\mRemoteNG\Updates\Options``
CheckForUpdatesFrequencyDays
----------------------------
Disallow Prompt For Updates Preference
--------------------------------------
Specifies whether a popup is shown to configure update preferences at startup.
- **Value Name:** ``DisallowPromptForUpdatesPreference``
- **Value Type:** ``REG_SZ``
- **Values:**
- to disable promt: ``true``
Check For Updates Frequency Days
--------------------------------
Specifies the number of days between automatic update checks.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates\\Options
- **Value Name:** CheckForUpdatesFrequencyDays
- **Value Type:** REG_DWORD
- **Value Name:** ``CheckForUpdatesFrequencyDays``
- **Value Type:** ``REG_DWORD``
.. note::
If 'AllowCheckForUpdates' is set to false, the automatic update check is already disabled, and 'CheckForUpdatesFrequencyDays' does not take effect.
If **AllowCheckForUpdates** is set to ``false``, the automatic update check is already disabled, and **CheckForUpdatesFrequencyDays** does not take effect.
UpdateChannel
-------------
Specifies the preferred update channel. Important note: Values are case-sensitive!
Update Channel
--------------
Specifies the preferred update channel.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates\\Options
- **Value Name:** UpdateChannel
- **Value Type:** REG_SZ
- **Value Name:** ``UpdateChannel``
- **Value Type:** ``REG_SZ``
- **Values:**
- Channel: Stable
- Channel: Nightly
- Channel: Preview
- Channel: ``Stable``
- Channel: ``Nightly``
- Channel: ``Preview``
UseProxyForUpdates
------------------
Use Proxy For Updates
---------------------
Indicates whether proxy usage for updates is enabled.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates\\Options
- **Value Name:** UseProxyForUpdates
- **Value Type:** REG_SZ
- **Value Name:** ``UseProxyForUpdates``
- **Value Type:** ``REG_SZ``
- **Values:**
- Enable: true
- Disable: false
- Enable: ``true``
- Disable: ``false``
ProxyAddress
------------
Proxy Address
-------------
Specifies the address of the proxy for updates.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates\\Options
- **Value Name:** ProxyAddress
- **Value Type:** REG_SZ
- **Value Name:** ``ProxyAddress``
- **Value Type:** ``REG_SZ``
.. note::
If 'UseProxyForUpdates' is disabled, these settings do not take effect.
If **UseProxyForUpdates** is ``false``, these settings do not take effect.
ProxyPort
---------
Proxy Port
----------
Specifies the port used for proxy connections during updates.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates\\Options
- **Value Name:** ProxyPort
- **Value Type:** REG_DWORD
- **Value Name:** ``ProxyPort``
- **Value Type:** ``REG_DWORD``
.. note::
If 'UseProxyForUpdates' is disabled, these settings do not take effect.
If **UseProxyForUpdates** is ``false``, these settings do not take effect.
UseProxyAuthentication
----------------------
Use Proxy Authentication
------------------------
Indicates whether proxy authentication is enabled.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates\\Options
- **Value Name:** UseProxyAuthentication
- **Value Type:** REG_SZ
- **Value Name:** ``UseProxyAuthentication``
- **Value Type:** ``REG_SZ``
- **Values:**
- Enable Value: true
- Disable Value: false
- Enable: ``true``
- Disable: ``false``
.. note::
If 'UseProxyForUpdates' is disabled, these settings do not take effect.
If **UseProxyForUpdates** is ``false``, these settings do not take effect.
ProxyAuthUser
-------------
Proxy Auth User
---------------
Specifies the authentication username for the proxy.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates\\Options
- **Value Name:** ProxyAuthUser
- **Value Type:** REG_SZ
- **Value Name:** ``ProxyAuthUser``
- **Value Type:** ``REG_SZ``
.. note::
If 'UseProxyForUpdates' is disabled, these settings do not take effect.
If **UseProxyForUpdates** and **ProxyAuthUser** is ``false``, these settings do not take effect.
.. note::
If 'ProxyAuthUser' is disabled, these settings do not take effect.
ProxyAuthPass
-------------
(currently not supported)
Proxy Auth Pass
---------------
**(currently not supported)**
Represents the authentication password for the proxy.
- **Value Name:** ``ProxyAuthPass``
- **Value Type:** ``REG_DWORD``
.. note::
If **UseProxyForUpdates** and **ProxyAuthUser** is ``false``, these settings do not take effect.
.. warning::
Do not store decrypted passwords in the registry!
Storing decrypted passwords in the registry poses a significant security risk and is strongly discouraged. It can expose sensitive information, compromise user credentials, and lead to unauthorized access. Always follow best security practices and avoid storing plaintext passwords in any form, including the registry.
Plain-text passwords are not supported.
- **Registry Hive:** HKEY_LOCAL_MACHINE
- **Registry Path:** SOFTWARE\\mRemoteNG\\Updates\\Options
- **Value Name:** ProxyAuthPass
- **Value Type:** REG_DWORD
Registry Template
=================
.. note::
If 'UseProxyForUpdates' is disabled, these settings do not take effect.
.. code::
.. note::
If 'ProxyAuthUser' is disabled, these settings do not take effect.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\mRemoteNG\Updates]
"AllowCheckForUpdates"="false"
"AllowCheckForUpdatesAutomatical"="false"
"AllowCheckForUpdatesManual"="false"
[HKEY_LOCAL_MACHINE\SOFTWARE\mRemoteNG\Updates\Options]
"DisallowPromptForUpdatesPreference"="true"
"CheckForUpdatesFrequencyDays"=dword:00000014
"UpdateChannel"="Stable"
"UseProxyForUpdates"="false"
"ProxyAddress"=""
"ProxyPort"=dword:00000050
"UseProxyAuthentication"="false"
"ProxyAuthUser"=""
"ProxyAuthPass"=""

View File

@@ -1,21 +1,27 @@
.. _registry_settings_guide:
****************************
***********************
Registry Settings Guide
****************************
***********************
.. warning::
Before proceeding with any changes to the Windows Registry, it is imperative that you carefully read and comprehend the
**Modifying the Registry**, **Restricted Registry Settings** and **Disclaimer**
on :doc:`Registry Settings Infromation </registry_settings_information>`.
on :doc:`Registry Settings Infromation <registry/registry_settings_information>`.
The following registry settings are used by mRemoteNG to configure various options and behavior.
Please note that incorrect modifications to these settings can impact the functionality of mRemoteNG.
Make changes with caution and ensure that you have backups before making any adjustments.
.. toctree::
:maxdepth: 2
registry/registry_settings_information.rst
.. toctree::
:maxdepth: 4
registry/credential_settings
registry/updates_settings
registry/credential_settings.rst
registry/updates_settings.rst