From 75f8681043ee197cdf2aae630a28be69574c7949 Mon Sep 17 00:00:00 2001 From: GMatrixGames Date: Thu, 19 May 2022 23:05:22 -0400 Subject: [PATCH] Adjust windows version name detection Fixes Windows 11 being improperly identified as Windows 10 --- FModel/App.xaml.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/FModel/App.xaml.cs b/FModel/App.xaml.cs index 8dd208f5..07845592 100644 --- a/FModel/App.xaml.cs +++ b/FModel/App.xaml.cs @@ -26,6 +26,10 @@ namespace FModel [DllImport("kernel32.dll")] private static extern bool AttachConsole(int dwProcessId); + [DllImport("winbrand.dll", CharSet = CharSet.Unicode)] + [DefaultDllImportSearchPaths(DllImportSearchPath.System32)] + static extern string BrandingFormatString(string format); + protected override void OnStartup(StartupEventArgs e) { #if DEBUG @@ -133,7 +137,7 @@ namespace FModel var productName = string.Empty; try { - productName = GetRegistryValue(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", RegistryHive.LocalMachine); + productName = BrandingFormatString("%WINDOWS_LONG%"); } catch {