widl: Parse attribute custom(guid,expr).
[wine.git] / include / windef.h
blobdb5c60641d42f1a86e938f0fd1729b3b4f12cce5
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef _WINDEF_
22 #define _WINDEF_
24 #ifndef WINVER
25 #define WINVER 0x0500
26 #endif
28 #ifndef NO_STRICT
29 # ifndef STRICT
30 # define STRICT
31 # endif /* STRICT */
32 #endif /* NO_STRICT */
34 #ifndef __has_attribute
35 #define __has_attribute(x) 0
36 #endif
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
42 /* Calling conventions definitions */
44 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
45 #define _WIN64
46 #endif
48 #ifndef _WIN64
49 # if defined(__i386__) && !defined(_X86_)
50 # define _X86_
51 # endif
52 # if defined(_X86_) && !defined(__i386__)
53 # define __i386__
54 # endif
55 #endif
57 #if !defined(_MSC_VER) && !defined(__stdcall)
58 # ifdef __i386__
59 # ifdef __GNUC__
60 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
61 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
62 # else
63 # define __stdcall __attribute__((__stdcall__))
64 # endif
65 # else
66 # error You need to define __stdcall for your compiler
67 # endif
68 # elif defined(__x86_64__) && defined (__GNUC__)
69 # if __has_attribute(__force_align_arg_pointer__)
70 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
71 # else
72 # define __stdcall __attribute__((ms_abi))
73 # endif
74 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
75 # define __stdcall __attribute__((pcs("aapcs-vfp")))
76 # elif defined(__aarch64__) && defined (__GNUC__)
77 # define __stdcall __attribute__((ms_abi))
78 # else /* __i386__ */
79 # define __stdcall
80 # endif /* __i386__ */
81 #endif /* __stdcall */
83 #if !defined(_MSC_VER) && !defined(__cdecl)
84 # if defined(__i386__) && defined(__GNUC__)
85 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
86 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
87 # else
88 # define __cdecl __attribute__((__cdecl__))
89 # endif
90 # elif defined(__x86_64__) && defined (__GNUC__)
91 # if __has_attribute(__force_align_arg_pointer__)
92 # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
93 # else
94 # define __cdecl __attribute__((ms_abi))
95 # endif
96 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
97 # define __cdecl __attribute__((pcs("aapcs-vfp")))
98 # elif defined(__aarch64__) && defined (__GNUC__)
99 # define __cdecl __attribute__((ms_abi))
100 # else
101 # define __cdecl
102 # endif
103 #endif /* __cdecl */
105 #if !defined(_MSC_VER) && !defined(__fastcall)
106 # define __fastcall __stdcall
107 #endif
109 #if (!defined(_MSC_VER) || !defined(__clang__)) && !defined(__thiscall)
110 # define __thiscall __stdcall
111 #endif
113 #ifndef __ms_va_list
114 # if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__)
115 # define __ms_va_list __builtin_ms_va_list
116 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
117 # define __ms_va_end(list) __builtin_ms_va_end(list)
118 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
119 # else
120 # define __ms_va_list va_list
121 # define __ms_va_start(list,arg) va_start(list,arg)
122 # define __ms_va_end(list) va_end(list)
123 # ifdef va_copy
124 # define __ms_va_copy(dest,src) va_copy(dest,src)
125 # else
126 # define __ms_va_copy(dest,src) ((dest) = (src))
127 # endif
128 # endif
129 #endif
131 #if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
132 # define WINAPIV __attribute__((pcs("aapcs")))
133 #else
134 # define WINAPIV __cdecl
135 #endif
137 #ifdef __WINESRC__
138 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
139 #else
140 #define __ONLY_IN_WINELIB(x) x
141 #endif
143 #ifndef _MSC_VER
144 #ifndef _stdcall
145 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
146 #endif
147 #ifndef _fastcall
148 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
149 #endif
150 #ifndef __fastcall
151 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
152 #endif
153 #ifndef cdecl
154 #define cdecl __ONLY_IN_WINELIB(__cdecl)
155 #endif
156 #ifndef _cdecl
157 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
158 #endif
159 #endif /* _MSC_VER */
161 #ifndef pascal
162 #define pascal __ONLY_IN_WINELIB(__stdcall)
163 #endif
164 #ifndef _pascal
165 #define _pascal __ONLY_IN_WINELIB(__stdcall)
166 #endif
167 #ifndef __export
168 #define __export __ONLY_IN_WINELIB(__stdcall)
169 #endif
170 #ifndef near
171 #define near __ONLY_IN_WINELIB(/* nothing */)
172 #endif
173 #ifndef far
174 #define far __ONLY_IN_WINELIB(/* nothing */)
175 #endif
176 #ifndef _near
177 #define _near __ONLY_IN_WINELIB(/* nothing */)
178 #endif
179 #ifndef _far
180 #define _far __ONLY_IN_WINELIB(/* nothing */)
181 #endif
182 #ifndef NEAR
183 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
184 #endif
185 #ifndef FAR
186 #define FAR __ONLY_IN_WINELIB(/* nothing */)
187 #endif
189 #ifndef _MSC_VER
190 # ifndef _declspec
191 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
192 # endif
193 # ifndef __declspec
194 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
195 # endif
196 #endif
198 #ifdef _MSC_VER
199 # define inline __inline
200 #endif
202 #define CALLBACK __stdcall
203 #define WINAPI __stdcall
204 #define APIPRIVATE __stdcall
205 #define PASCAL __stdcall
206 #define CDECL __cdecl
207 #define _CDECL __cdecl
208 #define APIENTRY WINAPI
209 #define CONST __ONLY_IN_WINELIB(const)
211 /* Misc. constants. */
213 #undef NULL
214 #ifdef __cplusplus
215 #define NULL 0
216 #else
217 #define NULL ((void*)0)
218 #endif
220 #ifdef FALSE
221 #undef FALSE
222 #endif
223 #define FALSE 0
225 #ifdef TRUE
226 #undef TRUE
227 #endif
228 #define TRUE 1
230 #ifndef IN
231 #define IN
232 #endif
234 #ifndef OUT
235 #define OUT
236 #endif
238 #ifndef OPTIONAL
239 #define OPTIONAL
240 #endif
242 /* Standard data types */
244 #ifndef BASETYPES
245 #define BASETYPES
246 typedef unsigned char UCHAR, *PUCHAR;
247 typedef unsigned short USHORT, *PUSHORT;
248 #ifdef WINE_USE_LONG
249 typedef unsigned long ULONG, *PULONG;
250 #else
251 typedef unsigned int ULONG, *PULONG;
252 #endif
253 #endif
255 typedef void *LPVOID;
256 typedef const void *LPCVOID;
257 typedef int BOOL, *PBOOL, *LPBOOL;
258 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
259 typedef unsigned short WORD, *PWORD, *LPWORD;
260 typedef int INT, *PINT, *LPINT;
261 typedef unsigned int UINT, *PUINT;
262 typedef float FLOAT, *PFLOAT;
263 typedef char *PSZ;
264 #ifdef WINE_USE_LONG
265 typedef long *LPLONG;
266 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
267 #else
268 typedef int *LPLONG;
269 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
270 #endif
272 /* Macros to map Winelib names to the correct implementation name */
273 /* Note that Winelib is purely Win32. */
275 #ifdef __WINESRC__
276 #define WINE_NO_UNICODE_MACROS 1
277 #define WINE_STRICT_PROTOTYPES 1
278 #endif
280 #ifdef WINE_NO_UNICODE_MACROS
281 # define WINELIB_NAME_AW(func) \
282 func##_must_be_suffixed_with_W_or_A_in_this_context \
283 func##_must_be_suffixed_with_W_or_A_in_this_context
284 #else /* WINE_NO_UNICODE_MACROS */
285 # ifdef UNICODE
286 # define WINELIB_NAME_AW(func) func##W
287 # else
288 # define WINELIB_NAME_AW(func) func##A
289 # endif
290 #endif /* WINE_NO_UNICODE_MACROS */
292 #ifdef WINE_NO_UNICODE_MACROS
293 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
294 #else
295 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
296 #endif
298 #include <winnt.h>
300 /* Polymorphic types */
302 typedef UINT_PTR WPARAM;
303 typedef LONG_PTR LPARAM;
304 typedef LONG_PTR LRESULT;
306 /* Integer types */
308 typedef WORD ATOM;
309 typedef DWORD COLORREF, *LPCOLORREF;
312 /* Handle types */
314 typedef int HFILE;
315 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
316 DECLARE_HANDLE(HACCEL);
317 DECLARE_HANDLE(HBITMAP);
318 DECLARE_HANDLE(HBRUSH);
319 DECLARE_HANDLE(HCOLORSPACE);
320 DECLARE_HANDLE(HDC);
321 DECLARE_HANDLE(HDESK);
322 DECLARE_HANDLE(HENHMETAFILE);
323 DECLARE_HANDLE(HFONT);
324 DECLARE_HANDLE(HGLRC);
325 DECLARE_HANDLE(HHOOK);
326 DECLARE_HANDLE(HICON);
327 DECLARE_HANDLE(HINSTANCE);
328 DECLARE_HANDLE(HKEY);
329 typedef HKEY *PHKEY;
330 DECLARE_HANDLE(HKL);
331 DECLARE_HANDLE(HMENU);
332 DECLARE_HANDLE(HMETAFILE);
333 DECLARE_HANDLE(HMONITOR);
334 DECLARE_HANDLE(HPALETTE);
335 DECLARE_HANDLE(HPEN);
336 DECLARE_HANDLE(HRGN);
337 DECLARE_HANDLE(HRSRC);
338 DECLARE_HANDLE(HTASK);
339 DECLARE_HANDLE(HWINEVENTHOOK);
340 DECLARE_HANDLE(HWINSTA);
341 DECLARE_HANDLE(HWND);
343 /* Handle types that must remain interchangeable even with strict on */
345 typedef HINSTANCE HMODULE;
346 typedef HANDLE HGDIOBJ;
347 typedef HANDLE HGLOBAL;
348 typedef HANDLE HLOCAL;
349 typedef HANDLE GLOBALHANDLE;
350 typedef HANDLE LOCALHANDLE;
351 typedef HICON HCURSOR;
353 /* Callback function pointers types */
355 #ifdef WINE_STRICT_PROTOTYPES
356 typedef INT_PTR (CALLBACK *FARPROC)(void);
357 typedef INT_PTR (CALLBACK *NEARPROC)(void);
358 typedef INT_PTR (CALLBACK *PROC)(void);
359 #else
360 typedef INT_PTR (CALLBACK *FARPROC)();
361 typedef INT_PTR (CALLBACK *NEARPROC)();
362 typedef INT_PTR (CALLBACK *PROC)();
363 #endif
365 /* Macros to split words and longs. */
367 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
368 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
370 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
371 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
373 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
374 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
376 /* min and max macros */
377 #ifndef NOMINMAX
378 #ifndef max
379 #define max(a,b) (((a) > (b)) ? (a) : (b))
380 #endif
381 #ifndef min
382 #define min(a,b) (((a) < (b)) ? (a) : (b))
383 #endif
384 #endif /* NOMINMAX */
386 #ifdef MAX_PATH /* Work-around for Mingw */
387 #undef MAX_PATH
388 #endif /* MAX_PATH */
390 #define MAX_PATH 260
391 #define HFILE_ERROR ((HFILE)-1)
393 /* The SIZE structure */
394 typedef struct tagSIZE
396 LONG cx;
397 LONG cy;
398 } SIZE, *PSIZE, *LPSIZE;
400 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
402 /* The POINT structure */
403 typedef struct tagPOINT
405 LONG x;
406 LONG y;
407 } POINT, *PPOINT, *LPPOINT;
409 typedef struct _POINTL
411 LONG x;
412 LONG y;
413 } POINTL, *PPOINTL;
415 /* The POINTS structure */
417 typedef struct tagPOINTS
419 #ifdef WORDS_BIGENDIAN
420 SHORT y;
421 SHORT x;
422 #else
423 SHORT x;
424 SHORT y;
425 #endif
426 } POINTS, *PPOINTS, *LPPOINTS;
428 typedef struct _FILETIME {
429 #ifdef WORDS_BIGENDIAN
430 DWORD dwHighDateTime;
431 DWORD dwLowDateTime;
432 #else
433 DWORD dwLowDateTime;
434 DWORD dwHighDateTime;
435 #endif
436 } FILETIME, *PFILETIME, *LPFILETIME;
437 #define _FILETIME_
439 /* The RECT structure */
440 typedef struct tagRECT
442 LONG left;
443 LONG top;
444 LONG right;
445 LONG bottom;
446 } RECT, *PRECT, *LPRECT;
447 typedef const RECT *LPCRECT;
449 typedef struct _RECTL
451 LONG left;
452 LONG top;
453 LONG right;
454 LONG bottom;
455 } RECTL, *PRECTL, *LPRECTL;
457 typedef const RECTL *LPCRECTL;
459 /* DPI awareness */
460 typedef enum DPI_AWARENESS
462 DPI_AWARENESS_INVALID = -1,
463 DPI_AWARENESS_UNAWARE = 0,
464 DPI_AWARENESS_SYSTEM_AWARE,
465 DPI_AWARENESS_PER_MONITOR_AWARE
466 } DPI_AWARENESS;
468 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
469 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
470 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
471 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
472 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
474 #ifdef __cplusplus
476 #endif
478 #endif /* _WINDEF_ */