4 * Common definitions for the Win32 API.
8 * Written by Anders Norlander <anorland@hem2.passagen.se>
9 * Copyright (C) 1998-2002, 2006-2008, 2010, 2015, MinGW.org Project
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
19 * The above copyright notice and this permission notice (including the next
20 * paragraph) shall be included in all copies or substantial portions of the
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
34 #pragma GCC system_header
36 /* We used to provide preprocessor code here, to ensure that WINVER
37 * and _WIN32_WINNT are defined; this is now handled by inclusion of
38 * w32api.h, which in turn includes sdkddkver.h, so implementing the
39 * preferred technique of deriving these from a user assigned, (or
40 * default), NTDDI_VERSION setting.
66 #define NULL ((void*)0)
76 #ifndef _NO_W32_PSEUDO_MODIFIERS
77 /* Pseudo-modifiers support function argument classification:
78 * we don't use these unnecessary defines in the w32api headers,
79 * but define them by default, since that is what people expect;
80 * this is conditional, so that users may avoid the pollution.
91 #define _fastcall __attribute__((fastcall))
94 #define __fastcall __attribute__((fastcall))
97 #define _stdcall __attribute__((stdcall))
100 #define __stdcall __attribute__((stdcall))
103 #define _cdecl __attribute__((cdecl))
106 #define __cdecl __attribute__((cdecl))
109 #define __declspec(e) __attribute__((e))
112 #define _declspec(e) __attribute__((e))
122 #define pascal __stdcall
123 #define _pascal __stdcall
124 #define __pascal __stdcall
125 #define PASCAL _pascal
127 #define STDCALL __stdcall
128 #define FASTCALL __fastcall
129 #define WINAPI __stdcall
130 #define WINAPIV __cdecl
131 #define APIENTRY __stdcall
132 #define CALLBACK __stdcall
133 #define APIPRIVATE __stdcall
135 #define DECLSPEC_IMPORT __declspec(dllimport)
136 #define DECLSPEC_EXPORT __declspec(dllexport)
138 #define DECLSPEC_NORETURN __declspec(noreturn)
139 #define DECLARE_STDCALL_P( type ) __stdcall type
140 #elif defined(__WATCOMC__)
141 #define DECLSPEC_NORETURN
142 #define DECLARE_STDCALL_P( type ) type __stdcall
143 #endif /* __GNUC__/__WATCOMC__ */
144 #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
145 #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
146 #define LOWORD(l) ((WORD)((DWORD)(l)))
147 #define HIWORD(l) ((WORD)(((DWORD)(l)>>16)&0xFFFF))
148 #define LOBYTE(w) ((BYTE)(w))
149 #define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF))
162 #define max(a,b) ((a)>(b)?(a):(b))
165 #define min(a,b) ((a)<(b)?(a):(b))
169 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
170 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
171 #define DBG_UNREFERENCED_PARAMETER(P)
172 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
174 #ifndef NONAMELESSUNION
176 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
177 #define _ANONYMOUS_UNION __extension__
178 #define _ANONYMOUS_STRUCT __extension__
180 #if defined(__cplusplus)
181 #define _ANONYMOUS_UNION __extension__
182 #endif /* __cplusplus */
183 #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
184 #elif defined(__WATCOMC__)
185 #define _ANONYMOUS_UNION
186 #define _ANONYMOUS_STRUCT
187 #endif /* __GNUC__/__WATCOMC__ */
188 #endif /* NONAMELESSUNION */
190 #ifndef _ANONYMOUS_UNION
191 #define _ANONYMOUS_UNION
192 #define _UNION_NAME(x) x
193 #define DUMMYUNIONNAME u
194 #define DUMMYUNIONNAME2 u2
195 #define DUMMYUNIONNAME3 u3
196 #define DUMMYUNIONNAME4 u4
197 #define DUMMYUNIONNAME5 u5
198 #define DUMMYUNIONNAME6 u6
199 #define DUMMYUNIONNAME7 u7
200 #define DUMMYUNIONNAME8 u8
202 #define _UNION_NAME(x)
203 #define DUMMYUNIONNAME
204 #define DUMMYUNIONNAME2
205 #define DUMMYUNIONNAME3
206 #define DUMMYUNIONNAME4
207 #define DUMMYUNIONNAME5
208 #define DUMMYUNIONNAME6
209 #define DUMMYUNIONNAME7
210 #define DUMMYUNIONNAME8
212 #ifndef _ANONYMOUS_STRUCT
213 #define _ANONYMOUS_STRUCT
214 #define _STRUCT_NAME(x) x
215 #define DUMMYSTRUCTNAME s
216 #define DUMMYSTRUCTNAME2 s2
217 #define DUMMYSTRUCTNAME3 s3
219 #define _STRUCT_NAME(x)
220 #define DUMMYSTRUCTNAME
221 #define DUMMYSTRUCTNAME2
222 #define DUMMYSTRUCTNAME3
231 #if defined (__GNUC__) && defined (__SEH_NOOP)
232 /* FIXME: This will make some code compile. The programs will most
233 * likely crash when an exception is raised, but at least they will
237 # define __except(x) if (0) /* don't execute handler */
241 # define _except __except
242 # define _finally __finally
245 typedef unsigned long DWORD;
246 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
247 /* FIXME: Is there a good solution to this? */
248 #ifndef XFree86Server
250 typedef WINBOOL BOOL;
254 typedef unsigned char BYTE;
255 #endif /* ndef XFree86Server */
256 typedef BOOL *PBOOL,*LPBOOL;
257 typedef unsigned short WORD;
259 typedef FLOAT *PFLOAT;
260 typedef BYTE *PBYTE,*LPBYTE;
261 typedef int *PINT,*LPINT;
262 typedef WORD *PWORD,*LPWORD;
263 typedef long *LPLONG;
264 typedef DWORD *PDWORD,*LPDWORD;
265 typedef CONST void *PCVOID,*LPCVOID;
267 typedef unsigned int UINT,*PUINT,*LPUINT;
271 typedef UINT_PTR WPARAM;
272 typedef LONG_PTR LPARAM;
273 typedef LONG_PTR LRESULT;
274 #ifndef _HRESULT_DEFINED
275 typedef LONG HRESULT;
276 #define _HRESULT_DEFINED
278 #ifndef XFree86Server
280 #endif /* XFree86Server */
281 typedef HANDLE HHOOK;
282 typedef HANDLE HGLOBAL;
283 typedef HANDLE HLOCAL;
284 typedef HANDLE GLOBALHANDLE;
285 typedef HANDLE LOCALHANDLE;
286 typedef void *HGDIOBJ;
287 DECLARE_HANDLE(HACCEL);
288 DECLARE_HANDLE(HBITMAP);
289 DECLARE_HANDLE(HBRUSH);
290 DECLARE_HANDLE(HCOLORSPACE);
292 DECLARE_HANDLE(HGLRC);
293 DECLARE_HANDLE(HDESK);
294 DECLARE_HANDLE(HENHMETAFILE);
295 DECLARE_HANDLE(HFONT);
296 DECLARE_HANDLE(HICON);
297 DECLARE_HANDLE(HKEY);
298 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
299 DECLARE_HANDLE(HMONITOR);
300 #define HMONITOR_DECLARED 1
301 DECLARE_HANDLE(HTERMINAL);
302 DECLARE_HANDLE(HWINEVENTHOOK);
305 DECLARE_HANDLE(HMENU);
306 DECLARE_HANDLE(HMETAFILE);
307 DECLARE_HANDLE(HINSTANCE);
308 typedef HINSTANCE HMODULE;
309 DECLARE_HANDLE(HPALETTE);
310 DECLARE_HANDLE(HPEN);
311 DECLARE_HANDLE(HRGN);
312 DECLARE_HANDLE(HRSRC);
313 DECLARE_HANDLE(HSTR);
314 DECLARE_HANDLE(HTASK);
315 DECLARE_HANDLE(HWND);
316 DECLARE_HANDLE(HWINSTA);
319 typedef HICON HCURSOR;
320 typedef DWORD COLORREF;
321 typedef int (WINAPI *FARPROC)();
322 typedef int (WINAPI *NEARPROC)();
323 typedef int (WINAPI *PROC)();
324 typedef struct tagRECT {
329 } RECT,*PRECT,*LPRECT;
330 typedef const RECT *LPCRECT;
331 typedef struct tagRECTL {
336 } RECTL,*PRECTL,*LPRECTL;
337 typedef const RECTL *LPCRECTL;
338 typedef struct tagPOINT {
341 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
342 typedef struct tagSIZE {
345 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
346 typedef struct tagPOINTS {
349 } POINTS,*PPOINTS,*LPPOINTS;
353 #endif /* _WINDEF_H: $RCSfile$: end of file */