Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
win.h
Go to the documentation of this file.
1/* Copyright (C) 2010 Wildfire Games.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining
4 * a copy of this software and associated documentation files (the
5 * "Software"), to deal in the Software without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Software, and to
8 * permit persons to whom the Software is furnished to do so, subject to
9 * the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23/*
24 * bring in <windows.h> with compatibility fixes
25 */
26
27#ifndef INCLUDED_WIN
28#define INCLUDED_WIN
29
30#if !OS_WIN
31#error "win.h: do not include if not compiling for Windows"
32#endif
33
34// Win32 socket declarations aren't portable (e.g. problems with socklen_t)
35// => skip winsock.h; use curl or enet library instead.
36#define _WINSOCKAPI_
37
38#define WIN32_LEAN_AND_MEAN
39#define VC_EXTRALEAN
40
41
42// other headers may have defined <windows.h>'s include guard to prevent
43// external libraries from pulling it in (which would cause conflicts).
44#undef _WINDOWS_
45
46// set version; needed for EnumDisplayDevices
47#ifndef NTDDI_VERSION
48# define NTDDI_VERSION NTDDI_LONGHORN
49#endif
50#ifndef _WIN32_WINNT
51# define _WIN32_WINNT 0x600
52#endif
53
54#define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_
55//#define NOVIRTUALKEYCODES // VK_*
56//#define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
57//#define NOWINSTYLES // WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
58//#define NOSYSMETRICS // SM_*
59#define NOMENUS // MF_*
60//#define NOICONS // IDI_*
61#define NOKEYSTATES // MK_*
62//#define NOSYSCOMMANDS // SC_*
63#define NORASTEROPS // Binary and Tertiary raster ops
64//#define NOSHOWWINDOW // SW_*
65#define OEMRESOURCE // OEM Resource values
66#define NOATOM // Atom Manager routines
67//#define NOCLIPBOARD // Clipboard routines
68//#define NOCOLOR // Screen colors
69//#define NOCTLMGR // Control and Dialog routines
70#define NODRAWTEXT // DrawText() and DT_*
71//#define NOGDI // All GDI defines and routines
72//#define NOKERNEL // All KERNEL defines and routines
73//#define NOUSER // All USER defines and routines
74//#define NONLS // All NLS defines and routines
75//#define NOMB // MB_* and MessageBox()
76#define NOMEMMGR // GMEM_*, LMEM_*, GHND, LHND, associated routines
77#define NOMETAFILE // typedef METAFILEPICT
78#define NOMINMAX // Macros min(a,b) and max(a,b)
79//#define NOMSG // typedef MSG and associated routines
80#define NOOPENFILE // OpenFile(), OemToAnsi, AnsiToOem, and OF_*
81#define NOSCROLL // SB_* and scrolling routines
82//#define NOSERVICE // All Service Controller routines, SERVICE_ equates, etc.
83//#define NOSOUND // Sound driver routines
84#define NOTEXTMETRIC // typedef TEXTMETRIC and associated routines
85//#define NOWH // SetWindowsHook and WH_*
86//#define NOWINOFFSETS // GWL_*, GCL_*, associated routines
87//#define NOCOMM // COMM driver routines
88#define NOKANJI // Kanji support stuff.
89#define NOHELP // Help engine interface.
90#define NOPROFILER // Profiler interface.
91#define NODEFERWINDOWPOS // DeferWindowPos routines
92#define NOMCX // Modem Configuration Extensions
93#include <windows.h>
94
95#include <winreg.h>
96
97#if ARCH_IA32
98// the official version causes pointer truncation warnings.
99# undef InterlockedExchangePointer
100# define InterlockedExchangePointer(Target, Value) (PVOID)(uintptr_t)InterlockedExchange((PLONG)(Target), (LONG)(uintptr_t)(Value))
101#endif
102
103#endif // #ifndef INCLUDED_WIN