Browse Source

SystemStats: Correctly report Windows 11

v7.0.9
attila Attila Szarvas 3 years ago
parent
commit
286f9bf3f0
2 changed files with 21 additions and 16 deletions
  1. +19
    -15
      modules/juce_core/native/juce_win32_SystemStats.cpp
  2. +2
    -1
      modules/juce_core/system/juce_SystemStats.h

+ 19
- 15
modules/juce_core/native/juce_win32_SystemStats.cpp View File

@@ -191,7 +191,7 @@ static DebugFlagsInitialiser debugFlagsInitialiser;
//==============================================================================
#if JUCE_MINGW
static uint32 getWindowsVersion()
static uint64 getWindowsVersion()
{
auto filename = _T("kernel32.dll");
DWORD handle = 0;
@@ -207,7 +207,7 @@ static DebugFlagsInitialiser debugFlagsInitialiser;
if (VerQueryValue (data, (LPCTSTR) _T("\\"), (void**) &info, &verSize))
if (size > 0 && info != nullptr && info->dwSignature == 0xfeef04bd)
return (uint32) info->dwFileVersionMS;
return ((uint64) info->dwFileVersionMS << 32) | (uint64) info->dwFileVersionLS;
}
}
@@ -240,24 +240,27 @@ static DebugFlagsInitialiser debugFlagsInitialiser;
SystemStats::OperatingSystemType SystemStats::getOperatingSystemType()
{
#if JUCE_MINGW
auto v = getWindowsVersion();
auto major = (v >> 16) & 0xff;
auto minor = (v >> 0) & 0xff;
const auto v = getWindowsVersion();
const auto major = (v >> 48) & 0xffff;
const auto minor = (v >> 32) & 0xffff;
const auto build = (v >> 16) & 0xffff;
#else
auto versionInfo = getWindowsVersionInfo();
auto major = versionInfo.dwMajorVersion;
auto minor = versionInfo.dwMinorVersion;
const auto versionInfo = getWindowsVersionInfo();
const auto major = versionInfo.dwMajorVersion;
const auto minor = versionInfo.dwMinorVersion;
const auto build = versionInfo.dwBuildNumber;
#endif
jassert (major <= 10); // need to add support for new version!
if (major == 10) return Windows10;
if (major == 6 && minor == 3) return Windows8_1;
if (major == 6 && minor == 2) return Windows8_0;
if (major == 6 && minor == 1) return Windows7;
if (major == 6 && minor == 0) return WinVista;
if (major == 5 && minor == 1) return WinXP;
if (major == 5 && minor == 0) return Win2000;
if (major == 10 && build >= 22000) return Windows11;
if (major == 10) return Windows10;
if (major == 6 && minor == 3) return Windows8_1;
if (major == 6 && minor == 2) return Windows8_0;
if (major == 6 && minor == 1) return Windows7;
if (major == 6 && minor == 0) return WinVista;
if (major == 5 && minor == 1) return WinXP;
if (major == 5 && minor == 0) return Win2000;
jassertfalse;
return UnknownOS;
@@ -269,6 +272,7 @@ String SystemStats::getOperatingSystemName()
switch (getOperatingSystemType())
{
case Windows11: name = "Windows 11"; break;
case Windows10: name = "Windows 10"; break;
case Windows8_1: name = "Windows 8.1"; break;
case Windows8_0: name = "Windows 8.0"; break;


+ 2
- 1
modules/juce_core/system/juce_SystemStats.h View File

@@ -71,7 +71,8 @@ public:
Windows7 = Windows | 4,
Windows8_0 = Windows | 5,
Windows8_1 = Windows | 6,
Windows10 = Windows | 7
Windows10 = Windows | 7,
Windows11 = Windows | 8
};
/** Returns the type of operating system we're running on.


Loading…
Cancel
Save