aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/NtCheck.h
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/Windows/NtCheck.h')
-rw-r--r--CPP/Windows/NtCheck.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/CPP/Windows/NtCheck.h b/CPP/Windows/NtCheck.h
new file mode 100644
index 0000000..0af3291
--- /dev/null
+++ b/CPP/Windows/NtCheck.h
@@ -0,0 +1,48 @@
1// Windows/NtCheck.h
2
3#ifndef __WINDOWS_NT_CHECK_H
4#define __WINDOWS_NT_CHECK_H
5
6#ifdef _WIN32
7
8#include "../Common/MyWindows.h"
9
10#if !defined(_WIN64) && !defined(UNDER_CE)
11static inline bool IsItWindowsNT()
12{
13 OSVERSIONINFO vi;
14 vi.dwOSVersionInfoSize = sizeof(vi);
15 return (::GetVersionEx(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_NT);
16}
17#endif
18
19#ifndef _UNICODE
20 extern
21 bool g_IsNT;
22 #if defined(_WIN64) || defined(UNDER_CE)
23 bool g_IsNT = true;
24 #define SET_IS_NT
25 #else
26 bool g_IsNT = false;
27 #define SET_IS_NT g_IsNT = IsItWindowsNT();
28 #endif
29 #define NT_CHECK_ACTION
30 // #define NT_CHECK_ACTION { NT_CHECK_FAIL_ACTION }
31#else
32 #if !defined(_WIN64) && !defined(UNDER_CE)
33 #define NT_CHECK_ACTION if (!IsItWindowsNT()) { NT_CHECK_FAIL_ACTION }
34 #else
35 #define NT_CHECK_ACTION
36 #endif
37 #define SET_IS_NT
38#endif
39
40#define NT_CHECK NT_CHECK_ACTION SET_IS_NT
41
42#else
43
44#define NT_CHECK
45
46#endif
47
48#endif