Release 9.12.
[wine.git] / include / windef.h
blob79a967911519a2f85717fd2167e5982f19fb1328
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 #endif
253 #ifdef WINE_NO_UNICODE_MACROS
254 # define WINELIB_NAME_AW(func) \
255 func##_must_be_suffixed_with_W_or_A_in_this_context \
256 func##_must_be_suffixed_with_W_or_A_in_this_context
257 #else /* WINE_NO_UNICODE_MACROS */
258 # ifdef UNICODE
259 # define WINELIB_NAME_AW(func) func##W
260 # else
261 # define WINELIB_NAME_AW(func) func##A
262 # endif
263 #endif /* WINE_NO_UNICODE_MACROS */
265 #ifdef WINE_NO_UNICODE_MACROS
266 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
267 #else
268 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
269 #endif
271 #include <winnt.h>
273 /* Polymorphic types */
275 typedef UINT_PTR WPARAM;
276 typedef LONG_PTR LPARAM;
277 typedef LONG_PTR LRESULT;
279 /* Integer types */
281 typedef WORD ATOM;
282 typedef DWORD COLORREF, *LPCOLORREF;
285 /* Handle types */
287 typedef int HFILE;
288 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
289 DECLARE_HANDLE(HACCEL);
290 DECLARE_HANDLE(HBITMAP);
291 DECLARE_HANDLE(HBRUSH);
292 DECLARE_HANDLE(HCOLORSPACE);
293 DECLARE_HANDLE(HDC);
294 DECLARE_HANDLE(HDESK);
295 DECLARE_HANDLE(HENHMETAFILE);
296 DECLARE_HANDLE(HFONT);
297 DECLARE_HANDLE(HGLRC);
298 DECLARE_HANDLE(HHOOK);
299 DECLARE_HANDLE(HICON);
300 DECLARE_HANDLE(HINSTANCE);
301 DECLARE_HANDLE(HKEY);
302 typedef HKEY *PHKEY;
303 DECLARE_HANDLE(HKL);
304 DECLARE_HANDLE(HMENU);
305 DECLARE_HANDLE(HMETAFILE);
306 DECLARE_HANDLE(HMONITOR);
307 DECLARE_HANDLE(HPALETTE);
308 DECLARE_HANDLE(HPEN);
309 DECLARE_HANDLE(HRGN);
310 DECLARE_HANDLE(HRSRC);
311 DECLARE_HANDLE(HTASK);
312 DECLARE_HANDLE(HWINEVENTHOOK);
313 DECLARE_HANDLE(HWINSTA);
314 DECLARE_HANDLE(HWND);
316 /* Handle types that must remain interchangeable even with strict on */
318 typedef HINSTANCE HMODULE;
319 typedef HANDLE HGDIOBJ;
320 typedef HANDLE HGLOBAL;
321 typedef HANDLE HLOCAL;
322 typedef HANDLE GLOBALHANDLE;
323 typedef HANDLE LOCALHANDLE;
324 typedef HICON HCURSOR;
326 /* Callback function pointers types */
328 #ifndef WINE_NO_STRICT_PROTOTYPES
329 typedef INT_PTR (CALLBACK *FARPROC)(void);
330 typedef INT_PTR (CALLBACK *NEARPROC)(void);
331 typedef INT_PTR (CALLBACK *PROC)(void);
332 #else
333 typedef INT_PTR (CALLBACK *FARPROC)();
334 typedef INT_PTR (CALLBACK *NEARPROC)();
335 typedef INT_PTR (CALLBACK *PROC)();
336 #endif
338 /* Macros to split words and longs. */
340 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
341 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
343 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
344 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
346 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
347 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
349 /* min and max macros */
350 #ifndef NOMINMAX
351 #ifndef max
352 #define max(a,b) (((a) > (b)) ? (a) : (b))
353 #endif
354 #ifndef min
355 #define min(a,b) (((a) < (b)) ? (a) : (b))
356 #endif
357 #endif /* NOMINMAX */
359 #ifdef MAX_PATH /* Work-around for Mingw */
360 #undef MAX_PATH
361 #endif /* MAX_PATH */
363 #define MAX_PATH 260
364 #define HFILE_ERROR ((HFILE)-1)
366 /* The SIZE structure */
367 typedef struct tagSIZE
369 LONG cx;
370 LONG cy;
371 } SIZE, *PSIZE, *LPSIZE;
373 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
375 /* The POINT structure */
376 typedef struct tagPOINT
378 LONG x;
379 LONG y;
380 } POINT, *PPOINT, *LPPOINT;
382 typedef struct _POINTL
384 LONG x;
385 LONG y;
386 } POINTL, *PPOINTL;
388 /* The POINTS structure */
390 typedef struct tagPOINTS
392 SHORT x;
393 SHORT y;
394 } POINTS, *PPOINTS, *LPPOINTS;
396 typedef struct _FILETIME {
397 DWORD dwLowDateTime;
398 DWORD dwHighDateTime;
399 } FILETIME, *PFILETIME, *LPFILETIME;
400 #define _FILETIME_
402 /* The RECT structure */
403 typedef struct tagRECT
405 LONG left;
406 LONG top;
407 LONG right;
408 LONG bottom;
409 } RECT, *PRECT, *LPRECT;
410 typedef const RECT *LPCRECT;
412 typedef struct _RECTL
414 LONG left;
415 LONG top;
416 LONG right;
417 LONG bottom;
418 } RECTL, *PRECTL, *LPRECTL;
420 typedef const RECTL *LPCRECTL;
422 /* DPI awareness */
423 typedef enum DPI_AWARENESS
425 DPI_AWARENESS_INVALID = -1,
426 DPI_AWARENESS_UNAWARE = 0,
427 DPI_AWARENESS_SYSTEM_AWARE,
428 DPI_AWARENESS_PER_MONITOR_AWARE
429 } DPI_AWARENESS;
431 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
432 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
433 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
434 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
435 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
437 #ifdef __cplusplus
439 #endif
441 typedef enum {
442 DPI_HOSTING_BEHAVIOR_INVALID = -1,
443 DPI_HOSTING_BEHAVIOR_DEFAULT = 0,
444 DPI_HOSTING_BEHAVIOR_MIXED = 1
445 } DPI_HOSTING_BEHAVIOR;
447 #endif /* _WINDEF_ */