CPUUsage (Windows): simplifies Win10 detection

This commit is contained in:
李通洲
2026-03-07 09:24:38 +08:00
parent 26ae4eb21b
commit 121d399641
2 changed files with 25 additions and 15 deletions
+15 -1
View File
@@ -635,7 +635,7 @@ typedef struct _KUSER_SHARED_DATA
// ... more fields follow, but we don't need them
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
#define SharedUserData ((const KUSER_SHARED_DATA*) 0x7FFE0000UL)
#define SharedUserData ((const KUSER_SHARED_DATA*) 0x7FFE0000UL)
static inline uint64_t ffKSystemTimeToUInt64(const volatile KSYSTEM_TIME* pTime)
{
@@ -656,3 +656,17 @@ static inline uint64_t ffKSystemTimeToUInt64(const volatile KSYSTEM_TIME* pTime)
return ((uint64_t) high1 << 32) | low;
#endif
}
static inline bool ffIsWindows10OrGreater()
{
#if FF_WIN7_COMPAT
return SharedUserData->NtMajorVersion >= 10;
#else
return true;
#endif
}
static inline bool ffIsWindows11OrGreater()
{
return ffIsWindows10OrGreater() && SharedUserData->NtBuildNumber >= 22000;
}