| 1 | /* |
| 2 | * Copyright 2013, 2017 Andrey Semashev |
| 3 | * Copyright 2017 James E. King, III |
| 4 | * |
| 5 | * Distributed under the Boost Software License, Version 1.0. |
| 6 | * See http://www.boost.org/LICENSE_1_0.txt |
| 7 | */ |
| 8 | |
| 9 | #ifndef BOOST_WINAPI_CONFIG_HPP_INCLUDED_ |
| 10 | #define BOOST_WINAPI_CONFIG_HPP_INCLUDED_ |
| 11 | |
| 12 | #include <boost/predef/version_number.h> |
| 13 | #include <boost/predef/platform.h> |
| 14 | #if defined(__CYGWIN__) |
| 15 | // Cygwin 64 compiler does not define _WIN64 and instead defines it in a private header. We can't define _WIN64 ourselves because |
| 16 | // the header defines the macro unconditionally and if the user includes both Boost.WinAPI and Cygwin WinAPI headers there will be conflict. |
| 17 | #include <_cygwin.h> |
| 18 | #endif |
| 19 | #if defined(__MINGW32__) |
| 20 | // MinGW and MinGW-w64 define __MINGW32_VERSION_MAJOR/MINOR and __MINGW64_VERSION_MAJOR/MINOR macros in a private header. |
| 21 | #include <_mingw.h> |
| 22 | #endif |
| 23 | |
| 24 | // BOOST_WINAPI_IS_MINGW indicates that the target Windows SDK is provided by MinGW (http://mingw.org/). |
| 25 | // BOOST_WINAPI_IS_MINGW_W64 indicates that the target Windows SDK is provided by MinGW-w64 (http://mingw-w64.org). |
| 26 | // BOOST_WINAPI_IS_CYGWIN indicates that the target Windows SDK is provided by MinGW variant from Cygwin (https://cygwin.com/). |
| 27 | #if defined(__CYGWIN__) |
| 28 | #define BOOST_WINAPI_IS_CYGWIN |
| 29 | #elif BOOST_PLAT_MINGW |
| 30 | #if defined(__MINGW64_VERSION_MAJOR) |
| 31 | #define BOOST_WINAPI_IS_MINGW_W64 |
| 32 | #else |
| 33 | #define BOOST_WINAPI_IS_MINGW |
| 34 | #endif |
| 35 | #endif |
| 36 | |
| 37 | // These constants reflect _WIN32_WINNT_* macros from sdkddkver.h |
| 38 | // See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx#setting_winver_or__win32_winnt |
| 39 | #define BOOST_WINAPI_VERSION_NT4 0x0400 |
| 40 | #define BOOST_WINAPI_VERSION_WIN2K 0x0500 |
| 41 | #define BOOST_WINAPI_VERSION_WINXP 0x0501 |
| 42 | #define BOOST_WINAPI_VERSION_WS03 0x0502 |
| 43 | #define BOOST_WINAPI_VERSION_WIN6 0x0600 |
| 44 | #define BOOST_WINAPI_VERSION_VISTA 0x0600 |
| 45 | #define BOOST_WINAPI_VERSION_WS08 0x0600 |
| 46 | #define BOOST_WINAPI_VERSION_LONGHORN 0x0600 |
| 47 | #define BOOST_WINAPI_VERSION_WIN7 0x0601 |
| 48 | #define BOOST_WINAPI_VERSION_WIN8 0x0602 |
| 49 | #define BOOST_WINAPI_VERSION_WINBLUE 0x0603 |
| 50 | #define BOOST_WINAPI_VERSION_WINTHRESHOLD 0x0A00 |
| 51 | #define BOOST_WINAPI_VERSION_WIN10 0x0A00 |
| 52 | |
| 53 | // These constants reflect NTDDI_* macros from sdkddkver.h |
| 54 | #define BOOST_WINAPI_NTDDI_WIN2K 0x05000000 |
| 55 | #define BOOST_WINAPI_NTDDI_WIN2KSP1 0x05000100 |
| 56 | #define BOOST_WINAPI_NTDDI_WIN2KSP2 0x05000200 |
| 57 | #define BOOST_WINAPI_NTDDI_WIN2KSP3 0x05000300 |
| 58 | #define BOOST_WINAPI_NTDDI_WIN2KSP4 0x05000400 |
| 59 | |
| 60 | #define BOOST_WINAPI_NTDDI_WINXP 0x05010000 |
| 61 | #define BOOST_WINAPI_NTDDI_WINXPSP1 0x05010100 |
| 62 | #define BOOST_WINAPI_NTDDI_WINXPSP2 0x05010200 |
| 63 | #define BOOST_WINAPI_NTDDI_WINXPSP3 0x05010300 |
| 64 | #define BOOST_WINAPI_NTDDI_WINXPSP4 0x05010400 |
| 65 | |
| 66 | #define BOOST_WINAPI_NTDDI_WS03 0x05020000 |
| 67 | #define BOOST_WINAPI_NTDDI_WS03SP1 0x05020100 |
| 68 | #define BOOST_WINAPI_NTDDI_WS03SP2 0x05020200 |
| 69 | #define BOOST_WINAPI_NTDDI_WS03SP3 0x05020300 |
| 70 | #define BOOST_WINAPI_NTDDI_WS03SP4 0x05020400 |
| 71 | |
| 72 | #define BOOST_WINAPI_NTDDI_WIN6 0x06000000 |
| 73 | #define BOOST_WINAPI_NTDDI_WIN6SP1 0x06000100 |
| 74 | #define BOOST_WINAPI_NTDDI_WIN6SP2 0x06000200 |
| 75 | #define BOOST_WINAPI_NTDDI_WIN6SP3 0x06000300 |
| 76 | #define BOOST_WINAPI_NTDDI_WIN6SP4 0x06000400 |
| 77 | |
| 78 | #define BOOST_WINAPI_NTDDI_VISTA BOOST_WINAPI_NTDDI_WIN6 |
| 79 | #define BOOST_WINAPI_NTDDI_VISTASP1 BOOST_WINAPI_NTDDI_WIN6SP1 |
| 80 | #define BOOST_WINAPI_NTDDI_VISTASP2 BOOST_WINAPI_NTDDI_WIN6SP2 |
| 81 | #define BOOST_WINAPI_NTDDI_VISTASP3 BOOST_WINAPI_NTDDI_WIN6SP3 |
| 82 | #define BOOST_WINAPI_NTDDI_VISTASP4 BOOST_WINAPI_NTDDI_WIN6SP4 |
| 83 | |
| 84 | #define BOOST_WINAPI_NTDDI_LONGHORN BOOST_WINAPI_NTDDI_VISTA |
| 85 | |
| 86 | #define BOOST_WINAPI_NTDDI_WS08 BOOST_WINAPI_NTDDI_WIN6SP1 |
| 87 | #define BOOST_WINAPI_NTDDI_WS08SP2 BOOST_WINAPI_NTDDI_WIN6SP2 |
| 88 | #define BOOST_WINAPI_NTDDI_WS08SP3 BOOST_WINAPI_NTDDI_WIN6SP3 |
| 89 | #define BOOST_WINAPI_NTDDI_WS08SP4 BOOST_WINAPI_NTDDI_WIN6SP4 |
| 90 | |
| 91 | #define BOOST_WINAPI_NTDDI_WIN7 0x06010000 |
| 92 | #define BOOST_WINAPI_NTDDI_WIN7SP1 0x06010100 // Not defined in Windows SDK |
| 93 | #define BOOST_WINAPI_NTDDI_WIN8 0x06020000 |
| 94 | #define BOOST_WINAPI_NTDDI_WINBLUE 0x06030000 |
| 95 | #define BOOST_WINAPI_NTDDI_WINTHRESHOLD 0x0A000000 |
| 96 | #define BOOST_WINAPI_NTDDI_WIN10 0x0A000000 |
| 97 | #define BOOST_WINAPI_NTDDI_WIN10_TH2 0x0A000001 |
| 98 | #define BOOST_WINAPI_NTDDI_WIN10_RS1 0x0A000002 |
| 99 | #define BOOST_WINAPI_NTDDI_WIN10_RS2 0x0A000003 |
| 100 | #define BOOST_WINAPI_NTDDI_WIN10_RS3 0x0A000004 |
| 101 | |
| 102 | #define BOOST_WINAPI_DETAIL_MAKE_NTDDI_VERSION2(x) x##0000 |
| 103 | #define BOOST_WINAPI_DETAIL_MAKE_NTDDI_VERSION(x) BOOST_WINAPI_DETAIL_MAKE_NTDDI_VERSION2(x) |
| 104 | |
| 105 | #if !defined(BOOST_USE_WINAPI_VERSION) |
| 106 | #if defined(_WIN32_WINNT) |
| 107 | #define BOOST_USE_WINAPI_VERSION _WIN32_WINNT |
| 108 | #elif defined(WINVER) |
| 109 | #define BOOST_USE_WINAPI_VERSION WINVER |
| 110 | #else |
| 111 | // By default use Windows 10 API on compilers that support it and latest versions on the others |
| 112 | #if (defined(_MSC_VER) && _MSC_VER < 1500) || defined(BOOST_WINAPI_IS_MINGW) |
| 113 | #define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WINXP |
| 114 | #elif (defined(_MSC_VER) && _MSC_VER < 1600) |
| 115 | #define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WIN6 |
| 116 | #elif (defined(_MSC_VER) && _MSC_VER < 1700) |
| 117 | #define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WIN7 |
| 118 | #elif (defined(_MSC_VER) && _MSC_VER < 1800) |
| 119 | #define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WIN8 |
| 120 | #elif (defined(_MSC_VER) && _MSC_VER < 1900) |
| 121 | #define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WINBLUE |
| 122 | #else |
| 123 | #define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WIN10 |
| 124 | #endif |
| 125 | #endif |
| 126 | #endif |
| 127 | |
| 128 | #if !defined(BOOST_USE_NTDDI_VERSION) |
| 129 | #if defined(NTDDI_VERSION) |
| 130 | #define BOOST_USE_NTDDI_VERSION NTDDI_VERSION |
| 131 | // Default to respective Windows version with the latest Service Pack |
| 132 | #elif BOOST_USE_WINAPI_VERSION == BOOST_WINAPI_VERSION_WIN2K |
| 133 | #define BOOST_USE_NTDDI_VERSION BOOST_WINAPI_NTDDI_WIN2KSP4 |
| 134 | #elif BOOST_USE_WINAPI_VERSION == BOOST_WINAPI_VERSION_WINXP |
| 135 | #define BOOST_USE_NTDDI_VERSION BOOST_WINAPI_NTDDI_WINXPSP3 |
| 136 | #elif BOOST_USE_WINAPI_VERSION == BOOST_WINAPI_VERSION_WS03 |
| 137 | #define BOOST_USE_NTDDI_VERSION BOOST_WINAPI_NTDDI_WS03SP2 |
| 138 | #elif BOOST_USE_WINAPI_VERSION == BOOST_WINAPI_VERSION_WIN6 |
| 139 | #define BOOST_USE_NTDDI_VERSION BOOST_WINAPI_NTDDI_WIN6SP2 |
| 140 | #elif BOOST_USE_WINAPI_VERSION == BOOST_WINAPI_VERSION_WIN7 |
| 141 | #define BOOST_USE_NTDDI_VERSION BOOST_WINAPI_NTDDI_WIN7SP1 |
| 142 | #elif BOOST_USE_WINAPI_VERSION == BOOST_WINAPI_VERSION_WIN10 |
| 143 | #define BOOST_USE_NTDDI_VERSION BOOST_WINAPI_NTDDI_WIN10_RS3 |
| 144 | #else |
| 145 | #define BOOST_USE_NTDDI_VERSION BOOST_WINAPI_DETAIL_MAKE_NTDDI_VERSION(BOOST_USE_WINAPI_VERSION) |
| 146 | #endif |
| 147 | #endif |
| 148 | |
| 149 | // Known Windows SDK versions, taken from VER_PRODUCTBUILD macro value defined in ntverp.h. |
| 150 | // These values can be used to compare with BOOST_PLAT_WINDOWS_SDK_VERSION from Boost.Predef. |
| 151 | #define BOOST_WINAPI_WINDOWS_SDK_MSVC71 BOOST_VERSION_NUMBER(0, 0, 3668) // Windows SDK bundled with MSVC 7.1 |
| 152 | #define BOOST_WINAPI_WINDOWS_SDK_MSVC8 BOOST_VERSION_NUMBER(0, 0, 3790) // Windows SDK bundled with MSVC 8 |
| 153 | #define BOOST_WINAPI_WINDOWS_SDK_6_0 BOOST_VERSION_NUMBER(0, 0, 6000) // Windows SDK 6.0 |
| 154 | #define BOOST_WINAPI_WINDOWS_SDK_7_0 BOOST_VERSION_NUMBER(0, 0, 7600) // Windows SDK 7.0, 7.1 |
| 155 | #define BOOST_WINAPI_WINDOWS_SDK_8_0 BOOST_VERSION_NUMBER(0, 0, 9200) // Windows SDK 8.0 |
| 156 | #define BOOST_WINAPI_WINDOWS_SDK_8_1 BOOST_VERSION_NUMBER(0, 0, 9600) // Windows SDK 8.1 |
| 157 | #define BOOST_WINAPI_WINDOWS_SDK_10_0 BOOST_VERSION_NUMBER(0, 0, 10011) // Windows SDK 10.0 |
| 158 | // MinGW does not have the ntverp.h header but it defines VER_PRODUCTBUILD in ddk/ntifs.h. |
| 159 | // Cygwin MinGW also defines this version. |
| 160 | #define BOOST_WINAPI_WINDOWS_SDK_MINGW BOOST_VERSION_NUMBER(0, 0, 10000) |
| 161 | // MinGW-w64 defines the same version as the Windows SDK bundled with MSVC 8 |
| 162 | #define BOOST_WINAPI_WINDOWS_SDK_MINGW_W64 BOOST_VERSION_NUMBER(0, 0, 3790) |
| 163 | |
| 164 | #if !defined(BOOST_USE_WINAPI_FAMILY) |
| 165 | #if defined(WINAPI_FAMILY) |
| 166 | #define BOOST_USE_WINAPI_FAMILY WINAPI_FAMILY |
| 167 | #elif defined(WINAPI_FAMILY_DESKTOP_APP) |
| 168 | // If none is specified, default to a desktop application which is the most |
| 169 | // backwards compatible to previous ways of doing things, if families are even |
| 170 | // defined. |
| 171 | #define BOOST_USE_WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP |
| 172 | #endif |
| 173 | #endif |
| 174 | |
| 175 | // |
| 176 | // UWP Support |
| 177 | // |
| 178 | // On platforms without windows family partition support it is assumed one |
| 179 | // has all APIs and access is controlled by _WIN32_WINNT or similar mechanisms. |
| 180 | // |
| 181 | // Leveraging Boost.Predef here |
| 182 | // |
| 183 | #if BOOST_PLAT_WINDOWS_UWP |
| 184 | #define BOOST_WINAPI_PARTITION_APP (BOOST_PLAT_WINDOWS_DESKTOP || BOOST_PLAT_WINDOWS_STORE || BOOST_WINAPI_PARTITION_PHONE) |
| 185 | #define BOOST_WINAPI_PARTITION_PC (BOOST_PLAT_WINDOWS_STORE) |
| 186 | #define BOOST_WINAPI_PARTITION_PHONE (BOOST_PLAT_WINDOWS_PHONE) |
| 187 | #define BOOST_WINAPI_PARTITION_SYSTEM (BOOST_PLAT_WINDOWS_SYSTEM) |
| 188 | #define BOOST_WINAPI_PARTITION_SERVER (BOOST_PLAT_WINDOWS_SERVER) |
| 189 | #define BOOST_WINAPI_PARTITION_DESKTOP (BOOST_PLAT_WINDOWS_DESKTOP) |
| 190 | #else // BOOST_PLAT_WINDOWS_UWP |
| 191 | #define BOOST_WINAPI_PARTITION_APP (1) |
| 192 | #define BOOST_WINAPI_PARTITION_PC (1) |
| 193 | #define BOOST_WINAPI_PARTITION_PHONE (1) |
| 194 | #define BOOST_WINAPI_PARTITION_SYSTEM (1) |
| 195 | #define BOOST_WINAPI_PARTITION_SERVER (1) |
| 196 | #define BOOST_WINAPI_PARTITION_DESKTOP (1) |
| 197 | #endif // BOOST_PLAT_WINDOWS_UWP |
| 198 | |
| 199 | // |
| 200 | // Windows 8.x SDK defines some items in the DESKTOP partition and then Windows SDK 10.0 defines |
| 201 | // the same items to be in APP or SYSTEM partitions, and APP expands to DESKTOP or PC or PHONE. |
| 202 | // The definition of BOOST_WINAPI_PARTITION_APP_SYSTEM provides a universal way to get this |
| 203 | // right as it is seen in a number of places in the SDK. |
| 204 | // |
| 205 | #define BOOST_WINAPI_PARTITION_APP_SYSTEM \ |
| 206 | ( \ |
| 207 | ((BOOST_PLAT_WINDOWS_SDK_VERSION >= BOOST_WINAPI_WINDOWS_SDK_10_0) && (BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM)) || \ |
| 208 | ((BOOST_PLAT_WINDOWS_SDK_VERSION < BOOST_WINAPI_WINDOWS_SDK_10_0) && BOOST_WINAPI_PARTITION_DESKTOP) \ |
| 209 | ) |
| 210 | |
| 211 | // Simiarly, some other symbols were re-classified as DESKTOP or SYSTEM |
| 212 | #define BOOST_WINAPI_PARTITION_DESKTOP_SYSTEM \ |
| 213 | ( \ |
| 214 | ((BOOST_PLAT_WINDOWS_SDK_VERSION >= BOOST_WINAPI_WINDOWS_SDK_10_0) && (BOOST_WINAPI_PARTITION_DESKTOP || BOOST_WINAPI_PARTITION_SYSTEM)) || \ |
| 215 | ((BOOST_PLAT_WINDOWS_SDK_VERSION < BOOST_WINAPI_WINDOWS_SDK_10_0) && BOOST_WINAPI_PARTITION_DESKTOP) \ |
| 216 | ) |
| 217 | |
| 218 | #if defined(BOOST_USE_WINDOWS_H) || defined(BOOST_WINAPI_DEFINE_VERSION_MACROS) |
| 219 | // We have to define the version macros so that windows.h provides the necessary symbols |
| 220 | #if !defined(_WIN32_WINNT) |
| 221 | #define _WIN32_WINNT BOOST_USE_WINAPI_VERSION |
| 222 | #endif |
| 223 | #if !defined(WINVER) |
| 224 | #define WINVER BOOST_USE_WINAPI_VERSION |
| 225 | #endif |
| 226 | #if !defined(NTDDI_VERSION) |
| 227 | #define NTDDI_VERSION BOOST_USE_NTDDI_VERSION |
| 228 | #endif |
| 229 | #if !defined(WINAPI_FAMILY) && defined(BOOST_USE_WINAPI_FAMILY) |
| 230 | #define WINAPI_FAMILY BOOST_USE_WINAPI_FAMILY |
| 231 | #endif |
| 232 | #endif |
| 233 | |
| 234 | #if defined (WIN32_PLATFORM_PSPC) |
| 235 | #define BOOST_WINAPI_IMPORT BOOST_SYMBOL_IMPORT |
| 236 | #define BOOST_WINAPI_IMPORT_EXCEPT_WM |
| 237 | #elif defined (_WIN32_WCE) |
| 238 | #define BOOST_WINAPI_IMPORT |
| 239 | #define BOOST_WINAPI_IMPORT_EXCEPT_WM |
| 240 | #else |
| 241 | #define BOOST_WINAPI_IMPORT BOOST_SYMBOL_IMPORT |
| 242 | #define BOOST_WINAPI_IMPORT_EXCEPT_WM BOOST_SYMBOL_IMPORT |
| 243 | #endif |
| 244 | |
| 245 | #include <boost/config.hpp> |
| 246 | |
| 247 | #ifdef BOOST_HAS_PRAGMA_ONCE |
| 248 | #pragma once |
| 249 | #endif |
| 250 | |
| 251 | #endif // BOOST_WINAPI_CONFIG_HPP_INCLUDED_ |
| 252 | |