Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/win.h
diff options
context:
space:
mode:
authorDavide Beatrici <davidebeatrici@gmail.com>2019-09-12 23:03:26 +0300
committerDavide Beatrici <davidebeatrici@gmail.com>2019-09-12 23:03:26 +0300
commite29897c784f546dc8c7150811994663818911608 (patch)
treec6fde77b7427fe65a5369c60ea64f0b6d061609c /src/win.h
parent58d27c68a9d131e111ca488b42469bdae68e06e2 (diff)
Add "win.h" header, meant to be included instead of <windows.h>
This commit also merges "qos2_mingw.h" into the new header.
Diffstat (limited to 'src/win.h')
-rw-r--r--src/win.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/win.h b/src/win.h
new file mode 100644
index 000000000..0a9e1d58b
--- /dev/null
+++ b/src/win.h
@@ -0,0 +1,52 @@
+// Copyright 2005-2019 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+// This header is meant to be included instead of <windows.h>.
+// It takes care of including <windows.h> with the right settings and
+// for MinGW compilers it defines stuff that is missing in MinGW’s headers.
+
+#ifndef MUMBLE_WIN_H_
+#define MUMBLE_WIN_H_
+
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+
+#ifndef UNICODE
+# define UNICODE
+#endif
+
+#ifndef NOMINMAX
+# define NOMINMAX
+#endif
+
+#ifdef __MINGW32__
+// Our MinGW build targets Windows 7 for now.
+// Set up the appropriate Windows macros such that
+// MinGW's Windows headers expose all the functionality
+// we need.
+// This seems to be required only with MXE, with MSYS2
+// the target is already Windows 7
+# if (_WIN32_WINNT < 0x0601)
+# undef _WIN32_WINNT
+# define _WIN32_WINNT 0x0601
+# endif
+# if (NTDDI_VERSION < NTDDI_WIN7)
+# undef NTDDI_VERSION
+# define NTDDI_VERSION NTDDI_WIN7
+# endif
+
+// MinGW's <qos2.h> header does not provide everything we need,
+// so define QOS_FLOWID (and PQOS_FLOWID) as well as QOS_NON_ADAPTIVE_FLOW
+// ourselves to allow us to build with QoS support on MinGW.
+typedef UINT32 QOS_FLOWID, *PQOS_FLOWID;
+# ifndef QOS_NON_ADAPTIVE_FLOW
+# define QOS_NON_ADAPTIVE_FLOW 0x00000002
+# endif
+#endif
+
+#include <windows.h>
+
+#endif // MUMBLE_WIN_H_