浏览代码

Fixed compilation for the Windows XP API (#2611)

* Fixed compilation for the Windows XP API

Fixes #2137

Thanks to @zackdreaver

* Fixed Windows version initialization

Respecting the SDK's Windows version and only use our own defines if they are not set by the SDK, which should not happen.

Thanks to @lighta.

* Moved Windows Vista declaration up

This way all defines that should actually come from sdkddkver.h will be checked right behind it and defined if they were not.

* Reverted line deletion
Lemongrass3110 7 年之前
父节点
当前提交
60b5491766
共有 2 个文件被更改,包括 19 次插入6 次删除
  1. 2 2
      src/common/atomic.h
  2. 17 4
      src/common/winapi.h

+ 2 - 2
src/common/atomic.h

@@ -19,8 +19,8 @@
 #if defined(_MSC_VER)
 #include "winapi.h"
 
-// This checks if C/C++ Compiler Version is 18.00
-#if _MSC_VER < 1800
+// This checks if C/C++ Compiler Version is 18.00 or Windows is older than Vista
+#if _MSC_VER < 1800 || WINVER < _WIN32_WINNT_VISTA
 
 #if !defined(_M_X64)
 // When compiling for windows 32bit, the 8byte interlocked operations are not provided by microsoft

+ 17 - 4
src/common/winapi.h

@@ -1,11 +1,24 @@
 #pragma once
 
+#include <sdkddkver.h>
+
+#ifndef NTDDI_VERSION
+	#define NTDDI_VERSION 	0x05000000 // Windows 2000
+#endif
+#ifndef _WIN32_WINNT
+	#define _WIN32_WINNT  0x0500 // Windows 2000
+#endif
+#ifndef WINVER
+	#define WINVER 0x0500 // Windows 2000
+#endif
+#ifndef _WIN32_IE
+	#define _WIN32_IE 	0x0600 // Internet Explorer 6.0
+#endif
+#ifndef _WIN32_WINNT_VISTA
+	#define _WIN32_WINNT_VISTA 0x0600 // Windows Vista
+#endif
 
 #define STRICT
-#define NTDDI_VERSION 	NTDDI_WIN2K
-#define _WIN32_WINNT  0x0500
-#define WINVER 0x0500
-#define _WIN32_IE 	0x0600
 #define WIN32_LEAN_AND_MEAN
 #define NOCOMM 
 #define NOKANJI