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
32 #endif /* NO_STRICT */
38 /* Calling conventions definitions */
40 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
45 # if defined(__i386__) && !defined(_X86_)
48 # if defined(_X86_) && !defined(__i386__)
56 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
57 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
59 # define __stdcall __attribute__((__stdcall__))
61 # elif defined(_MSC_VER)
62 /* Nothing needs to be done. __stdcall already exists */
64 # error You need to define __stdcall for your compiler
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__))
70 # define __stdcall __attribute__((ms_abi))
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))
78 # endif /* __i386__ */
79 #endif /* __stdcall */
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__))
86 # define __cdecl __attribute__((__cdecl__))
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__))
92 # define __cdecl __attribute__((ms_abi))
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)
105 # define __fastcall __stdcall
110 # define __thiscall __stdcall
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)
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)
124 # define __ms_va_copy(dest,src) va_copy(dest,src)
126 # define __ms_va_copy(dest,src) ((dest) = (src))
131 #if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
132 # define WINAPIV __attribute__((pcs("aapcs")))
134 # define WINAPIV __cdecl
138 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
140 #define __ONLY_IN_WINELIB(x) x
144 #define pascal __ONLY_IN_WINELIB(__stdcall)
147 #define _pascal __ONLY_IN_WINELIB(__stdcall)
150 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
153 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
156 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
159 #define __export __ONLY_IN_WINELIB(__stdcall)
162 #define cdecl __ONLY_IN_WINELIB(__cdecl)
165 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
169 #define near __ONLY_IN_WINELIB(/* nothing */)
172 #define far __ONLY_IN_WINELIB(/* nothing */)
175 #define _near __ONLY_IN_WINELIB(/* nothing */)
178 #define _far __ONLY_IN_WINELIB(/* nothing */)
181 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
184 #define FAR __ONLY_IN_WINELIB(/* nothing */)
189 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
192 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
197 # define inline __inline
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. */
215 #define NULL ((void*)0)
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
;
254 typedef long *LPLONG
;
255 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
256 typedef unsigned long ULONG
, *PULONG
;
259 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
260 typedef unsigned int ULONG
, *PULONG
;
263 /* Macros to map Winelib names to the correct implementation name */
264 /* Note that Winelib is purely Win32. */
267 #define WINE_NO_UNICODE_MACROS 1
268 #define WINE_STRICT_PROTOTYPES 1
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 */
277 # define WINELIB_NAME_AW(func) func##W
279 # define WINELIB_NAME_AW(func) func##A
281 #endif /* WINE_NO_UNICODE_MACROS */
283 #ifdef WINE_NO_UNICODE_MACROS
284 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
286 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
291 /* Polymorphic types */
293 typedef UINT_PTR WPARAM
;
294 typedef LONG_PTR LPARAM
;
295 typedef LONG_PTR LRESULT
;
300 typedef DWORD COLORREF
, *LPCOLORREF
;
306 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT
);
307 DECLARE_HANDLE(HACCEL
);
308 DECLARE_HANDLE(HBITMAP
);
309 DECLARE_HANDLE(HBRUSH
);
310 DECLARE_HANDLE(HCOLORSPACE
);
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
);
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);
351 typedef INT_PTR (CALLBACK
*FARPROC
)();
352 typedef INT_PTR (CALLBACK
*NEARPROC
)();
353 typedef INT_PTR (CALLBACK
*PROC
)();
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 */
370 #define max(a,b) (((a) > (b)) ? (a) : (b))
373 #define min(a,b) (((a) < (b)) ? (a) : (b))
375 #endif /* NOMINMAX */
377 #ifdef MAX_PATH /* Work-around for Mingw */
379 #endif /* MAX_PATH */
382 #define HFILE_ERROR ((HFILE)-1)
384 /* The SIZE structure */
385 typedef struct tagSIZE
389 } SIZE
, *PSIZE
, *LPSIZE
;
391 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
393 /* The POINT structure */
394 typedef struct tagPOINT
398 } POINT
, *PPOINT
, *LPPOINT
;
400 typedef struct _POINTL
406 /* The POINTS structure */
408 typedef struct tagPOINTS
410 #ifdef WORDS_BIGENDIAN
417 } POINTS
, *PPOINTS
, *LPPOINTS
;
419 typedef struct _FILETIME
{
420 #ifdef WORDS_BIGENDIAN
421 DWORD dwHighDateTime
;
425 DWORD dwHighDateTime
;
427 } FILETIME
, *PFILETIME
, *LPFILETIME
;
430 /* The RECT structure */
431 typedef struct tagRECT
437 } RECT
, *PRECT
, *LPRECT
;
438 typedef const RECT
*LPCRECT
;
440 typedef struct _RECTL
446 } RECTL
, *PRECTL
, *LPRECTL
;
448 typedef const RECTL
*LPCRECTL
;
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
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)
469 #endif /* _WINDEF_ */