From 29a41bf9a00f560b4234a391b4ce3fe9028357fd Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 9 Oct 2011 11:24:45 +0000 Subject: Split Win32 defines out of emu.h to enable Boxi to include them before wx/wx.h (to set UNICODE properly) without also #including winnt.h before UNICODE is set properly. --- lib/win32/emu.h | 35 ++--------------------------------- lib/win32/emu_winver.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 33 deletions(-) create mode 100644 lib/win32/emu_winver.h diff --git a/lib/win32/emu.h b/lib/win32/emu.h index 9582b138..bf408050 100644 --- a/lib/win32/emu.h +++ b/lib/win32/emu.h @@ -1,5 +1,7 @@ // emulates unix syscalls to win32 functions +#include "emu_winver.h" + #ifdef WIN32 #define EMU_STRUCT_STAT struct emu_stat #define EMU_STAT emu_stat @@ -50,39 +52,6 @@ typedef unsigned int pid_t; #endif -// set up to include the necessary parts of Windows headers - -#define WIN32_LEAN_AND_MEAN - -#ifndef __MSVCRT_VERSION__ -#define __MSVCRT_VERSION__ 0x0601 -#endif - -// We need WINVER at least 0x0500 to use GetFileSizeEx on Cygwin/MinGW, -// and 0x0501 for FindFirstFile(W) for opendir/readdir. -// -// WIN32_WINNT versions 0x0600 (Vista) and higher enable WSAPoll() in -// winsock2.h, whose struct pollfd conflicts with ours below, so for -// now we just set it lower than that, to Windows XP (0x0501). - -#ifdef WINVER -# if WINVER != 0x0501 -// provoke a redefinition warning to track down the offender -# define WINVER 0x0501 -# error Must include emu.h before setting WINVER -# endif -#endif -#define WINVER 0x0501 - -#ifdef _WIN32_WINNT -# if _WIN32_WINNT != 0x0501 -// provoke a redefinition warning to track down the offender -# define _WIN32_WINNT 0x0501 -# error Must include emu.h before setting _WIN32_WINNT -# endif -#endif -#define _WIN32_WINNT 0x0501 - // Windows headers #include diff --git a/lib/win32/emu_winver.h b/lib/win32/emu_winver.h new file mode 100644 index 00000000..92060150 --- /dev/null +++ b/lib/win32/emu_winver.h @@ -0,0 +1,37 @@ +#ifndef _EMU_WINVER_H +#define _EMU_WINVER_H + +// set up to include the necessary parts of Windows headers + +#define WIN32_LEAN_AND_MEAN + +#ifndef __MSVCRT_VERSION__ +#define __MSVCRT_VERSION__ 0x0601 +#endif + +// We need WINVER at least 0x0500 to use GetFileSizeEx on Cygwin/MinGW, +// and 0x0501 for FindFirstFile(W) for opendir/readdir. +// +// WIN32_WINNT versions 0x0600 (Vista) and higher enable WSAPoll() in +// winsock2.h, whose struct pollfd conflicts with ours below, so for +// now we just set it lower than that, to Windows XP (0x0501). + +#ifdef WINVER +# if WINVER != 0x0501 +// provoke a redefinition warning to track down the offender +# define WINVER 0x0501 +# error Must include emu.h before setting WINVER +# endif +#endif +#define WINVER 0x0501 + +#ifdef _WIN32_WINNT +# if _WIN32_WINNT != 0x0501 +// provoke a redefinition warning to track down the offender +# define _WIN32_WINNT 0x0501 +# error Must include emu.h before setting _WIN32_WINNT +# endif +#endif +#define _WIN32_WINNT 0x0501 + +#endif // _EMU_WINVER_H -- cgit v1.2.3