6 #ifndef _INC_VERSIONHELPERS
7 #define _INC_VERSIONHELPERS
9 #include <winapifamily.h>
11 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && !defined(__WIDL__)
14 #define VERSIONHELPERAPI inline bool
16 #define VERSIONHELPERAPI FORCEINLINE BOOL
19 #define _WIN32_WINNT_WINBLUE 0x0603
21 #ifndef _WIN32_WINNT_WINTHRESHOLD
22 #define _WIN32_WINNT_WINTHRESHOLD 0x0A00
26 IsWindowsVersionOrGreater(WORD major, WORD minor, WORD servpack)
28 OSVERSIONINFOEXW vi = {
sizeof(vi), major, minor, 0, 0, {0}, servpack};
29 return VerifyVersionInfoW(&vi, VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR,
30 VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(0,
31 VER_MAJORVERSION, VER_GREATER_EQUAL),
32 VER_MINORVERSION, VER_GREATER_EQUAL),
33 VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL));
37 IsWindowsXPOrGreater(
void)
39 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0);
43 IsWindowsXPSP1OrGreater(
void)
45 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1);
49 IsWindowsXPSP2OrGreater(
void)
51 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2);
55 IsWindowsXPSP3OrGreater(
void)
57 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3);
61 IsWindowsVistaOrGreater(
void)
63 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
67 IsWindowsVistaSP1OrGreater(
void)
69 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1);
73 IsWindowsVistaSP2OrGreater(
void)
75 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2);
79 IsWindows7OrGreater(
void)
81 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
85 IsWindows7SP1OrGreater(
void)
87 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1);
91 IsWindows8OrGreater(
void)
93 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
97 IsWindows8Point1OrGreater(
void)
99 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0);
103 IsWindows10OrGreater()
105 return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINTHRESHOLD), LOBYTE(_WIN32_WINNT_WINTHRESHOLD), 0);
109 IsWindowsServer(
void)
111 OSVERSIONINFOEXW vi = {
sizeof(vi), 0, 0, 0, 0, {0}, 0, 0, 0, VER_NT_WORKSTATION};
112 return !VerifyVersionInfoW(&vi, VER_PRODUCT_TYPE, VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL));