Elaborate on admin warning, now with manual override (resolves #3835)

This commit is contained in:
James Groom 2023-12-17 09:46:44 +00:00 committed by GitHub
parent a48ca42125
commit 0e084eaefd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -135,6 +135,8 @@ namespace BizHawk.Client.Common
public string UpdateIgnoreVersion { get; set; } = "";
public bool SkipOutdatedOsCheck { get; set; }
public bool SkipSuperuserPrivsCheck { get; set; }
/// <summary>
/// Makes a .bak file before any saveram-writing operation (could be extended to make timestamped backups)
/// </summary>

View File

@ -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();
}