3 * Copyright 2012, 2013 MinGW.org project
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
26 #pragma GCC system_header
36 * If you need Win32 API features newer the Win95 and WinNT then you must
37 * define WINVER before including windows.h or any other method of including
38 * the windef.h header.
43 #define _WIN32_WINNT WINVER
45 * There may be the need to define _WIN32_WINNT to a value different from
46 * the value of WINVER. I don't have any example of why you would do that.
47 * However, if you must then define _WIN32_WINNT to the value required before
48 * including windows.h or any other method of including the windef.h header.
69 #define NULL ((void*)0)
82 /* Pseudo modifiers for parameters
83 We don't use these unnecessary defines in the w32api headers. Define
84 them by default since that is what people expect, but allow users
85 to avoid the pollution. */
86 #ifndef _NO_W32_PSEUDO_MODIFIERS
97 #define _declspec(e) __declspec(e)
103 #define pascal __stdcall
104 #define _pascal __stdcall
105 #define __pascal __stdcall
106 #define PASCAL _pascal
108 #define STDCALL __stdcall
109 #define FASTCALL __fastcall
110 #define WINAPI __stdcall
111 #define WINAPIV __cdecl
112 #define APIENTRY __stdcall
113 #define CALLBACK __stdcall
114 #define APIPRIVATE __stdcall
116 #define DECLSPEC_IMPORT __declspec(dllimport)
117 #define DECLSPEC_EXPORT __declspec(dllexport)
118 #define DECLSPEC_NORETURN __declspec(noreturn)
119 #define DECLARE_STDCALL_P( type ) __stdcall type
121 #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
122 #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
123 #define LOWORD(l) ((WORD)((DWORD)(l)))
124 #define HIWORD(l) ((WORD)(((DWORD)(l)>>16)&0xFFFF))
125 #define LOBYTE(w) ((BYTE)(w))
126 #define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF))
139 #define max(a,b) ((a)>(b)?(a):(b))
143 #define min(a,b) ((a)<(b)?(a):(b))
148 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
149 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
150 #define DBG_UNREFERENCED_PARAMETER(P)
151 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
153 #ifndef NONAMELESSUNION
154 #define _ANONYMOUS_UNION __extension__
155 #define _ANONYMOUS_STRUCT __extension__
156 #endif /* NONAMELESSUNION */
158 #ifndef _ANONYMOUS_UNION
159 #define _ANONYMOUS_UNION
160 #define _UNION_NAME(x) x
161 #define DUMMYUNIONNAME u
162 #define DUMMYUNIONNAME2 u2
163 #define DUMMYUNIONNAME3 u3
164 #define DUMMYUNIONNAME4 u4
165 #define DUMMYUNIONNAME5 u5
166 #define DUMMYUNIONNAME6 u6
167 #define DUMMYUNIONNAME7 u7
168 #define DUMMYUNIONNAME8 u8
171 #define _UNION_NAME(x)
172 #define DUMMYUNIONNAME
173 #define DUMMYUNIONNAME2
174 #define DUMMYUNIONNAME3
175 #define DUMMYUNIONNAME4
176 #define DUMMYUNIONNAME5
177 #define DUMMYUNIONNAME6
178 #define DUMMYUNIONNAME7
179 #define DUMMYUNIONNAME8
182 #ifndef _ANONYMOUS_STRUCT
183 #define _ANONYMOUS_STRUCT
184 #define _STRUCT_NAME(x) x
185 #define DUMMYSTRUCTNAME s
186 #define DUMMYSTRUCTNAME2 s2
187 #define DUMMYSTRUCTNAME3 s3
190 #define _STRUCT_NAME(x)
191 #define DUMMYSTRUCTNAME
192 #define DUMMYSTRUCTNAME2
193 #define DUMMYSTRUCTNAME3
204 /* FIXME: This will make some code compile. The programs will most
205 likely crash when an exception is raised, but at least they will
207 #if defined (__SEH_NOOP)
209 #define __except(x) if (0) /* don't execute handler */
213 #define _except __except
214 #define _finally __finally
217 typedef unsigned long DWORD;
218 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
219 /* FIXME: Is there a good solution to this? */
221 typedef WINBOOL BOOL;
225 typedef unsigned char BYTE;
226 typedef BOOL *PBOOL,*LPBOOL;
227 typedef unsigned short WORD;
229 typedef FLOAT *PFLOAT;
230 typedef BYTE *PBYTE,*LPBYTE;
231 typedef int *PINT,*LPINT;
232 typedef WORD *PWORD,*LPWORD;
233 typedef long *LPLONG;
234 typedef DWORD *PDWORD,*LPDWORD;
235 typedef CONST void *PCVOID,*LPCVOID;
237 typedef unsigned int UINT,*PUINT,*LPUINT;
241 typedef UINT_PTR WPARAM;
242 typedef LONG_PTR LPARAM;
243 typedef LONG_PTR LRESULT;
245 #ifndef _HRESULT_DEFINED
246 typedef LONG HRESULT;
247 #define _HRESULT_DEFINED
251 typedef HANDLE HHOOK;
252 typedef HANDLE HGLOBAL;
253 typedef HANDLE HLOCAL;
254 typedef HANDLE GLOBALHANDLE;
255 typedef HANDLE LOCALHANDLE;
256 typedef void *HGDIOBJ;
257 DECLARE_HANDLE(HACCEL);
258 DECLARE_HANDLE(HBITMAP);
259 DECLARE_HANDLE(HBRUSH);
260 DECLARE_HANDLE(HCOLORSPACE);
262 DECLARE_HANDLE(HGLRC);
263 DECLARE_HANDLE(HDESK);
264 DECLARE_HANDLE(HENHMETAFILE);
265 DECLARE_HANDLE(HFONT);
266 DECLARE_HANDLE(HICON);
267 DECLARE_HANDLE(HKEY);
268 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
269 DECLARE_HANDLE(HMONITOR);
270 #define HMONITOR_DECLARED 1
271 DECLARE_HANDLE(HTERMINAL);
272 DECLARE_HANDLE(HWINEVENTHOOK);
275 DECLARE_HANDLE(HMENU);
276 DECLARE_HANDLE(HMETAFILE);
277 DECLARE_HANDLE(HINSTANCE);
278 typedef HINSTANCE HMODULE;
279 DECLARE_HANDLE(HPALETTE);
280 DECLARE_HANDLE(HPEN);
281 DECLARE_HANDLE(HRGN);
282 DECLARE_HANDLE(HRSRC);
283 DECLARE_HANDLE(HSTR);
284 DECLARE_HANDLE(HTASK);
285 DECLARE_HANDLE(HWND);
286 DECLARE_HANDLE(HWINSTA);
289 typedef HICON HCURSOR;
290 typedef DWORD COLORREF;
291 typedef int (WINAPI *FARPROC)();
292 typedef int (WINAPI *NEARPROC)();
293 typedef int (WINAPI *PROC)();
294 typedef struct tagRECT {
299 } RECT,*PRECT,*LPRECT;
300 typedef const RECT *LPCRECT;
301 typedef struct tagRECTL {
306 } RECTL,*PRECTL,*LPRECTL;
307 typedef const RECTL *LPCRECTL;
308 typedef struct tagPOINT {
311 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
312 typedef struct tagSIZE {
315 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
316 typedef struct tagPOINTS {
319 } POINTS,*PPOINTS,*LPPOINTS;