Fix Win10 version check AGAIN (resolves #3270, #3272)

fixes 587855522
This commit is contained in:
YoshiRulz 2022-06-13 11:41:46 +10:00
parent 90220b6506
commit e7e5ea1509
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 3 additions and 2 deletions

View File

@ -44,10 +44,11 @@ namespace BizHawk.Common
if ((GetRegValue("ProductName") ?? "Windows 10").Contains("Windows 10"))
{
// Win11 has ProductName == "Windows 10 Pro" MICROSOFT WHY https://stackoverflow.com/a/69922526 https://stackoverflow.com/a/70456554
Version win10PlusVer = new(FileVersionInfo.GetVersionInfo(@"C:\Windows\System32\kernel32.dll").FileVersion.SubstringBefore(' '));
// Version win10PlusVer = new(FileVersionInfo.GetVersionInfo(@"C:\Windows\System32\kernel32.dll").FileVersion.SubstringBefore(' ')); // bonus why: this doesn't work because the file's metadata wasn't updated
Version win10PlusVer = new(10, 0, int.TryParse(GetRegValue("CurrentBuild") ?? "19044", out var i) ? i : 19044); // still, leaving the Version wrapper here for when they inevitably do something stupid like decide to call Win11 11.0.x (or 10.1.x because they're incapable of doing anything sensible)
return (win10PlusVer < new Version(10, 0, 22000) ? WindowsVersion._10 : WindowsVersion._11, win10PlusVer);
}
// ...else we're on 8.1. Can't be bothered writing code for KB installed check, not that I have a Win8.1 machine to test on anyway, so it gets a free pass (though I suspect comparing against the kernel32.dll version would work here too). --yoshi
// ...else we're on 8.1. Can't be bothered writing code for KB installed check, not that I have a Win8.1 machine to test on anyway, so it gets a free pass (though I suspect `CurrentBuild` would work here too). --yoshi
winVer = WindowsVersion._8_1;
}
else if (rawWinVer == new Version(6, 2)) winVer = WindowsVersion._8;