NtCheck.h revision baa3858d3f5d128a5c8466b700098109edcad5f2
1// Windows/NtCheck.h
2
3#ifndef __WINDOWS_NT_CHECK_H
4#define __WINDOWS_NT_CHECK_H
5
6#ifdef _WIN32
7
8#if !defined(_WIN64) && !defined(UNDER_CE)
9static inline bool IsItWindowsNT()
10{
11  OSVERSIONINFO vi;
12  vi.dwOSVersionInfoSize = sizeof(vi);
13  return (::GetVersionEx(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_NT);
14}
15#endif
16
17#ifndef _UNICODE
18  #if defined(_WIN64) || defined(UNDER_CE)
19    bool g_IsNT = true;
20    #define SET_IS_NT
21  #else
22    bool g_IsNT = false;
23    #define SET_IS_NT g_IsNT = IsItWindowsNT();
24  #endif
25  #define NT_CHECK_ACTION
26  // #define NT_CHECK_ACTION { NT_CHECK_FAIL_ACTION }
27#else
28  #if !defined(_WIN64) && !defined(UNDER_CE)
29    #define NT_CHECK_ACTION if (!IsItWindowsNT()) { NT_CHECK_FAIL_ACTION }
30  #else
31    #define NT_CHECK_ACTION
32  #endif
33  #define SET_IS_NT
34#endif
35
36#define NT_CHECK  NT_CHECK_ACTION SET_IS_NT
37
38#else
39
40#define NT_CHECK
41
42#endif
43
44#endif
45