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