[+] Absolute Win32 version checks

[+] bool AuSwInfo::IsWindowsXP()
[+] bool AuSwInfo::IsWindowsXPSP1()
[+] bool AuSwInfo::IsWindowsXPSP2()
[+] bool AuSwInfo::IsWindowsXPSP3()
[+] bool AuSwInfo::IsWindowsXPAny()
[+] bool AuSwInfo::IsWindowsVista()
[+] bool AuSwInfo::IsWindowsVistaSP1()
[+] bool AuSwInfo::IsWindowsVistaSP2()
[+] bool AuSwInfo::IsWindowsVistaAny()
[+] bool AuSwInfo::IsWindows7()
[+] bool AuSwInfo::IsWindows7SP1()
[+] bool AuSwInfo::IsWindows7Any()
[+] bool AuSwInfo::IsWindows8()
[+] bool AuSwInfo::IsWindows8Point1()
[+] bool AuSwInfo::IsWindows8Any()
[+] bool AuSwInfo::IsWindows10()
[+] bool AuSwInfo::IsWindows11()
This commit is contained in:
Reece Wilson 2023-08-29 16:12:13 +01:00
parent 5e11b7fe99
commit 47cccd0490
2 changed files with 63 additions and 1 deletions

View File

@ -11,16 +11,33 @@ namespace Aurora::SWInfo
{
// VersionHelpers.h - except it doesn't lie to you and wont break NIX land
AUKN_SYM bool IsWindowsXPOrGreater();
AUKN_SYM bool IsWindowsXP();
AUKN_SYM bool IsWindowsXPSP1OrGreater();
AUKN_SYM bool IsWindowsXPSP1();
AUKN_SYM bool IsWindowsXPSP2OrGreater();
AUKN_SYM bool IsWindowsXPSP2();
AUKN_SYM bool IsWindowsXPSP3OrGreater();
AUKN_SYM bool IsWindowsXPSP3();
AUKN_SYM bool IsWindowsXPAny();
AUKN_SYM bool IsWindowsVistaOrGreater();
AUKN_SYM bool IsWindowsVista();
AUKN_SYM bool IsWindowsVistaSP1OrGreater();
AUKN_SYM bool IsWindowsVistaSP1();
AUKN_SYM bool IsWindowsVistaSP2OrGreater();
AUKN_SYM bool IsWindowsVistaSP2();
AUKN_SYM bool IsWindowsVistaAny();
AUKN_SYM bool IsWindows7OrGreater();
AUKN_SYM bool IsWindows7();
AUKN_SYM bool IsWindows7SP1OrGreater();
AUKN_SYM bool IsWindows7SP1();
AUKN_SYM bool IsWindows7Any();
AUKN_SYM bool IsWindows8OrGreater();
AUKN_SYM bool IsWindows8();
AUKN_SYM bool IsWindows8Point1OrGreater();
AUKN_SYM bool IsWindows8Point1();
AUKN_SYM bool IsWindows8Any();
AUKN_SYM bool IsWindows10OrGreater();
AUKN_SYM bool IsWindows10();
AUKN_SYM bool IsWindows11OrGreater();
AUKN_SYM bool IsWindows11();
}

View File

@ -94,6 +94,51 @@ namespace Aurora::SWInfo
AUKN_SYM bool IsWindows11OrGreater()
{
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWin10), AuBitsToLower(kWinVerWin10), 0) && GetPlatformInfo().uKernelPatch >= kKernPatchWin11;
auto &info = GetPlatformInfo();
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWin10), AuBitsToLower(kWinVerWin10), 0) &&
(info.uKernelPatch >= kKernPatchWin11 || info.uKernelMajor > AuBitsToHigher(kWinVerWin10));
}
#define ADD_ABS_CHECK(A, B) \
AUKN_SYM bool IsWindows ## A() \
{ \
return IsWindows ## A ## OrGreater() && !IsWindows ## B ## OrGreater(); \
}
ADD_ABS_CHECK(XP, XPSP1)
ADD_ABS_CHECK(XPSP1, XPSP2)
ADD_ABS_CHECK(XPSP2, XPSP3)
ADD_ABS_CHECK(XPSP3, Vista)
ADD_ABS_CHECK(Vista, VistaSP1)
ADD_ABS_CHECK(VistaSP1, VistaSP2)
ADD_ABS_CHECK(VistaSP2, 7)
ADD_ABS_CHECK(7, 7SP1)
ADD_ABS_CHECK(7SP1, 8Point1)
ADD_ABS_CHECK(8Point1, 10)
ADD_ABS_CHECK(10, 11)
AUKN_SYM bool IsWindows11()
{
return IsWindows11OrGreater();
}
AUKN_SYM bool IsWindowsXPAny()
{
return IsWindowsXPOrGreater() && !IsWindowsVistaOrGreater();
}
AUKN_SYM bool IsWindowsVistaAny()
{
return IsWindowsVistaOrGreater() && !IsWindows7OrGreater();
}
AUKN_SYM bool IsWindows7Any()
{
return IsWindows7OrGreater() && !IsWindows8OrGreater();
}
AUKN_SYM bool IsWindows8Any()
{
return IsWindows8OrGreater() && !IsWindows10OrGreater();
}
}