source: Daodan/MinGW/include/sdkddkver.h@ 1098

Last change on this file since 1098 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 9.8 KB
Line 
1/*
2 * sdkddkver.h
3 *
4 * Macros to set up the compilation environment, such that it provides
5 * support for a user specified host OS version, (default Win2K).
6 *
7 * $Id: sdkddkver.h,v f02731a7c98a 2016/06/02 21:15:06 keithmarshall $
8 *
9 * Written by Earnie Boyd <earnie@users.sourceforge.net>
10 * Copyright (C) 2012, 2013, 2015, MinGW.org Project
11 *
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice (including the next
21 * paragraph) shall be included in all copies or substantial portions of the
22 * Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 * DEALINGS IN THE SOFTWARE.
31 *
32 */
33#ifndef _SDKDDKVER_H
34#define _SDKDDKVER_H
35#pragma GCC system_header
36
37/* Define masks for extracting version components from NTDDI_VERSION;
38 * values and names are guessed based on comments in the documentation; see
39 * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx
40 */
41#define OSVERSION_MASK 0xFFFF0000
42#define SPVERSION_MASK 0x0000FF00
43#define SUBVERSION_MASK 0x000000FF
44
45/* Macros to facilitate such extraction; derived from comments on MSDN or
46 * on social.microsoft.com
47 */
48#define OSVER(ver) ((ver) & OSVERSION_MASK)
49#define SPVER(ver) (((ver) & SPVERSION_MASK) >> 8)
50#define SUBVER(ver) ((ver) & SUBVERSION_MASK)
51#define WINNTVER(ver) ((ver) >> 16)
52
53/* Macros to construct a minimal NTDDI_VERSION from a _WIN32_WINNT value.
54 */
55#define NTDDI_VERSION_FROM_WIN32_WINNT(ver) _NTDDI_VERSION_FROM_WIN32_WINNT(ver)
56#define _NTDDI_VERSION_FROM_WIN32_WINNT(ver) ver##0000
57
58/* Version constants specifying _WIN32_WINNT versions; these are defined at
59 * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx
60 * (values for legacy platforms have been inferred from historical knowledge).
61 */
62#define _WIN32_WINNT_NT4 0x0400 /* Windows NT4 */
63#define _WIN32_WINNT_NT4E 0x0401 /* Windows NT4E */
64#define _WIN32_WINDOWS_95 0x0400 /* Windows 95 */
65#define _WIN32_WINDOWS_98 0x0410 /* Windows 98 */
66#define _WIN32_WINDOWS_ME 0x0490 /* Windows Millenium Edition */
67#define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
68#define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
69#define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
70#define _WIN32_WINNT_WIN6 0x0600 /* Alias for Windows Vista */
71#define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
72#define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
73#define _WIN32_WINNT_LONGHORN 0x0600 /* Alias for Windows Vista */
74#define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
75#define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
76#define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
77
78/* Version constants specifying Internet Explorer versions; also defined at
79 * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx
80 */
81#define _WIN32_IE_IE50 0x0500
82#define _WIN32_IE_IE501 0x0501
83#define _WIN32_IE_IE55 0x0550
84#define _WIN32_IE_IE56 0x0560
85#define _WIN32_IE_IE60 0x0600
86#define _WIN32_IE_IE60SP1 0x0601
87#define _WIN32_IE_IE60SP2 0x0603
88#define _WIN32_IE_IE70 0x0700
89#define _WIN32_IE_IE80 0x0800
90
91#define _WIN32_IE_IE30 0x0300
92#define _WIN32_IE_IE301 0x0301
93#define _WIN32_IE_IE302 0x0302
94#define _WIN32_IE_IE40 0x0400
95#define _WIN32_IE_IE401 0x0401
96
97/* Version constants specifying NTDDI_VERSION; these are also defined at
98 * http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx
99 */
100#define __NTDDI_WIN5 0x05000000
101#define __NTDDI_WIN51 0x05010000
102#define __NTDDI_WIN52 0x05020000
103#define __NTDDI_WIN6 0x06000000
104#define __NTDDI_WIN61 0x06010000
105#define __NTDDI_WIN62 0x06020000
106#define __NTDDI_WIN63 0x06030000
107#define __NTDDI_SP0 0x00000000
108#define __NTDDI_SP1 0x00000100
109#define __NTDDI_SP2 0x00000200
110#define __NTDDI_SP3 0x00000300
111#define __NTDDI_SP4 0x00000400
112
113#define NTDDI_WIN2K __NTDDI_WIN5 + __NTDDI_SP0
114#define NTDDI_WIN2KSP1 __NTDDI_WIN5 + __NTDDI_SP1
115#define NTDDI_WIN2KSP2 __NTDDI_WIN5 + __NTDDI_SP2
116#define NTDDI_WIN2KSP3 __NTDDI_WIN5 + __NTDDI_SP3
117#define NTDDI_WIN2KSP4 __NTDDI_WIN5 + __NTDDI_SP4
118
119#define NTDDI_WINXP __NTDDI_WIN51 + __NTDDI_SP0
120#define NTDDI_WINXPSP1 __NTDDI_WIN51 + __NTDDI_SP1
121#define NTDDI_WINXPSP2 __NTDDI_WIN51 + __NTDDI_SP2
122#define NTDDI_WINXPSP3 __NTDDI_WIN51 + __NTDDI_SP3
123
124#define NTDDI_WS03 __NTDDI_WIN52 + __NTDDI_SP0
125#define NTDDI_WS03SP1 __NTDDI_WIN52 + __NTDDI_SP1
126#define NTDDI_WS03SP2 __NTDDI_WIN52 + __NTDDI_SP2
127
128#define NTDDI_VISTA __NTDDI_WIN6 + __NTDDI_SP0
129#define NTDDI_VISTASP1 __NTDDI_WIN6 + __NTDDI_SP1
130#define NTDDI_VISTASP2 __NTDDI_WIN6 + __NTDDI_SP2
131
132#define NTDDI_LONGHORN NTDDI_VISTA
133
134#define NTDDI_WIN6 NTDDI_VISTA
135#define NTDDI_WIN6SP1 NTDDI_VISTASP1
136#define NTDDI_WIN6SP2 NTDDI_VISTASP2
137
138#define NTDDI_WS08 __NTDDI_WIN6 + __NTDDI_SP1
139
140#define NTDDI_WIN7 __NTDDI_WIN61 + __NTDDI_SP0
141
142#define NTDDI_WIN8 __NTDDI_WIN62 + __NTDDI_SP0
143
144#define NTDDI_WINBLUE __NTDDI_WIN63 + __NTDDI_SP0
145
146/* Although NTDDI_VERSION is now the preferred designator for the
147 * level of support required from the operating system, legacy code
148 * is likely to have specified WINVER, from which _WIN32_WINNT may
149 * be inferred.
150 */
151#if defined WINVER && ! defined _WIN32_WINNT
152# define _WIN32_WINNT WINVER
153
154/* Additionally, legacy code intended for deployment on the Win9x
155 * series operating systems may have specified _WIN32_WINDOWS, as
156 * an alternative to, or in addition to, _WIN32_WINNT.
157 */
158#elif defined _WIN32_WINDOWS && ! defined _WIN32_WINNT
159# define _WIN32_WINNT _WIN32_WINDOWS
160#endif
161
162/* Stipulate defaults; check consistency of any user specified overrides.
163 */
164#ifdef NTDDI_VERSION
165# ifdef _WIN32_WINNT
166# if _WIN32_WINNT != WINNTVER(NTDDI_VERSION)
167# error "_WIN32_WINNT setting conflicts with specified NTDDI_VERSION"
168# endif
169# else
170# define _WIN32_WINNT WINNTVER(NTDDI_VERSION)
171# ifndef WINVER
172# define WINVER _WIN32_WINNT
173# endif
174# endif
175#endif
176
177#ifndef _WIN32_WINNT
178# ifdef WINVER
179# define _WIN32_WINNT WINVER
180# else
181# ifdef _WARN_DEFAULTS
182# warning "Assuming default setting of _WIN32_WINNT_WIN2K for _WIN32_WINNT"
183# endif
184# define _WIN32_WINNT _WIN32_WINNT_WIN2K
185# endif
186#endif
187
188#ifndef WINVER
189# define WINVER _WIN32_WINNT
190#elif WINVER != _WIN32_WINNT
191 /* TODO(REVIEW): is this appropriate for WINVER consistency checking?
192 */
193# error "_WIN32_WINNT setting conflicts with specified WINVER"
194#endif
195
196#ifndef NTDDI_VERSION
197# ifdef _WARN_DEFAULTS
198# warning "Assuming default NTDDI_VERSION setting to match _WIN32_WINNT"
199# endif
200# define NTDDI_VERSION NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT)
201#endif
202
203/* Map GCC architecture identification macros to their MSVC equivalents.
204 * This mapping was previously specified in <winnt.h>, and duplicated in
205 * <windows.h>; it is now only defined here, because both <windows.h> and
206 * <winnt.h> must include this file anyway, and the potentially error prone
207 * burden of maintaining duplicates is as unnecessary as it is undesirable.
208 */
209#ifndef _M_IX86
210 /* Note that we must process the _M_IX86 equivalent macros in diminishing
211 * order of processor version, since GCC defines __i386__ as identification
212 * for the X86 processor family, in addition to any one of the other three
213 * macros, which may be used to identify a particular processor version.
214 */
215# if defined(__i686__)
216# define _M_IX86 600
217
218# elif defined(__i586__)
219# define _M_IX86 500
220
221# elif defined(__i486__)
222# define _M_IX86 400
223
224# elif defined(__i386__)
225# define _M_IX86 300
226# endif
227#endif
228
229/* The preceding logic may have established the host type as X86, or it
230 * may have done nothing at all; we must check further.
231 */
232#ifdef _M_IX86
233 /* We've established that we ARE compiling for an X86 host; any MinGW32
234 * compiler SHOULD have set this for us already...
235 */
236# ifndef _X86_
237 /* ...but cross-check it anyway, in case the user may have some unusual
238 * compiler configuration in place.
239 */
240# define _X86_ 1
241# endif
242
243# ifndef _M_IX86_FP
244 /* MSVC defines this, to provide additional information about particular
245 * capabilties of the X86 host environment; specifically...
246 */
247# ifdef __SSE2__
248 /* ...this indicates that the SSE2 instruction set (or better) may be
249 * assumed to be supported...
250 */
251# define _M_IX86_FP 2
252
253# elif defined(__SSE__)
254 /* ...whereas, this promises only basic SSE instruction set support...
255 */
256# define _M_IX86_FP 1
257
258# else
259 /* ...and this disallows its use, entirely.
260 */
261# define _M_IX86_FP 0
262# endif
263# endif
264
265/* When not compiling for an X86 host; check mapping from other possible
266 * GCC architecture identifiers, to their MSVC equivalents.
267 */
268#elif defined(__x86_64__) || defined(__amd64__)
269 /* This represents an Intel X86-64, or (compatible) AMD-64 processor;
270 * MSVC defines...
271 */
272# ifndef _M_X64
273 /* ...this to represent the former, together with...
274 */
275# define _M_X64 1
276# endif
277# ifndef _M_AMD64
278 /* ...this alias, to represent the latter.
279 */
280# define _M_AMD64 1
281# endif
282
283#elif defined(__ia64__)
284 /* This represents an Intel Itanium processor, which MSVC designates
285 * by defining this feature test macro.
286 */
287# ifndef _M_IA64
288# define _M_IA64 1
289# endif
290#endif /* !_M_IX86 */
291
292#endif /* _SDKDDKVER_H: $RCSfile: sdkddkver.h,v $: end of file */
Note: See TracBrowser for help on using the repository browser.