summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblacksirius <blacksirius@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-06-03 17:55:38 +0000
committerblacksirius <blacksirius@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-06-03 17:55:38 +0000
commitc2fa09af6a98d13d3eedf777f93b00ee666dc324 (patch)
tree142734eae99fac3b08589872c87bff3d1882d355
parent2fae6b0ebfb77c78b76dd48e29ece269127c87ae (diff)
downloadhercules-c2fa09af6a98d13d3eedf777f93b00ee666dc324.tar.gz
hercules-c2fa09af6a98d13d3eedf777f93b00ee666dc324.tar.bz2
hercules-c2fa09af6a98d13d3eedf777f93b00ee666dc324.tar.xz
hercules-c2fa09af6a98d13d3eedf777f93b00ee666dc324.zip
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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16219 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/common/core.c2
-rw-r--r--src/common/lock.c2
-rw-r--r--src/common/random.c3
-rw-r--r--src/common/showmsg.c3
-rw-r--r--src/common/socket.c3
-rw-r--r--src/common/socket.h3
-rw-r--r--src/common/sql.c2
-rw-r--r--src/common/timer.c3
-rw-r--r--src/common/utils.c3
-rw-r--r--src/common/winapi.h36
10 files changed, 45 insertions, 15 deletions
diff --git a/src/common/core.c b/src/common/core.c
index bde1d9c0b..22d36eaab 100644
--- a/src/common/core.c
+++ b/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
diff --git a/src/common/lock.c b/src/common/lock.c
index 643b86e5c..d01a54ca4 100644
--- a/src/common/lock.c
+++ b/src/common/lock.c
@@ -12,7 +12,7 @@
#ifndef WIN32
#include <unistd.h>
#else
-#include <io.h>
+#include "../common/winapi.h"
#endif
// 書き込みファイルの保護処理
diff --git a/src/common/random.c b/src/common/random.c
index 224b71fdb..367d26cfe 100644
--- a/src/common/random.c
+++ b/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>
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index 3beb55b72..c4271eda8 100644
--- a/src/common/showmsg.c
+++ b/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"
diff --git a/src/common/socket.c b/src/common/socket.c
index 9f781f7b7..f8e957788 100644
--- a/src/common/socket.c
+++ b/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>
diff --git a/src/common/socket.h b/src/common/socket.h
index a5d519d0e..3c6cebf0b 100644
--- a/src/common/socket.h
+++ b/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>
diff --git a/src/common/sql.c b/src/common/sql.c
index edac5a297..800aa89b0 100644
--- a/src/common/sql.c
+++ b/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
diff --git a/src/common/timer.c b/src/common/timer.c
index 32bc30520..c239a9d70 100644
--- a/src/common/timer.c
+++ b/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()
diff --git a/src/common/utils.c b/src/common/utils.c
index 08ac8db15..296df7e70 100644
--- a/src/common/utils.c
+++ b/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 */
diff --git a/src/common/winapi.h b/src/common/winapi.h
new file mode 100644
index 000000000..7ce555049
--- /dev/null
+++ b/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>
+
+