Przeglądaj źródła

cleaned up windows header usage (added one central file to use windows / winapi specific stuff, to be able to set the appropriate flags before including it correctly)

Note: this may screw up mingw or cygwin building,  ill fix it later... 



git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16219 54d463be-8e91-2dee-dedb-b68131a5f0ec
blacksirius 13 lat temu
rodzic
commit
bde86942c0

+ 1 - 1
src/common/core.c

@@ -18,7 +18,7 @@
 #ifndef _WIN32
 #include <unistd.h>
 #else
-#include <windows.h> // Console close event handling
+#include "../common/winapi.h" // Console close event handling
 #endif
 
 

+ 1 - 1
src/common/lock.c

@@ -12,7 +12,7 @@
 #ifndef WIN32
 #include <unistd.h>
 #else
-#include <io.h>
+#include "../common/winapi.h"
 #endif
 
 // 書き込みファイルの保護処理

+ 1 - 2
src/common/random.c

@@ -5,8 +5,7 @@
 #include "../common/timer.h" // gettick
 #include "random.h"
 #if defined(WIN32)
-	#define WIN32_LEAN_AND_MEAN
-	#include <windows.h>
+	#include "../common/winapi.h"
 #elif defined(HAVE_GETPID) || defined(HAVE_GETTID)
 	#include <sys/types.h>
 	#include <unistd.h>

+ 1 - 2
src/common/showmsg.c

@@ -15,8 +15,7 @@
 #include "libconfig.h"
 
 #ifdef WIN32
-	#define WIN32_LEAN_AND_MEAN
-	#include <windows.h>
+	#include "../common/winapi.h"
 
 	#ifdef DEBUGLOGMAP
 		#define DEBUGLOGPATH "log\\map-server.log"

+ 1 - 2
src/common/socket.c

@@ -15,8 +15,7 @@
 #include <sys/types.h>
 
 #ifdef WIN32
-	#include <winsock2.h>
-	#include <io.h>
+	#include "../common/winapi.h"
 #else
 	#include <errno.h>
 	#include <sys/socket.h>

+ 1 - 2
src/common/socket.h

@@ -7,8 +7,7 @@
 #include "../common/cbasetypes.h"
 
 #ifdef WIN32
-	#define WIN32_LEAN_AND_MEAN  // otherwise winsock2.h includes full windows.h
-	#include <winsock2.h>
+	#include "../common/winapi.h"
 	typedef long in_addr_t;
 #else
 	#include <sys/types.h>

+ 1 - 1
src/common/sql.c

@@ -9,7 +9,7 @@
 #include "sql.h"
 
 #ifdef WIN32
-#include <winsock2.h>
+#include "../common/winapi.h"
 #endif
 #include <mysql.h>
 #include <string.h>// strlen/strnlen/memcpy/memset

+ 1 - 2
src/common/timer.c

@@ -14,8 +14,7 @@
 #include <time.h>
 
 #ifdef WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h> // GetTickCount()
+#include "../common/winapi.h" // GetTickCount()
 #else
 #include <unistd.h>
 #include <sys/time.h> // struct timeval, gettimeofday()

+ 1 - 2
src/common/utils.c

@@ -15,8 +15,7 @@
 #include <math.h> // floor()
 
 #ifdef WIN32
-	#include <io.h>
-	#include <windows.h>
+	#include "../common/winapi.h"
 	#ifndef F_OK
 		#define F_OK   0x0
 	#endif  /* F_OK */

+ 36 - 0
src/common/winapi.h

@@ -0,0 +1,36 @@
+#pragma once
+
+
+#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
+#define NOHELP
+#define NOMCX
+#define NOCLIPBOARD
+#define NOCOLOR
+#define NONLS
+#define NOMEMMGR
+#define NOMETAFILE
+#define NOOPENFILE
+#define NOSERVICE
+#define NOSOUND
+#define NOTEXTMETRIC
+
+
+#define _CRT_SECURE_NO_WARNINGS
+#define _CRT_NONSTDC_NO_WARNINGS
+
+#include <io.h>
+#include <Windows.h>
+#include <WinSock2.h>
+#include <In6addr.h>
+#include <Ws2tcpip.h>
+#include <Mswsock.h>
+#include <MMSystem.h>
+
+