Clean up Windows version comparison

fixes 1b8158f4c
This commit is contained in:
YoshiRulz 2023-02-08 22:24:22 +10:00
parent 6ea9e37e33
commit eafb1fdcf5
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 14 additions and 18 deletions

View File

@ -247,25 +247,21 @@ namespace BizHawk.Client.EmuHawk
_ = SetDllDirectory(dllDir); _ = SetDllDirectory(dllDir);
} }
//skip privilege if (OSTC.HostWindowsVersion is null || OSTC.HostWindowsVersion.Value.Version >= OSTC.WindowsVersion._10) // "windows isn't capable of being useful for non-administrators until windows 10" --zeromus
bool skipPrivilegesCheck = false;
var oldVersions = new[] { OSTC.WindowsVersion.XP, OSTC.WindowsVersion.Vista, OSTC.WindowsVersion._7, OSTC.WindowsVersion._8, OSTC.WindowsVersion._8_1 };
if(OSTC.HostWindowsVersion.HasValue)
if(oldVersions.Contains(OSTC.HostWindowsVersion.Value.Version))
skipPrivilegesCheck = true;
if (EmuHawkUtil.CLRHostHasElevatedPrivileges && !skipPrivilegesCheck)
{ {
using MsgBox dialog = new( if (EmuHawkUtil.CLRHostHasElevatedPrivileges)
title: "This EmuHawk is privileged", {
message: $"EmuHawk detected it {(OSTC.IsUnixHost ? "is running as root (Superuser)" : "has Administrator privileges")}.\n" using MsgBox dialog = new(
+ "This is a bad idea.", title: "This EmuHawk is privileged",
boxIcon: MessageBoxIcon.Warning); message: $"EmuHawk detected it {(OSTC.IsUnixHost ? "is running as root (Superuser)" : "has Administrator privileges")}.\n"
dialog.ShowDialog(); + "This is a bad idea.",
} boxIcon: MessageBoxIcon.Warning);
else dialog.ShowDialog();
{ }
Util.DebugWriteLine("running as unprivileged user"); else
{
Util.DebugWriteLine("running as unprivileged user");
}
} }
var exitCode = 0; var exitCode = 0;