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