po: Update Lithuanian translation.
[wine.git] / include / windef.h
blobcb7eb1179c888b46feaf95932ddb3c58abdb39b0
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 #ifndef _MSC_VER
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(__MINGW32__) && !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 #endif /* __stdcall */
84 #ifndef _MSC_VER
85 # undef __cdecl
86 # if defined(__i386__) && defined(__GNUC__)
87 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
88 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
89 # else
90 # define __cdecl __attribute__((__cdecl__))
91 # endif
92 # else
93 # define __cdecl __stdcall
94 # endif
95 #endif
97 #if !defined(_MSC_VER) && !defined(__fastcall)
98 # define __fastcall __stdcall
99 #endif
101 #if (!defined(_MSC_VER) || !defined(__clang__)) && !defined(__thiscall)
102 # define __thiscall __stdcall
103 #endif
105 #ifndef __ms_va_list
106 # if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined (__GNUC__)
107 # define __ms_va_list __builtin_ms_va_list
108 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
109 # define __ms_va_end(list) __builtin_ms_va_end(list)
110 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
111 # else
112 # define __ms_va_list va_list
113 # define __ms_va_start(list,arg) va_start(list,arg)
114 # define __ms_va_end(list) va_end(list)
115 # ifdef va_copy
116 # define __ms_va_copy(dest,src) va_copy(dest,src)
117 # else
118 # define __ms_va_copy(dest,src) ((dest) = (src))
119 # endif
120 # endif
121 #endif
123 #if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__MINGW32__) && !defined(__CYGWIN__)
124 # define WINAPIV __attribute__((pcs("aapcs")))
125 #else
126 # define WINAPIV __cdecl
127 #endif
129 #ifdef __WINESRC__
130 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
131 #else
132 #define __ONLY_IN_WINELIB(x) x
133 #endif
135 #ifndef _MSC_VER
136 #ifndef _stdcall
137 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
138 #endif
139 #ifndef _fastcall
140 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
141 #endif
142 #ifndef __fastcall
143 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
144 #endif
145 #ifndef cdecl
146 #define cdecl __ONLY_IN_WINELIB(__cdecl)
147 #endif
148 #ifndef _cdecl
149 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
150 #endif
151 #endif /* _MSC_VER */
153 #ifndef pascal
154 #define pascal __ONLY_IN_WINELIB(__stdcall)
155 #endif
156 #ifndef _pascal
157 #define _pascal __ONLY_IN_WINELIB(__stdcall)
158 #endif
159 #ifndef __export
160 #define __export __ONLY_IN_WINELIB(__stdcall)
161 #endif
162 #ifndef near
163 #define near __ONLY_IN_WINELIB(/* nothing */)
164 #endif
165 #ifndef far
166 #define far __ONLY_IN_WINELIB(/* nothing */)
167 #endif
168 #ifndef _near
169 #define _near __ONLY_IN_WINELIB(/* nothing */)
170 #endif
171 #ifndef _far
172 #define _far __ONLY_IN_WINELIB(/* nothing */)
173 #endif
174 #ifndef NEAR
175 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
176 #endif
177 #ifndef FAR
178 #define FAR __ONLY_IN_WINELIB(/* nothing */)
179 #endif
181 #ifndef _MSC_VER
182 # ifndef _declspec
183 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
184 # endif
185 # ifndef __declspec
186 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
187 # endif
188 #endif
190 #ifdef _MSC_VER
191 # define inline __inline
192 #endif
194 #define CALLBACK __stdcall
195 #define WINAPI __stdcall
196 #define APIPRIVATE __stdcall
197 #define PASCAL __stdcall
198 #define CDECL __cdecl
199 #define _CDECL __cdecl
200 #define APIENTRY WINAPI
201 #define CONST __ONLY_IN_WINELIB(const)
203 /* Misc. constants. */
205 #undef NULL
206 #ifdef __cplusplus
207 #define NULL 0
208 #else
209 #define NULL ((void*)0)
210 #endif
212 #ifdef FALSE
213 #undef FALSE
214 #endif
215 #define FALSE 0
217 #ifdef TRUE
218 #undef TRUE
219 #endif
220 #define TRUE 1
222 #ifndef IN
223 #define IN
224 #endif
226 #ifndef OUT
227 #define OUT
228 #endif
230 #ifndef OPTIONAL
231 #define OPTIONAL
232 #endif
234 /* Standard data types */
236 #ifndef BASETYPES
237 #define BASETYPES
238 typedef unsigned char UCHAR, *PUCHAR;
239 typedef unsigned short USHORT, *PUSHORT;
240 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
241 typedef unsigned long ULONG, *PULONG;
242 #else
243 typedef unsigned int ULONG, *PULONG;
244 #endif
245 #endif
247 typedef void *LPVOID;
248 typedef const void *LPCVOID;
249 typedef int BOOL, *PBOOL, *LPBOOL;
250 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
251 typedef unsigned short WORD, *PWORD, *LPWORD;
252 typedef int INT, *PINT, *LPINT;
253 typedef unsigned int UINT, *PUINT;
254 typedef float FLOAT, *PFLOAT;
255 typedef char *PSZ;
256 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
257 typedef long *LPLONG;
258 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
259 #else
260 typedef int *LPLONG;
261 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
262 #endif
264 /* Macros to map Winelib names to the correct implementation name */
265 /* Note that Winelib is purely Win32. */
267 #ifdef __WINESRC__
268 #define WINE_NO_UNICODE_MACROS 1
269 #define WINE_STRICT_PROTOTYPES 1
270 #endif
272 #ifdef WINE_NO_UNICODE_MACROS
273 # define WINELIB_NAME_AW(func) \
274 func##_must_be_suffixed_with_W_or_A_in_this_context \
275 func##_must_be_suffixed_with_W_or_A_in_this_context
276 #else /* WINE_NO_UNICODE_MACROS */
277 # ifdef UNICODE
278 # define WINELIB_NAME_AW(func) func##W
279 # else
280 # define WINELIB_NAME_AW(func) func##A
281 # endif
282 #endif /* WINE_NO_UNICODE_MACROS */
284 #ifdef WINE_NO_UNICODE_MACROS
285 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
286 #else
287 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
288 #endif
290 #include <winnt.h>
292 /* Polymorphic types */
294 typedef UINT_PTR WPARAM;
295 typedef LONG_PTR LPARAM;
296 typedef LONG_PTR LRESULT;
298 /* Integer types */
300 typedef WORD ATOM;
301 typedef DWORD COLORREF, *LPCOLORREF;
304 /* Handle types */
306 typedef int HFILE;
307 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
308 DECLARE_HANDLE(HACCEL);
309 DECLARE_HANDLE(HBITMAP);
310 DECLARE_HANDLE(HBRUSH);
311 DECLARE_HANDLE(HCOLORSPACE);
312 DECLARE_HANDLE(HDC);
313 DECLARE_HANDLE(HDESK);
314 DECLARE_HANDLE(HENHMETAFILE);
315 DECLARE_HANDLE(HFONT);
316 DECLARE_HANDLE(HGLRC);
317 DECLARE_HANDLE(HHOOK);
318 DECLARE_HANDLE(HICON);
319 DECLARE_HANDLE(HINSTANCE);
320 DECLARE_HANDLE(HKEY);
321 typedef HKEY *PHKEY;
322 DECLARE_HANDLE(HKL);
323 DECLARE_HANDLE(HMENU);
324 DECLARE_HANDLE(HMETAFILE);
325 DECLARE_HANDLE(HMONITOR);
326 DECLARE_HANDLE(HPALETTE);
327 DECLARE_HANDLE(HPEN);
328 DECLARE_HANDLE(HRGN);
329 DECLARE_HANDLE(HRSRC);
330 DECLARE_HANDLE(HTASK);
331 DECLARE_HANDLE(HWINEVENTHOOK);
332 DECLARE_HANDLE(HWINSTA);
333 DECLARE_HANDLE(HWND);
335 /* Handle types that must remain interchangeable even with strict on */
337 typedef HINSTANCE HMODULE;
338 typedef HANDLE HGDIOBJ;
339 typedef HANDLE HGLOBAL;
340 typedef HANDLE HLOCAL;
341 typedef HANDLE GLOBALHANDLE;
342 typedef HANDLE LOCALHANDLE;
343 typedef HICON HCURSOR;
345 /* Callback function pointers types */
347 #ifdef WINE_STRICT_PROTOTYPES
348 typedef INT_PTR (CALLBACK *FARPROC)(void);
349 typedef INT_PTR (CALLBACK *NEARPROC)(void);
350 typedef INT_PTR (CALLBACK *PROC)(void);
351 #else
352 typedef INT_PTR (CALLBACK *FARPROC)();
353 typedef INT_PTR (CALLBACK *NEARPROC)();
354 typedef INT_PTR (CALLBACK *PROC)();
355 #endif
357 /* Macros to split words and longs. */
359 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
360 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
362 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
363 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
365 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
366 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
368 /* min and max macros */
369 #ifndef NOMINMAX
370 #ifndef max
371 #define max(a,b) (((a) > (b)) ? (a) : (b))
372 #endif
373 #ifndef min
374 #define min(a,b) (((a) < (b)) ? (a) : (b))
375 #endif
376 #endif /* NOMINMAX */
378 #ifdef MAX_PATH /* Work-around for Mingw */
379 #undef MAX_PATH
380 #endif /* MAX_PATH */
382 #define MAX_PATH 260
383 #define HFILE_ERROR ((HFILE)-1)
385 /* The SIZE structure */
386 typedef struct tagSIZE
388 LONG cx;
389 LONG cy;
390 } SIZE, *PSIZE, *LPSIZE;
392 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
394 /* The POINT structure */
395 typedef struct tagPOINT
397 LONG x;
398 LONG y;
399 } POINT, *PPOINT, *LPPOINT;
401 typedef struct _POINTL
403 LONG x;
404 LONG y;
405 } POINTL, *PPOINTL;
407 /* The POINTS structure */
409 typedef struct tagPOINTS
411 #ifdef WORDS_BIGENDIAN
412 SHORT y;
413 SHORT x;
414 #else
415 SHORT x;
416 SHORT y;
417 #endif
418 } POINTS, *PPOINTS, *LPPOINTS;
420 typedef struct _FILETIME {
421 #ifdef WORDS_BIGENDIAN
422 DWORD dwHighDateTime;
423 DWORD dwLowDateTime;
424 #else
425 DWORD dwLowDateTime;
426 DWORD dwHighDateTime;
427 #endif
428 } FILETIME, *PFILETIME, *LPFILETIME;
429 #define _FILETIME_
431 /* The RECT structure */
432 typedef struct tagRECT
434 LONG left;
435 LONG top;
436 LONG right;
437 LONG bottom;
438 } RECT, *PRECT, *LPRECT;
439 typedef const RECT *LPCRECT;
441 typedef struct _RECTL
443 LONG left;
444 LONG top;
445 LONG right;
446 LONG bottom;
447 } RECTL, *PRECTL, *LPRECTL;
449 typedef const RECTL *LPCRECTL;
451 /* DPI awareness */
452 typedef enum DPI_AWARENESS
454 DPI_AWARENESS_INVALID = -1,
455 DPI_AWARENESS_UNAWARE = 0,
456 DPI_AWARENESS_SYSTEM_AWARE,
457 DPI_AWARENESS_PER_MONITOR_AWARE
458 } DPI_AWARENESS;
460 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
461 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
462 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
463 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
464 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
466 #ifdef __cplusplus
468 #endif
470 #endif /* _WINDEF_ */