include: Remove DECLSPEC_HIDDEN from GUID definitions.
[wine.git] / include / windef.h
blobb22e15c4dbfa55f4c47b143785eba734c510ad99
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(__MINGW32__)
59 #undef __stdcall
60 #undef __cdecl
61 #undef __fastcall
62 #undef __thiscall
64 #ifdef WINE_UNIX_LIB
65 # define __stdcall
66 # define __cdecl
67 #elif defined(__GNUC__)
68 # ifdef __i386__
69 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
70 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
71 # else
72 # define __stdcall __attribute__((__stdcall__))
73 # endif
74 # elif defined(__x86_64__)
75 # if __has_attribute(__force_align_arg_pointer__)
76 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
77 # else
78 # define __stdcall __attribute__((ms_abi))
79 # endif
80 # define __ms_va_list __builtin_ms_va_list
81 # elif defined(__arm__) && !defined(__SOFTFP__) && !defined(__CYGWIN__)
82 # define __stdcall __attribute__((pcs("aapcs-vfp")))
83 # define WINAPIV __attribute__((pcs("aapcs")))
84 # elif defined(__aarch64__) && __has_attribute(ms_abi)
85 # define __stdcall __attribute__((ms_abi))
86 # define __ms_va_list __builtin_ms_va_list
87 # else /* __i386__ */
88 # define __stdcall
89 # endif /* __i386__ */
90 # ifdef __i386__
91 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
92 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
93 # else
94 # define __cdecl __attribute__((__cdecl__))
95 # endif
96 # else
97 # define __cdecl __stdcall
98 # endif
99 # define __fastcall __stdcall
100 # define __thiscall __stdcall
101 #elif !defined(RC_INVOKED)
102 # error You need to define __stdcall for your compiler
103 #endif /* WINE_UNIX_LIB */
105 #endif /* _MSC_VER || __MINGW32__ */
107 #if !defined(__ms_va_list) && !defined(WINE_UNIX_LIB)
108 # define __ms_va_list va_list
109 #endif
111 #ifdef __WINESRC__
112 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
113 #else
114 #define __ONLY_IN_WINELIB(x) x
115 #endif
117 #ifndef _MSC_VER
118 #ifndef _stdcall
119 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
120 #endif
121 #ifndef _fastcall
122 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
123 #endif
124 #ifndef cdecl
125 #define cdecl __ONLY_IN_WINELIB(__cdecl)
126 #endif
127 #ifndef _cdecl
128 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
129 #endif
130 #endif /* _MSC_VER */
132 #ifndef pascal
133 #define pascal __ONLY_IN_WINELIB(__stdcall)
134 #endif
135 #ifndef _pascal
136 #define _pascal __ONLY_IN_WINELIB(__stdcall)
137 #endif
138 #ifndef __export
139 #define __export __ONLY_IN_WINELIB(__stdcall)
140 #endif
141 #ifndef near
142 #define near __ONLY_IN_WINELIB(/* nothing */)
143 #endif
144 #ifndef far
145 #define far __ONLY_IN_WINELIB(/* nothing */)
146 #endif
147 #ifndef _near
148 #define _near __ONLY_IN_WINELIB(/* nothing */)
149 #endif
150 #ifndef _far
151 #define _far __ONLY_IN_WINELIB(/* nothing */)
152 #endif
153 #ifndef NEAR
154 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
155 #endif
156 #ifndef FAR
157 #define FAR __ONLY_IN_WINELIB(/* nothing */)
158 #endif
160 #ifndef _MSC_VER
161 # ifndef _declspec
162 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
163 # endif
164 # ifndef __declspec
165 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
166 # endif
167 #endif
169 #ifdef _MSC_VER
170 # define inline __inline
171 #endif
173 #define CALLBACK __stdcall
174 #define WINAPI __stdcall
175 #define APIPRIVATE __stdcall
176 #define PASCAL __stdcall
177 #define CDECL __cdecl
178 #define _CDECL __cdecl
179 #define APIENTRY WINAPI
180 #define CONST __ONLY_IN_WINELIB(const)
181 #ifndef WINAPIV
182 # define WINAPIV CDECL
183 #endif
185 /* Misc. constants. */
187 #undef NULL
188 #ifdef __cplusplus
189 #define NULL 0
190 #else
191 #define NULL ((void*)0)
192 #endif
194 #ifdef FALSE
195 #undef FALSE
196 #endif
197 #define FALSE 0
199 #ifdef TRUE
200 #undef TRUE
201 #endif
202 #define TRUE 1
204 #ifndef IN
205 #define IN
206 #endif
208 #ifndef OUT
209 #define OUT
210 #endif
212 #ifndef OPTIONAL
213 #define OPTIONAL
214 #endif
216 /* Standard data types */
218 #ifndef BASETYPES
219 #define BASETYPES
220 typedef unsigned char UCHAR, *PUCHAR;
221 typedef unsigned short USHORT, *PUSHORT;
222 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
223 typedef unsigned long ULONG, *PULONG;
224 #else
225 typedef unsigned int ULONG, *PULONG;
226 #endif
227 #endif
229 typedef void *LPVOID;
230 typedef const void *LPCVOID;
231 typedef int BOOL, *PBOOL, *LPBOOL;
232 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
233 typedef unsigned short WORD, *PWORD, *LPWORD;
234 typedef int INT, *PINT, *LPINT;
235 typedef unsigned int UINT, *PUINT;
236 typedef float FLOAT, *PFLOAT;
237 typedef char *PSZ;
238 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
239 typedef long *LPLONG;
240 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
241 #else
242 typedef int *LPLONG;
243 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
244 #endif
246 /* Macros to map Winelib names to the correct implementation name */
247 /* Note that Winelib is purely Win32. */
249 #ifdef __WINESRC__
250 #define WINE_NO_UNICODE_MACROS 1
251 #define WINE_STRICT_PROTOTYPES 1
252 #endif
254 #ifdef WINE_NO_UNICODE_MACROS
255 # define WINELIB_NAME_AW(func) \
256 func##_must_be_suffixed_with_W_or_A_in_this_context \
257 func##_must_be_suffixed_with_W_or_A_in_this_context
258 #else /* WINE_NO_UNICODE_MACROS */
259 # ifdef UNICODE
260 # define WINELIB_NAME_AW(func) func##W
261 # else
262 # define WINELIB_NAME_AW(func) func##A
263 # endif
264 #endif /* WINE_NO_UNICODE_MACROS */
266 #ifdef WINE_NO_UNICODE_MACROS
267 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
268 #else
269 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
270 #endif
272 #include <winnt.h>
274 /* Polymorphic types */
276 typedef UINT_PTR WPARAM;
277 typedef LONG_PTR LPARAM;
278 typedef LONG_PTR LRESULT;
280 /* Integer types */
282 typedef WORD ATOM;
283 typedef DWORD COLORREF, *LPCOLORREF;
286 /* Handle types */
288 typedef int HFILE;
289 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
290 DECLARE_HANDLE(HACCEL);
291 DECLARE_HANDLE(HBITMAP);
292 DECLARE_HANDLE(HBRUSH);
293 DECLARE_HANDLE(HCOLORSPACE);
294 DECLARE_HANDLE(HDC);
295 DECLARE_HANDLE(HDESK);
296 DECLARE_HANDLE(HENHMETAFILE);
297 DECLARE_HANDLE(HFONT);
298 DECLARE_HANDLE(HGLRC);
299 DECLARE_HANDLE(HHOOK);
300 DECLARE_HANDLE(HICON);
301 DECLARE_HANDLE(HINSTANCE);
302 DECLARE_HANDLE(HKEY);
303 typedef HKEY *PHKEY;
304 DECLARE_HANDLE(HKL);
305 DECLARE_HANDLE(HMENU);
306 DECLARE_HANDLE(HMETAFILE);
307 DECLARE_HANDLE(HMONITOR);
308 DECLARE_HANDLE(HPALETTE);
309 DECLARE_HANDLE(HPEN);
310 DECLARE_HANDLE(HRGN);
311 DECLARE_HANDLE(HRSRC);
312 DECLARE_HANDLE(HTASK);
313 DECLARE_HANDLE(HWINEVENTHOOK);
314 DECLARE_HANDLE(HWINSTA);
315 DECLARE_HANDLE(HWND);
317 /* Handle types that must remain interchangeable even with strict on */
319 typedef HINSTANCE HMODULE;
320 typedef HANDLE HGDIOBJ;
321 typedef HANDLE HGLOBAL;
322 typedef HANDLE HLOCAL;
323 typedef HANDLE GLOBALHANDLE;
324 typedef HANDLE LOCALHANDLE;
325 typedef HICON HCURSOR;
327 /* Callback function pointers types */
329 #ifdef WINE_STRICT_PROTOTYPES
330 typedef INT_PTR (CALLBACK *FARPROC)(void);
331 typedef INT_PTR (CALLBACK *NEARPROC)(void);
332 typedef INT_PTR (CALLBACK *PROC)(void);
333 #else
334 typedef INT_PTR (CALLBACK *FARPROC)();
335 typedef INT_PTR (CALLBACK *NEARPROC)();
336 typedef INT_PTR (CALLBACK *PROC)();
337 #endif
339 /* Macros to split words and longs. */
341 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
342 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
344 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
345 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
347 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
348 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
350 /* min and max macros */
351 #ifndef NOMINMAX
352 #ifndef max
353 #define max(a,b) (((a) > (b)) ? (a) : (b))
354 #endif
355 #ifndef min
356 #define min(a,b) (((a) < (b)) ? (a) : (b))
357 #endif
358 #endif /* NOMINMAX */
360 #ifdef MAX_PATH /* Work-around for Mingw */
361 #undef MAX_PATH
362 #endif /* MAX_PATH */
364 #define MAX_PATH 260
365 #define HFILE_ERROR ((HFILE)-1)
367 /* The SIZE structure */
368 typedef struct tagSIZE
370 LONG cx;
371 LONG cy;
372 } SIZE, *PSIZE, *LPSIZE;
374 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
376 /* The POINT structure */
377 typedef struct tagPOINT
379 LONG x;
380 LONG y;
381 } POINT, *PPOINT, *LPPOINT;
383 typedef struct _POINTL
385 LONG x;
386 LONG y;
387 } POINTL, *PPOINTL;
389 /* The POINTS structure */
391 typedef struct tagPOINTS
393 SHORT x;
394 SHORT y;
395 } POINTS, *PPOINTS, *LPPOINTS;
397 typedef struct _FILETIME {
398 DWORD dwLowDateTime;
399 DWORD dwHighDateTime;
400 } FILETIME, *PFILETIME, *LPFILETIME;
401 #define _FILETIME_
403 /* The RECT structure */
404 typedef struct tagRECT
406 LONG left;
407 LONG top;
408 LONG right;
409 LONG bottom;
410 } RECT, *PRECT, *LPRECT;
411 typedef const RECT *LPCRECT;
413 typedef struct _RECTL
415 LONG left;
416 LONG top;
417 LONG right;
418 LONG bottom;
419 } RECTL, *PRECTL, *LPRECTL;
421 typedef const RECTL *LPCRECTL;
423 /* DPI awareness */
424 typedef enum DPI_AWARENESS
426 DPI_AWARENESS_INVALID = -1,
427 DPI_AWARENESS_UNAWARE = 0,
428 DPI_AWARENESS_SYSTEM_AWARE,
429 DPI_AWARENESS_PER_MONITOR_AWARE
430 } DPI_AWARENESS;
432 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
433 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
434 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
435 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
436 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
438 #ifdef __cplusplus
440 #endif
442 #endif /* _WINDEF_ */