From 0e084eaefd84f49abb14a8d24e1310f923e406df Mon Sep 17 00:00:00 2001 From: James Groom Date: Sun, 17 Dec 2023 09:46:44 +0000 Subject: [PATCH] Elaborate on admin warning, now with manual override (resolves #3835) --- src/BizHawk.Client.Common/config/Config.cs | 2 ++ src/BizHawk.Client.EmuHawk/Program.cs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/BizHawk.Client.Common/config/Config.cs b/src/BizHawk.Client.Common/config/Config.cs index 1800b303c7..37cb1fe179 100644 --- a/src/BizHawk.Client.Common/config/Config.cs +++ b/src/BizHawk.Client.Common/config/Config.cs @@ -135,6 +135,8 @@ namespace BizHawk.Client.Common public string UpdateIgnoreVersion { get; set; } = ""; public bool SkipOutdatedOsCheck { get; set; } + public bool SkipSuperuserPrivsCheck { get; set; } + /// /// Makes a .bak file before any saveram-writing operation (could be extended to make timestamped backups) /// diff --git a/src/BizHawk.Client.EmuHawk/Program.cs b/src/BizHawk.Client.EmuHawk/Program.cs index cc6169ebb0..f51a879fc2 100644 --- a/src/BizHawk.Client.EmuHawk/Program.cs +++ b/src/BizHawk.Client.EmuHawk/Program.cs @@ -294,15 +294,16 @@ namespace BizHawk.Client.EmuHawk _ = SetDllDirectoryW(dllDir); } - if (OSTailoredCode.HostWindowsVersion is null || - OSTailoredCode.HostWindowsVersion.Value.Version >= OSTailoredCode.WindowsVersion._10) // "windows isn't capable of being useful for non-administrators until windows 10" --zeromus + if (!initialConfig.SkipSuperuserPrivsCheck + && OSTailoredCode.HostWindowsVersion is null or { Version: >= OSTailoredCode.WindowsVersion._10 }) // "windows isn't capable of being useful for non-administrators until windows 10" --zeromus { if (EmuHawkUtil.CLRHostHasElevatedPrivileges) { using MsgBox dialog = new( title: "This EmuHawk is privileged", message: $"EmuHawk detected it {(OSTailoredCode.IsUnixHost ? "is running as root (Superuser)" : "has Administrator privileges")}.\n" - + "This is a bad idea.", + + "Regularly using {(OSTailoredCode.IsUnixHost ? "Superuser" : "Administrator")} for things other than system administration makes it easier to hack you.\n" + + "If you're certain, you may continue anyway (and without support). You'll find a flag \"{nameof(Config.SkipSuperuserPrivsCheck)}\" in the config file, which disables this warning.", boxIcon: MessageBoxIcon.Warning); dialog.ShowDialog(); }