[1166] | 1 | /**
|
---|
| 2 | * This file is part of the mingw-w64 runtime package.
|
---|
| 3 | * No warranty is given; refer to the file DISCLAIMER within this package.
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | #ifndef _INC_VERSIONHELPERS
|
---|
| 7 | #define _INC_VERSIONHELPERS
|
---|
| 8 |
|
---|
| 9 | #include <winapifamily.h>
|
---|
| 10 |
|
---|
| 11 | #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && !defined(__WIDL__)
|
---|
| 12 |
|
---|
| 13 | #ifdef __cplusplus
|
---|
| 14 | #define VERSIONHELPERAPI inline bool
|
---|
| 15 | #else
|
---|
| 16 | #define VERSIONHELPERAPI FORCEINLINE BOOL
|
---|
| 17 | #endif
|
---|
| 18 |
|
---|
| 19 | VERSIONHELPERAPI IsWindowsVersionOrGreater(WORD major, WORD minor, WORD servpack)
|
---|
| 20 | {
|
---|
| 21 | OSVERSIONINFOEXW vi = {sizeof(vi),major,minor,0,0,{0},servpack};
|
---|
| 22 | return VerifyVersionInfoW(&vi, VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR,
|
---|
| 23 | VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(0,
|
---|
| 24 | VER_MAJORVERSION,VER_GREATER_EQUAL),
|
---|
| 25 | VER_MINORVERSION,VER_GREATER_EQUAL),
|
---|
| 26 | VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL));
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | VERSIONHELPERAPI IsWindowsXPOrGreater(void) {
|
---|
| 30 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | VERSIONHELPERAPI IsWindowsXPSP1OrGreater(void) {
|
---|
| 34 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | VERSIONHELPERAPI IsWindowsXPSP2OrGreater(void) {
|
---|
| 38 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2);
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | VERSIONHELPERAPI IsWindowsXPSP3OrGreater(void) {
|
---|
| 42 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | VERSIONHELPERAPI IsWindowsVistaOrGreater(void) {
|
---|
| 46 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | VERSIONHELPERAPI IsWindowsVistaSP1OrGreater(void) {
|
---|
| 50 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | VERSIONHELPERAPI IsWindowsVistaSP2OrGreater(void) {
|
---|
| 54 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2);
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | VERSIONHELPERAPI IsWindows7OrGreater(void) {
|
---|
| 58 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | VERSIONHELPERAPI IsWindows7SP1OrGreater(void) {
|
---|
| 62 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1);
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | VERSIONHELPERAPI IsWindows8OrGreater(void) {
|
---|
| 66 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | VERSIONHELPERAPI IsWindows8Point1OrGreater(void) {
|
---|
| 70 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0);
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | VERSIONHELPERAPI IsWindowsThresholdOrGreater(void) {
|
---|
| 74 | return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINTHRESHOLD), LOBYTE(_WIN32_WINNT_WINTHRESHOLD), 0);
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | VERSIONHELPERAPI IsWindows10OrGreater(void) {
|
---|
| 78 | return IsWindowsThresholdOrGreater();
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | VERSIONHELPERAPI IsWindowsServer(void) {
|
---|
| 82 | OSVERSIONINFOEXW vi = {sizeof(vi),0,0,0,0,{0},0,0,0,VER_NT_WORKSTATION};
|
---|
| 83 | return !VerifyVersionInfoW(&vi, VER_PRODUCT_TYPE, VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL));
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | #endif
|
---|
| 87 | #endif
|
---|