[+] bool IsWindows10MilestoneTH1OrGreater()

[+] bool IsWindows10MilestoneTH1()
[+] bool IsWindows10MilestoneTH2OrGreater()
[+] bool IsWindows10MilestoneTH2()
[+] bool IsWindows10MilestoneRS1OrGreater()
[+] bool IsWindows10MilestoneRS1()
[+] bool IsWindows10MilestoneRS2OrGreater()
[+] bool IsWindows10MilestoneRS2()
[+] bool IsWindows10MilestoneRS3OrGreater()
[+] bool IsWindows10MilestoneRS3()
[+] bool IsWindows10MilestoneRS4OrGreater()
[+] bool IsWindows10MilestoneRS4()
[+] bool IsWindows10MilestoneRS5OrGreater()
[+] bool IsWindows10MilestoneRS5()
[+] bool IsWindows10Milestone19H1OrGreater()
[+] bool IsWindows10Milestone19H1()
[+] bool IsWindows10Milestone19H2OrGreater()
[+] bool IsWindows10Milestone19H2()
[+] bool IsWindows10Milestone20H1OrGreater()
[+] bool IsWindows10Milestone20H1()
[+] bool IsWindows10Milestone20H2OrGreater()
[+] bool IsWindows10Milestone20H2()
[+] bool IsWindows10Milestone21H1OrGreater()
[+] bool IsWindows10Milestone21H1()
[+] bool IsWindows10Milestone21H2OrGreater()
[+] bool IsWindows10Milestone21H2()
[+] bool IsWindows10Milestone22H2OrGreater()
[+] bool IsWindows10Milestone22H2()
This commit is contained in:
Reece Wilson 2023-11-29 07:35:03 +00:00
parent de6b9d0bcb
commit b4410fde52
2 changed files with 101 additions and 15 deletions

View File

@ -38,6 +38,34 @@ namespace Aurora::SWInfo
AUKN_SYM bool IsWindows8Any(); AUKN_SYM bool IsWindows8Any();
AUKN_SYM bool IsWindows10OrGreater(); AUKN_SYM bool IsWindows10OrGreater();
AUKN_SYM bool IsWindows10(); AUKN_SYM bool IsWindows10();
AUKN_SYM bool IsWindows10MilestoneTH1OrGreater();
AUKN_SYM bool IsWindows10MilestoneTH1();
AUKN_SYM bool IsWindows10MilestoneTH2OrGreater();
AUKN_SYM bool IsWindows10MilestoneTH2();
AUKN_SYM bool IsWindows10MilestoneRS1OrGreater();
AUKN_SYM bool IsWindows10MilestoneRS1();
AUKN_SYM bool IsWindows10MilestoneRS2OrGreater();
AUKN_SYM bool IsWindows10MilestoneRS2();
AUKN_SYM bool IsWindows10MilestoneRS3OrGreater();
AUKN_SYM bool IsWindows10MilestoneRS3();
AUKN_SYM bool IsWindows10MilestoneRS4OrGreater();
AUKN_SYM bool IsWindows10MilestoneRS4();
AUKN_SYM bool IsWindows10MilestoneRS5OrGreater();
AUKN_SYM bool IsWindows10MilestoneRS5();
AUKN_SYM bool IsWindows10Milestone19H1OrGreater();
AUKN_SYM bool IsWindows10Milestone19H1();
AUKN_SYM bool IsWindows10Milestone19H2OrGreater();
AUKN_SYM bool IsWindows10Milestone19H2();
AUKN_SYM bool IsWindows10Milestone20H1OrGreater();
AUKN_SYM bool IsWindows10Milestone20H1();
AUKN_SYM bool IsWindows10Milestone20H2OrGreater();
AUKN_SYM bool IsWindows10Milestone20H2();
AUKN_SYM bool IsWindows10Milestone21H1OrGreater();
AUKN_SYM bool IsWindows10Milestone21H1();
AUKN_SYM bool IsWindows10Milestone21H2OrGreater();
AUKN_SYM bool IsWindows10Milestone21H2();
AUKN_SYM bool IsWindows10Milestone22H2OrGreater();
AUKN_SYM bool IsWindows10Milestone22H2();
AUKN_SYM bool IsWindows11OrGreater(); AUKN_SYM bool IsWindows11OrGreater();
AUKN_SYM bool IsWindows11(); AUKN_SYM bool IsWindows11();
} }

View File

