3 * @copy 2012 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
35 * If you need Win32 API features newer the Win95 and WinNT then you must
36 * define WINVER before including windows.h or any other method of including
37 * the windef.h header.
41 #define _WIN32_WINNT WINVER
43 * There may be the need to define _WIN32_WINNT to a value different from
44 * the value of WINVER. I don't have any example of why you would do that.
45 * However, if you must then define _WIN32_WINNT to the value required before
46 * including windows.h or any other method of including the windef.h header.
63 #define NULL ((void*)0)
73 /* Pseudo modifiers for parameters
74 We don't use these unnecessary defines in the w32api headers. Define
75 them by default since that is what people expect, but allow users
76 to avoid the pollution. */
77 #ifndef _NO_W32_PSEUDO_MODIFIERS
86 #define _declspec(e) __declspec(e)
92 #define pascal __stdcall
93 #define _pascal __stdcall
94 #define __pascal __stdcall
95 #define PASCAL _pascal
97 #define STDCALL __stdcall
98 #define FASTCALL __fastcall
99 #define WINAPI __stdcall
100 #define WINAPIV __cdecl
101 #define APIENTRY __stdcall
102 #define CALLBACK __stdcall
103 #define APIPRIVATE __stdcall
105 #define DECLSPEC_IMPORT __declspec(dllimport)
106 #define DECLSPEC_EXPORT __declspec(dllexport)
107 #define DECLSPEC_NORETURN __declspec(noreturn)
108 #define DECLARE_STDCALL_P( type ) __stdcall type
110 #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
111 #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
112 #define LOWORD(l) ((WORD)((DWORD)(l)))
113 #define HIWORD(l) ((WORD)(((DWORD)(l)>>16)&0xFFFF))
114 #define LOBYTE(w) ((BYTE)(w))
115 #define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF))
126 #define max(a,b) ((a)>(b)?(a):(b))
129 #define min(a,b) ((a)<(b)?(a):(b))
133 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
134 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
135 #define DBG_UNREFERENCED_PARAMETER(P)
136 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
138 #ifndef NONAMELESSUNION
139 #define _ANONYMOUS_UNION __extension__
140 #define _ANONYMOUS_STRUCT __extension__
141 #endif /* NONAMELESSUNION */
143 #ifndef _ANONYMOUS_UNION
144 #define _ANONYMOUS_UNION
145 #define _UNION_NAME(x) x
146 #define DUMMYUNIONNAME u
147 #define DUMMYUNIONNAME2 u2
148 #define DUMMYUNIONNAME3 u3
149 #define DUMMYUNIONNAME4 u4
150 #define DUMMYUNIONNAME5 u5
151 #define DUMMYUNIONNAME6 u6
152 #define DUMMYUNIONNAME7 u7
153 #define DUMMYUNIONNAME8 u8
155 #define _UNION_NAME(x)
156 #define DUMMYUNIONNAME
157 #define DUMMYUNIONNAME2
158 #define DUMMYUNIONNAME3
159 #define DUMMYUNIONNAME4
160 #define DUMMYUNIONNAME5
161 #define DUMMYUNIONNAME6
162 #define DUMMYUNIONNAME7
163 #define DUMMYUNIONNAME8
165 #ifndef _ANONYMOUS_STRUCT
166 #define _ANONYMOUS_STRUCT
167 #define _STRUCT_NAME(x) x
168 #define DUMMYSTRUCTNAME s
169 #define DUMMYSTRUCTNAME2 s2
170 #define DUMMYSTRUCTNAME3 s3
172 #define _STRUCT_NAME(x)
173 #define DUMMYSTRUCTNAME
174 #define DUMMYSTRUCTNAME2
175 #define DUMMYSTRUCTNAME3
184 /* FIXME: This will make some code compile. The programs will most
185 likely crash when an exception is raised, but at least they will
187 #if defined (__SEH_NOOP)
189 #define __except(x) if (0) /* don't execute handler */
193 #define _except __except
194 #define _finally __finally
197 typedef unsigned long DWORD;
198 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
199 /* FIXME: Is there a good solution to this? */
201 typedef WINBOOL BOOL;
205 typedef unsigned char BYTE;
206 typedef BOOL *PBOOL,*LPBOOL;
207 typedef unsigned short WORD;
209 typedef FLOAT *PFLOAT;
210 typedef BYTE *PBYTE,*LPBYTE;
211 typedef int *PINT,*LPINT;
212 typedef WORD *PWORD,*LPWORD;
213 typedef long *LPLONG;
214 typedef DWORD *PDWORD,*LPDWORD;
215 typedef CONST void *PCVOID,*LPCVOID;
217 typedef unsigned int UINT,*PUINT,*LPUINT;
221 typedef UINT_PTR WPARAM;
222 typedef LONG_PTR LPARAM;
223 typedef LONG_PTR LRESULT;
224 #ifndef _HRESULT_DEFINED
225 typedef LONG HRESULT;
226 #define _HRESULT_DEFINED
229 typedef HANDLE HHOOK;
230 typedef HANDLE HGLOBAL;
231 typedef HANDLE HLOCAL;
232 typedef HANDLE GLOBALHANDLE;
233 typedef HANDLE LOCALHANDLE;
234 typedef void *HGDIOBJ;
235 DECLARE_HANDLE(HACCEL);
236 DECLARE_HANDLE(HBITMAP);
237 DECLARE_HANDLE(HBRUSH);
238 DECLARE_HANDLE(HCOLORSPACE);
240 DECLARE_HANDLE(HGLRC);
241 DECLARE_HANDLE(HDESK);
242 DECLARE_HANDLE(HENHMETAFILE);
243 DECLARE_HANDLE(HFONT);
244 DECLARE_HANDLE(HICON);
245 DECLARE_HANDLE(HKEY);
246 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
247 DECLARE_HANDLE(HMONITOR);
248 #define HMONITOR_DECLARED 1
249 DECLARE_HANDLE(HTERMINAL);
250 DECLARE_HANDLE(HWINEVENTHOOK);
253 DECLARE_HANDLE(HMENU);
254 DECLARE_HANDLE(HMETAFILE);
255 DECLARE_HANDLE(HINSTANCE);
256 typedef HINSTANCE HMODULE;
257 DECLARE_HANDLE(HPALETTE);
258 DECLARE_HANDLE(HPEN);
259 DECLARE_HANDLE(HRGN);
260 DECLARE_HANDLE(HRSRC);
261 DECLARE_HANDLE(HSTR);
262 DECLARE_HANDLE(HTASK);
263 DECLARE_HANDLE(HWND);
264 DECLARE_HANDLE(HWINSTA);
267 typedef HICON HCURSOR;
268 typedef DWORD COLORREF;
269 typedef int (WINAPI *FARPROC)();
270 typedef int (WINAPI *NEARPROC)();
271 typedef int (WINAPI *PROC)();
272 typedef struct tagRECT {
277 } RECT,*PRECT,*LPRECT;
278 typedef const RECT *LPCRECT;
279 typedef struct tagRECTL {
284 } RECTL,*PRECTL,*LPRECTL;
285 typedef const RECTL *LPCRECTL;
286 typedef struct tagPOINT {
289 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
290 typedef struct tagSIZE {
293 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
294 typedef struct tagPOINTS {
297 } POINTS,*PPOINTS,*LPPOINTS;