Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
win.h
Go to the documentation of this file.
1/* Copyright (C) 2025 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#include "lib/sysdep/os.h"
31
32#if !OS_WIN
33#error "win.h: do not include if not compiling for Windows"
34#endif
35
36// Win32 socket declarations aren't portable (e.g. problems with socklen_t)
37// => skip winsock.h; use curl or enet library instead.
38#define _WINSOCKAPI_
39
40#define WIN32_LEAN_AND_MEAN
41#define VC_EXTRALEAN
42
43
44// other headers may have defined <windows.h>'s include guard to prevent
45// external libraries from pulling it in (which would cause conflicts).
46#undef _WINDOWS_
47
48#define NOGDICAPMASKS // CC_*, LC_*, PC_*, CP_*, TC_*, RC_
49//#define NOVIRTUALKEYCODES // VK_*
50//#define NOWINMESSAGES // WM_*, EM_*, LB_*, CB_*
51//#define NOWINSTYLES // WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_*
52//#define NOSYSMETRICS // SM_*
53#define NOMENUS // MF_*
54//#define NOICONS // IDI_*
55#define NOKEYSTATES // MK_*
56//#define NOSYSCOMMANDS // SC_*
57#define NORASTEROPS // Binary and Tertiary raster ops
58//#define NOSHOWWINDOW // SW_*
59#define OEMRESOURCE // OEM Resource values
60#define NOATOM // Atom Manager routines
61//#define NOCLIPBOARD // Clipboard routines
62//#define NOCOLOR // Screen colors
63//#define NOCTLMGR // Control and Dialog routines
64#define NODRAWTEXT // DrawText() and DT_*
65//#define NOGDI // All GDI defines and routines
66//#define NOKERNEL // All KERNEL defines and routines
67//#define NOUSER // All USER defines and routines
68//#define NONLS // All NLS defines and routines
69//#define NOMB // MB_* and MessageBox()
70#define NOMEMMGR // GMEM_*, LMEM_*, GHND, LHND, associated routines
71#define NOMETAFILE // typedef METAFILEPICT
72#define NOMINMAX // Macros min(a,b) and max(a,b)
73//#define NOMSG // typedef MSG and associated routines
74#define NOOPENFILE // OpenFile(), OemToAnsi, AnsiToOem, and OF_*
75#define NOSCROLL // SB_* and scrolling routines
76//#define NOSERVICE // All Service Controller routines, SERVICE_ equates, etc.
77//#define NOSOUND // Sound driver routines
78#define NOTEXTMETRIC // typedef TEXTMETRIC and associated routines
79//#define NOWH // SetWindowsHook and WH_*
80//#define NOWINOFFSETS // GWL_*, GCL_*, associated routines
81//#define NOCOMM // COMM driver routines
82#define NOKANJI // Kanji support stuff.
83#define NOHELP // Help engine interface.
84#define NOPROFILER // Profiler interface.
85#define NODEFERWINDOWPOS // DeferWindowPos routines
86#define NOMCX // Modem Configuration Extensions
87#include <windows.h>
88
89#include <winreg.h>
90
91#if ARCH_IA32
92// the official version causes pointer truncation warnings.
93# undef InterlockedExchangePointer
94# define InterlockedExchangePointer(Target, Value) (PVOID)(uintptr_t)InterlockedExchange((PLONG)(Target), (LONG)(uintptr_t)(Value))
95#endif
96
97#endif // #ifndef INCLUDED_WIN