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 */
34 #ifndef __has_attribute
35 #define __has_attribute(x) 0
42 /* Calling conventions definitions */
44 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
49 # if defined(__i386__) && !defined(_X86_)
52 # if defined(_X86_) && !defined(__i386__)
61 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
62 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
64 # define __stdcall __attribute__((__stdcall__))
67 # error You need to define __stdcall for your compiler
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__))
73 # define __stdcall __attribute__((ms_abi))
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))
81 # endif /* __i386__ */
82 #endif /* __stdcall */
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__))
90 # define __cdecl __attribute__((__cdecl__))
93 # define __cdecl __stdcall
97 #if !defined(_MSC_VER) && !defined(__fastcall)
98 # define __fastcall __stdcall
101 #if (!defined(_MSC_VER) || !defined(__clang__)) && !defined(__thiscall)
102 # define __thiscall __stdcall
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)
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)
116 # define __ms_va_copy(dest,src) va_copy(dest,src)
118 # define __ms_va_copy(dest,src) ((dest) = (src))
123 #if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__MINGW32__) && !defined(__CYGWIN__)
124 # define WINAPIV __attribute__((pcs("aapcs")))
126 # define WINAPIV __cdecl
130 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
132 #define __ONLY_IN_WINELIB(x) x
137 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
140 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
143 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
146 #define cdecl __ONLY_IN_WINELIB(__cdecl)
149 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
151 #endif /* _MSC_VER */
154 #define pascal __ONLY_IN_WINELIB(__stdcall)
157 #define _pascal __ONLY_IN_WINELIB(__stdcall)
160 #define __export __ONLY_IN_WINELIB(__stdcall)
163 #define near __ONLY_IN_WINELIB(/* nothing */)
166 #define far __ONLY_IN_WINELIB(/* nothing */)
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 */)
183 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
186 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
191 # define inline __inline
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. */
209 #define NULL ((void*)0)
234 /* Standard data types */
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
;
243 typedef unsigned int ULONG
, *PULONG
;
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
;
256 #if !defined(__LP64__) && !defined(WINE_NO_LONG_TYPES)
257 typedef long *LPLONG
;
258 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
261 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
264 /* Macros to map Winelib names to the correct implementation name */
265 /* Note that Winelib is purely Win32. */
268 #define WINE_NO_UNICODE_MACROS 1
269 #define WINE_STRICT_PROTOTYPES 1
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 */
278 # define WINELIB_NAME_AW(func) func##W
280 # define WINELIB_NAME_AW(func) func##A
282 #endif /* WINE_NO_UNICODE_MACROS */
284 #ifdef WINE_NO_UNICODE_MACROS
285 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
287 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
292 /* Polymorphic types */
294 typedef UINT_PTR WPARAM
;
295 typedef LONG_PTR LPARAM
;
296 typedef LONG_PTR LRESULT
;
301 typedef DWORD COLORREF
, *LPCOLORREF
;
307 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT
);
308 DECLARE_HANDLE(HACCEL
);
309 DECLARE_HANDLE(HBITMAP
);
310 DECLARE_HANDLE(HBRUSH
);
311 DECLARE_HANDLE(HCOLORSPACE
);
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
);
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);
352 typedef INT_PTR (CALLBACK
*FARPROC
)();
353 typedef INT_PTR (CALLBACK
*NEARPROC
)();
354 typedef INT_PTR (CALLBACK
*PROC
)();
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 */
371 #define max(a,b) (((a) > (b)) ? (a) : (b))
374 #define min(a,b) (((a) < (b)) ? (a) : (b))
376 #endif /* NOMINMAX */
378 #ifdef MAX_PATH /* Work-around for Mingw */
380 #endif /* MAX_PATH */
383 #define HFILE_ERROR ((HFILE)-1)
385 /* The SIZE structure */
386 typedef struct tagSIZE
390 } SIZE
, *PSIZE
, *LPSIZE
;
392 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
394 /* The POINT structure */
395 typedef struct tagPOINT
399 } POINT
, *PPOINT
, *LPPOINT
;
401 typedef struct _POINTL
407 /* The POINTS structure */
409 typedef struct tagPOINTS
411 #ifdef WORDS_BIGENDIAN
418 } POINTS
, *PPOINTS
, *LPPOINTS
;
420 typedef struct _FILETIME
{
421 #ifdef WORDS_BIGENDIAN
422 DWORD dwHighDateTime
;
426 DWORD dwHighDateTime
;
428 } FILETIME
, *PFILETIME
, *LPFILETIME
;
431 /* The RECT structure */
432 typedef struct tagRECT
438 } RECT
, *PRECT
, *LPRECT
;
439 typedef const RECT
*LPCRECT
;
441 typedef struct _RECTL
447 } RECTL
, *PRECTL
, *LPRECTL
;
449 typedef const RECTL
*LPCRECTL
;
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
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)
470 #endif /* _WINDEF_ */