mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-25 19:38:37 +08:00
Description: The process was terminated due to an unhandled exception. Exception Info: System.InvalidCastException Stack: at mRemoteNG.App.CompatibilityChecker.FipsPolicyEnabledForServer2008AndNewer() at mRemoteNG.App.CompatibilityChecker.CheckFipsPolicy() at mRemoteNG.App.CompatibilityChecker.CheckCompatibility() at mRemoteNG.App.Startup.InitializeProgram() at mRemoteNG.App.ProgramRoot.StartApplication() at mRemoteNG.App.ProgramRoot.Main(System.String[])
70 lines
2.6 KiB
C#
70 lines
2.6 KiB
C#
using Microsoft.Win32;
|
|
using mRemoteNG.App.Info;
|
|
using mRemoteNG.UI.Forms;
|
|
using mRemoteNG.UI.TaskDialog;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.Windows.Forms;
|
|
|
|
namespace mRemoteNG.App
|
|
{
|
|
public class CompatibilityChecker
|
|
{
|
|
public void CheckCompatibility()
|
|
{
|
|
CheckFipsPolicy();
|
|
CheckLenovoAutoScrollUtility();
|
|
}
|
|
|
|
private void CheckFipsPolicy()
|
|
{
|
|
if (FipsPolicyEnabledForServer2003() || FipsPolicyEnabledForServer2008AndNewer())
|
|
{
|
|
MessageBox.Show(frmMain.Default, string.Format(Language.strErrorFipsPolicyIncompatible, GeneralAppInfo.ProdName, GeneralAppInfo.ProdName, MessageBoxButtons.OK, MessageBoxIcon.Error));
|
|
Environment.Exit(1);
|
|
}
|
|
}
|
|
|
|
private bool FipsPolicyEnabledForServer2003()
|
|
{
|
|
var regKey = Registry.LocalMachine.OpenSubKey("System\\CurrentControlSet\\Control\\Lsa");
|
|
var fipsPolicy = regKey?.GetValue("FIPSAlgorithmPolicy");
|
|
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) return false;
|
|
fipsPolicy = Convert.ToInt32(fipsPolicy);
|
|
return (int)fipsPolicy != 0;
|
|
}
|
|
|
|
private void CheckLenovoAutoScrollUtility()
|
|
{
|
|
if (!Settings.Default.CompatibilityWarnLenovoAutoScrollUtility)
|
|
return;
|
|
|
|
Process[] proccesses = new Process[] { };
|
|
try
|
|
{
|
|
proccesses = Process.GetProcessesByName("virtscrl");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Runtime.MessageCollector.AddExceptionMessage("Error in CheckLenovoAutoScrollUtility", ex);
|
|
}
|
|
|
|
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)
|
|
Settings.Default.CompatibilityWarnLenovoAutoScrollUtility = false;
|
|
}
|
|
}
|
|
}
|
|
}
|