aboutsummaryrefslogtreecommitdiff
path: root/CPP/Windows/NtCheck.h
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2021-12-27 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2022-03-18 15:35:13 +0500
commitf19f813537c7aea1c20749c914e756b54a9c3cf5 (patch)
tree816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Windows/NtCheck.h
parent98e06a519b63b81986abe76d28887f6984a7732b (diff)
download7zip-21.07.tar.gz
7zip-21.07.tar.bz2
7zip-21.07.zip
'21.07'21.07
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