winhttp/tests: Fix a test failure.
[wine.git] / include / windef.h
blob0074d5cf6c45a5b1bab60995c2d8061b8f47214c
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 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 /* Calling conventions definitions */
40 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
41 #define _WIN64
42 #endif
44 #ifndef _WIN64
45 # if defined(__i386__) && !defined(_X86_)
46 # define _X86_
47 # endif
48 # if defined(_X86_) && !defined(__i386__)
49 # define __i386__
50 # endif
51 #endif
53 #ifndef __stdcall
54 # ifdef __i386__
55 # ifdef __GNUC__
56 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
57 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
58 # else
59 # define __stdcall __attribute__((__stdcall__))
60 # endif
61 # elif defined(_MSC_VER)
62 /* Nothing needs to be done. __stdcall already exists */
63 # else
64 # error You need to define __stdcall for your compiler
65 # endif
66 # elif defined(__x86_64__) && defined (__GNUC__)
67 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
68 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
69 # else
70 # define __stdcall __attribute__((ms_abi))
71 # endif
72 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
73 # define __stdcall __attribute__((pcs("aapcs-vfp")))
74 # elif defined(__aarch64__) && defined (__GNUC__)
75 # define __stdcall __attribute__((ms_abi))
76 # else /* __i386__ */
77 # define __stdcall
78 # endif /* __i386__ */
79 #endif /* __stdcall */
81 #ifndef __cdecl
82 # if defined(__i386__) && defined(__GNUC__)
83 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
84 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
85 # else
86 # define __cdecl __attribute__((__cdecl__))
87 # endif
88 # elif defined(__x86_64__) && defined (__GNUC__)
89 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
90 # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
91 # else
92 # define __cdecl __attribute__((ms_abi))
93 # endif
94 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
95 # define __cdecl __attribute__((pcs("aapcs-vfp")))
96 # elif defined(__aarch64__) && defined (__GNUC__)
97 # define __cdecl __attribute__((ms_abi))
98 # elif !defined(_MSC_VER)
99 # define __cdecl
100 # endif
101 #endif /* __cdecl */
103 #ifndef __fastcall
104 # ifndef _MSC_VER
105 # define __fastcall __stdcall
106 # endif
107 #endif
109 #ifndef __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 pascal
144 #define pascal __ONLY_IN_WINELIB(__stdcall)
145 #endif
146 #ifndef _pascal
147 #define _pascal __ONLY_IN_WINELIB(__stdcall)
148 #endif
149 #ifndef _stdcall
150 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
151 #endif
152 #ifndef _fastcall
153 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
154 #endif
155 #ifndef __fastcall
156 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
157 #endif
158 #ifndef __export
159 #define __export __ONLY_IN_WINELIB(__stdcall)
160 #endif
161 #ifndef cdecl
162 #define cdecl __ONLY_IN_WINELIB(__cdecl)
163 #endif
164 #ifndef _cdecl
165 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
166 #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
180 #ifndef NEAR
181 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
182 #endif
183 #ifndef FAR
184 #define FAR __ONLY_IN_WINELIB(/* nothing */)
185 #endif
187 #ifndef _MSC_VER
188 # ifndef _declspec
189 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
190 # endif
191 # ifndef __declspec
192 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
193 # endif
194 #endif
196 #ifdef _MSC_VER
197 # define inline __inline
198 #endif
200 #define CALLBACK __stdcall
201 #define WINAPI __stdcall
202 #define APIPRIVATE __stdcall
203 #define PASCAL __stdcall
204 #define CDECL __cdecl
205 #define _CDECL __cdecl
206 #define APIENTRY WINAPI
207 #define CONST __ONLY_IN_WINELIB(const)
209 /* Misc. constants. */
211 #undef NULL
212 #ifdef __cplusplus
213 #define NULL 0
214 #else
215 #define NULL ((void*)0)
216 #endif
218 #ifdef FALSE
219 #undef FALSE
220 #endif
221 #define FALSE 0
223 #ifdef TRUE
224 #undef TRUE
225 #endif
226 #define TRUE 1
228 #ifndef IN
229 #define IN
230 #endif
232 #ifndef OUT
233 #define OUT
234 #endif
236 #ifndef OPTIONAL
237 #define OPTIONAL
238 #endif
240 /* Standard data types */
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 char UCHAR, *PUCHAR;
247 typedef unsigned short WORD, *PWORD, *LPWORD;
248 typedef unsigned short USHORT, *PUSHORT;
249 typedef int INT, *PINT, *LPINT;
250 typedef unsigned int UINT, *PUINT;
251 typedef float FLOAT, *PFLOAT;
252 typedef char *PSZ;
253 #ifdef _MSC_VER
254 typedef long *LPLONG;
255 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
256 typedef unsigned long ULONG, *PULONG;
257 #else
258 typedef int *LPLONG;
259 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
260 typedef unsigned int ULONG, *PULONG;
261 #endif
263 /* Macros to map Winelib names to the correct implementation name */
264 /* Note that Winelib is purely Win32. */
266 #ifdef __WINESRC__
267 #define WINE_NO_UNICODE_MACROS 1
268 #define WINE_STRICT_PROTOTYPES 1
269 #endif
271 #ifdef WINE_NO_UNICODE_MACROS
272 # define WINELIB_NAME_AW(func) \
273 func##_must_be_suffixed_with_W_or_A_in_this_context \
274 func##_must_be_suffixed_with_W_or_A_in_this_context
275 #else /* WINE_NO_UNICODE_MACROS */
276 # ifdef UNICODE
277 # define WINELIB_NAME_AW(func) func##W
278 # else
279 # define WINELIB_NAME_AW(func) func##A
280 # endif
281 #endif /* WINE_NO_UNICODE_MACROS */
283 #ifdef WINE_NO_UNICODE_MACROS
284 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
285 #else
286 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
287 #endif
289 #include <winnt.h>
291 /* Polymorphic types */
293 typedef UINT_PTR WPARAM;
294 typedef LONG_PTR LPARAM;
295 typedef LONG_PTR LRESULT;
297 /* Integer types */
299 typedef WORD ATOM;
300 typedef DWORD COLORREF, *LPCOLORREF;
303 /* Handle types */
305 typedef int HFILE;
306 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT);
307 DECLARE_HANDLE(HACCEL);
308 DECLARE_HANDLE(HBITMAP);
309 DECLARE_HANDLE(HBRUSH);
310 DECLARE_HANDLE(HCOLORSPACE);
311 DECLARE_HANDLE(HDC);
312 DECLARE_HANDLE(HDESK);
313 DECLARE_HANDLE(HENHMETAFILE);
314 DECLARE_HANDLE(HFONT);
315 DECLARE_HANDLE(HGLRC);
316 DECLARE_HANDLE(HHOOK);
317 DECLARE_HANDLE(HICON);
318 DECLARE_HANDLE(HINSTANCE);
319 DECLARE_HANDLE(HKEY);
320 typedef HKEY *PHKEY;
321 DECLARE_HANDLE(HKL);
322 DECLARE_HANDLE(HMENU);
323 DECLARE_HANDLE(HMETAFILE);
324 DECLARE_HANDLE(HMONITOR);
325 DECLARE_HANDLE(HPALETTE);
326 DECLARE_HANDLE(HPEN);
327 DECLARE_HANDLE(HRGN);
328 DECLARE_HANDLE(HRSRC);
329 DECLARE_HANDLE(HTASK);
330 DECLARE_HANDLE(HWINEVENTHOOK);
331 DECLARE_HANDLE(HWINSTA);
332 DECLARE_HANDLE(HWND);
334 /* Handle types that must remain interchangeable even with strict on */
336 typedef HINSTANCE HMODULE;
337 typedef HANDLE HGDIOBJ;
338 typedef HANDLE HGLOBAL;
339 typedef HANDLE HLOCAL;
340 typedef HANDLE GLOBALHANDLE;
341 typedef HANDLE LOCALHANDLE;
342 typedef HICON HCURSOR;
344 /* Callback function pointers types */
346 #ifdef WINE_STRICT_PROTOTYPES
347 typedef INT_PTR (CALLBACK *FARPROC)(void);
348 typedef INT_PTR (CALLBACK *NEARPROC)(void);
349 typedef INT_PTR (CALLBACK *PROC)(void);
350 #else
351 typedef INT_PTR (CALLBACK *FARPROC)();
352 typedef INT_PTR (CALLBACK *NEARPROC)();
353 typedef INT_PTR (CALLBACK *PROC)();
354 #endif
356 /* Macros to split words and longs. */
358 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
359 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
361 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
362 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
364 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
365 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
367 /* min and max macros */
368 #ifndef NOMINMAX
369 #ifndef max
370 #define max(a,b) (((a) > (b)) ? (a) : (b))
371 #endif
372 #ifndef min
373 #define min(a,b) (((a) < (b)) ? (a) : (b))
374 #endif
375 #endif /* NOMINMAX */
377 #ifdef MAX_PATH /* Work-around for Mingw */
378 #undef MAX_PATH
379 #endif /* MAX_PATH */
381 #define MAX_PATH 260
382 #define HFILE_ERROR ((HFILE)-1)
384 /* The SIZE structure */
385 typedef struct tagSIZE
387 LONG cx;
388 LONG cy;
389 } SIZE, *PSIZE, *LPSIZE;
391 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
393 /* The POINT structure */
394 typedef struct tagPOINT
396 LONG x;
397 LONG y;
398 } POINT, *PPOINT, *LPPOINT;
400 typedef struct _POINTL
402 LONG x;
403 LONG y;
404 } POINTL, *PPOINTL;
406 /* The POINTS structure */
408 typedef struct tagPOINTS
410 #ifdef WORDS_BIGENDIAN
411 SHORT y;
412 SHORT x;
413 #else
414 SHORT x;
415 SHORT y;
416 #endif
417 } POINTS, *PPOINTS, *LPPOINTS;
419 typedef struct _FILETIME {
420 #ifdef WORDS_BIGENDIAN
421 DWORD dwHighDateTime;
422 DWORD dwLowDateTime;
423 #else
424 DWORD dwLowDateTime;
425 DWORD dwHighDateTime;
426 #endif
427 } FILETIME, *PFILETIME, *LPFILETIME;
428 #define _FILETIME_
430 /* The RECT structure */
431 typedef struct tagRECT
433 LONG left;
434 LONG top;
435 LONG right;
436 LONG bottom;
437 } RECT, *PRECT, *LPRECT;
438 typedef const RECT *LPCRECT;
440 typedef struct _RECTL
442 LONG left;
443 LONG top;
444 LONG right;
445 LONG bottom;
446 } RECTL, *PRECTL, *LPRECTL;
448 typedef const RECTL *LPCRECTL;
450 /* DPI awareness */
451 typedef enum DPI_AWARENESS
453 DPI_AWARENESS_INVALID = -1,
454 DPI_AWARENESS_UNAWARE = 0,
455 DPI_AWARENESS_SYSTEM_AWARE,
456 DPI_AWARENESS_PER_MONITOR_AWARE
457 } DPI_AWARENESS;
459 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
460 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
461 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
462 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
463 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
465 #ifdef __cplusplus
467 #endif
469 #endif /* _WINDEF_ */