@ -11,18 +11,33 @@
namespace Aurora::SWInfo namespace Aurora::SWInfo
{ {
static AuUInt16 kWinVerNT4 = 0x0400; static const AuUInt16 kWinVerNT4 = 0x0400;
static AuUInt16 kWinVerWin2K = 0x0500; static const AuUInt16 kWinVerWin2K = 0x0500;
static AuUInt16 kWinVerWinXP = 0x0501; static const AuUInt16 kWinVerWinXP = 0x0501;
static AuUInt16 kWinVerWS03 = 0x0502; static const AuUInt16 kWinVerWS03 = 0x0502;
static AuUInt16 kWinVerWin6 = 0x0600; static const AuUInt16 kWinVerWin6 = 0x0600;
static AuUInt16 kWinVerVista = 0x0600; static const AuUInt16 kWinVerVista = 0x0600;
static AuUInt16 kWinVerWS08 = 0x0600; static const AuUInt16 kWinVerWS08 = 0x0600;
static AuUInt16 kWinVerWin7 = 0x0601; static const AuUInt16 kWinVerWin7 = 0x0601;
static AuUInt16 kWinVerWin8 = 0x0602; static const AuUInt16 kWinVerWin8 = 0x0602;
static AuUInt16 kWinVerWinBlue = 0x0603; static const AuUInt16 kWinVerWinBlue = 0x0603;
static AuUInt16 kWinVerWin10 = 0x0A00; static const AuUInt16 kWinVerWin10 = 0x0A00;
static AuUInt16 kKernPatchWin11 = 22000; static const AuUInt16 kKernPatchWin11 = 22000;
static const AuUInt16 kWin10KernPatchTH1 = 10240;
static const AuUInt16 kWin10KernPatchTH2 = 10586;
static const AuUInt16 kWin10KernPatchRS1 = 14393;
static const AuUInt16 kWin10KernPatchRS2 = 15063;
static const AuUInt16 kWin10KernPatchRS3 = 16299;
static const AuUInt16 kWin10KernPatchRS4 = 17134;
static const AuUInt16 kWin10KernPatchRS5 = 17763;
static const AuUInt16 kWin10KernPatch19H1 = 18362;
static const AuUInt16 kWin10KernPatch19H2 = 18363;
static const AuUInt16 kWin10KernPatch20H1 = 19041;
static const AuUInt16 kWin10KernPatch20H2 = 19042;
static const AuUInt16 kWin10KernPatch21H1 = 19043;
static const AuUInt16 kWin10KernPatch21H2 = 19044;
static const AuUInt16 kWin10KernPatch22H2 = 19045;
static const AuUInt16 kWin10KernPatchDummy = kKernPatchWin11;
static bool IsWindowsVersionOrGreater(AuUInt8 major, AuUInt8 minor, AuUInt16 sp) static bool IsWindowsVersionOrGreater(AuUInt8 major, AuUInt8 minor, AuUInt16 sp)
{ {
@ -32,6 +47,25 @@ namespace Aurora::SWInfo
((info.uKernelMajor == major && info.uKernelMinor == minor) ? info.uUserlandMinor >= sp : true); ((info.uKernelMajor == major && info.uKernelMinor == minor) ? info.uUserlandMinor >= sp : true);
} }
static bool DoWin10PatchGreaterCheck(AuUInt32 uPatch)
{
auto &info = GetPlatformInfo();
return info.ePlatform == Build::EPlatform::ePlatformWin32 &&
(info.uKernelMajor > AuBitsToHigher(kWinVerWin10) ||
(info.uKernelMajor == AuBitsToHigher(kWinVerWin10) &&
info.uKernelMinor || info.uKernelPatch >= uPatch));
}
static bool DoWin10PatchEqCheck(AuUInt32 uPatch, AuUInt32 uPatch2)
{
auto &info = GetPlatformInfo();
return info.ePlatform == Build::EPlatform::ePlatformWin32 &&
info.uKernelPatch >= uPatch &&
info.uKernelPatch < uPatch2 &&
info.uKernelMajor == AuBitsToHigher(kWinVerWin10) &&
info.uKernelMinor == AuBitsToLower(kWinVerWin10);
}
AUKN_SYM bool IsWindowsXPOrGreater() AUKN_SYM bool IsWindowsXPOrGreater()
{ {
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWinXP), AuBitsToLower(kWinVerWinXP), 0); return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWinXP), AuBitsToLower(kWinVerWinXP), 0);
@ -94,9 +128,7 @@ namespace Aurora::SWInfo
AUKN_SYM bool IsWindows11OrGreater() AUKN_SYM bool IsWindows11OrGreater()
{ {
auto &info = GetPlatformInfo(); return DoWin10PatchGreaterCheck(kKernPatchWin11);
return IsWindowsVersionOrGreater(AuBitsToHigher(kWinVerWin10), AuBitsToLower(kWinVerWin10), 0) &&
(info.uKernelPatch >= kKernPatchWin11 || info.uKernelMajor > AuBitsToHigher(kWinVerWin10));
} }
#define ADD_ABS_CHECK(A, B) \ #define ADD_ABS_CHECK(A, B) \
@ -142,4 +174,30 @@ namespace Aurora::SWInfo
{ {
return IsWindows8OrGreater() && !IsWindows10OrGreater(); return IsWindows8OrGreater() && !IsWindows10OrGreater();
} }
#define ADD_WIN10_VER(name, next) \
\
AUKN_SYM bool IsWindows10Milestone ## name ## OrGreater() \
{ \
return DoWin10PatchGreaterCheck(kWin10KernPatch ## name); \
} \
\
AUKN_SYM bool IsWindows10Milestone ## name() \
{ \
return DoWin10PatchEqCheck(kWin10KernPatch ## name, kWin10KernPatch ## next); \
}
ADD_WIN10_VER(TH1, TH2);
ADD_WIN10_VER(TH2, RS1);
ADD_WIN10_VER(RS1, RS2);
ADD_WIN10_VER(RS2, RS4);
ADD_WIN10_VER(RS4, RS5);
ADD_WIN10_VER(RS5, 19H1);
ADD_WIN10_VER(19H1, 19H2);
ADD_WIN10_VER(19H2, 20H1);
ADD_WIN10_VER(20H1, 20H2);
ADD_WIN10_VER(20H2, 21H1);
ADD_WIN10_VER(21H1, 21H2);
ADD_WIN10_VER(21H2, 22H2);
ADD_WIN10_VER(22H2, Dummy);
} }