aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/wincompat/init.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/wincompat/init.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wincompat/init.c b/src/wincompat/init.c
index f744f69..f92c0a9 100644
--- a/src/wincompat/init.c
+++ b/src/wincompat/init.c
@@ -10,16 +10,22 @@
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x4
#endif
+extern void NTAPI RtlGetNtVersionNumbers(DWORD *major, DWORD *minor, DWORD *build);
+bool is_win7 = false;
+
__attribute__((constructor)) static void init(void)
{
char *colormode;
- DWORD console_mode;
+ DWORD console_mode, major, minor;
HANDLE stdout_handle;
WSADATA wsaData;
if (!SetDllDirectoryA("") || !SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32))
abort();
+ RtlGetNtVersionNumbers(&major, &minor, NULL);
+ is_win7 = (major == 6 && minor <= 1) || major < 6;
+
WSAStartup(MAKEWORD(2, 2), &wsaData);
stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); // We don't close this.