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__)
57 #if !defined(_MSC_VER) && !defined(__stdcall)
60 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
61 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
63 # define __stdcall __attribute__((__stdcall__))
66 # error You need to define __stdcall for your compiler
68 # elif defined(__x86_64__) && defined (__GNUC__)
69 # if __has_attribute(__force_align_arg_pointer__)
70 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
72 # define __stdcall __attribute__((ms_abi))
74 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
75 # define __stdcall __attribute__((pcs("aapcs-vfp")))
76 # elif defined(__aarch64__) && defined (__GNUC__)
77 # define __stdcall __attribute__((ms_abi))
80 # endif /* __i386__ */
81 #endif /* __stdcall */
83 #if !defined(_MSC_VER) && !defined(__cdecl)
84 # if defined(__i386__) && defined(__GNUC__)
85 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
86 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
88 # define __cdecl __attribute__((__cdecl__))
90 # elif defined(__x86_64__) && defined (__GNUC__)
91 # if __has_attribute(__force_align_arg_pointer__)
92 # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
94 # define __cdecl __attribute__((ms_abi))
96 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
97 # define __cdecl __attribute__((pcs("aapcs-vfp")))
98 # elif defined(__aarch64__) && defined (__GNUC__)
99 # define __cdecl __attribute__((ms_abi))
105 #if !defined(_MSC_VER) && !defined(__fastcall)
106 # define __fastcall __stdcall
109 #if (!defined(_MSC_VER) || !defined(__clang__)) && !defined(__thiscall)
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
145 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
148 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
151 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
154 #define cdecl __ONLY_IN_WINELIB(__cdecl)
157 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
159 #endif /* _MSC_VER */
162 #define pascal __ONLY_IN_WINELIB(__stdcall)
165 #define _pascal __ONLY_IN_WINELIB(__stdcall)
168 #define __export __ONLY_IN_WINELIB(__stdcall)
171 #define near __ONLY_IN_WINELIB(/* nothing */)
174 #define far __ONLY_IN_WINELIB(/* nothing */)
177 #define _near __ONLY_IN_WINELIB(/* nothing */)
180 #define _far __ONLY_IN_WINELIB(/* nothing */)
183 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
186 #define FAR __ONLY_IN_WINELIB(/* nothing */)
191 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
194 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
199 # define inline __inline
202 #define CALLBACK __stdcall
203 #define WINAPI __stdcall
204 #define APIPRIVATE __stdcall
205 #define PASCAL __stdcall
206 #define CDECL __cdecl
207 #define _CDECL __cdecl
208 #define APIENTRY WINAPI
209 #define CONST __ONLY_IN_WINELIB(const)
211 /* Misc. constants. */
217 #define NULL ((void*)0)
242 /* Standard data types */
246 typedef unsigned char UCHAR
, *PUCHAR
;
247 typedef unsigned short USHORT
, *PUSHORT
;
249 typedef unsigned long ULONG
, *PULONG
;
251 typedef unsigned int ULONG
, *PULONG
;
255 typedef void *LPVOID
;
256 typedef const void *LPCVOID
;
257 typedef int BOOL
, *PBOOL
, *LPBOOL
;
258 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
259 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
260 typedef int INT
, *PINT
, *LPINT
;
261 typedef unsigned int UINT
, *PUINT
;
262 typedef float FLOAT
, *PFLOAT
;
265 typedef long *LPLONG
;
266 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
269 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
272 /* Macros to map Winelib names to the correct implementation name */
273 /* Note that Winelib is purely Win32. */
276 #define WINE_NO_UNICODE_MACROS 1
277 #define WINE_STRICT_PROTOTYPES 1
280 #ifdef WINE_NO_UNICODE_MACROS
281 # define WINELIB_NAME_AW(func) \
282 func##_must_be_suffixed_with_W_or_A_in_this_context \
283 func##_must_be_suffixed_with_W_or_A_in_this_context
284 #else /* WINE_NO_UNICODE_MACROS */
286 # define WINELIB_NAME_AW(func) func##W
288 # define WINELIB_NAME_AW(func) func##A
290 #endif /* WINE_NO_UNICODE_MACROS */
292 #ifdef WINE_NO_UNICODE_MACROS
293 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
295 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
300 /* Polymorphic types */
302 typedef UINT_PTR WPARAM
;
303 typedef LONG_PTR LPARAM
;
304 typedef LONG_PTR LRESULT
;
309 typedef DWORD COLORREF
, *LPCOLORREF
;
315 DECLARE_HANDLE(DPI_AWARENESS_CONTEXT
);
316 DECLARE_HANDLE(HACCEL
);
317 DECLARE_HANDLE(HBITMAP
);
318 DECLARE_HANDLE(HBRUSH
);
319 DECLARE_HANDLE(HCOLORSPACE
);
321 DECLARE_HANDLE(HDESK
);
322 DECLARE_HANDLE(HENHMETAFILE
);
323 DECLARE_HANDLE(HFONT
);
324 DECLARE_HANDLE(HGLRC
);
325 DECLARE_HANDLE(HHOOK
);
326 DECLARE_HANDLE(HICON
);
327 DECLARE_HANDLE(HINSTANCE
);
328 DECLARE_HANDLE(HKEY
);
331 DECLARE_HANDLE(HMENU
);
332 DECLARE_HANDLE(HMETAFILE
);
333 DECLARE_HANDLE(HMONITOR
);
334 DECLARE_HANDLE(HPALETTE
);
335 DECLARE_HANDLE(HPEN
);
336 DECLARE_HANDLE(HRGN
);
337 DECLARE_HANDLE(HRSRC
);
338 DECLARE_HANDLE(HTASK
);
339 DECLARE_HANDLE(HWINEVENTHOOK
);
340 DECLARE_HANDLE(HWINSTA
);
341 DECLARE_HANDLE(HWND
);
343 /* Handle types that must remain interchangeable even with strict on */
345 typedef HINSTANCE HMODULE
;
346 typedef HANDLE HGDIOBJ
;
347 typedef HANDLE HGLOBAL
;
348 typedef HANDLE HLOCAL
;
349 typedef HANDLE GLOBALHANDLE
;
350 typedef HANDLE LOCALHANDLE
;
351 typedef HICON HCURSOR
;
353 /* Callback function pointers types */
355 #ifdef WINE_STRICT_PROTOTYPES
356 typedef INT_PTR (CALLBACK
*FARPROC
)(void);
357 typedef INT_PTR (CALLBACK
*NEARPROC
)(void);
358 typedef INT_PTR (CALLBACK
*PROC
)(void);
360 typedef INT_PTR (CALLBACK
*FARPROC
)();
361 typedef INT_PTR (CALLBACK
*NEARPROC
)();
362 typedef INT_PTR (CALLBACK
*PROC
)();
365 /* Macros to split words and longs. */
367 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
368 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
370 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
371 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
373 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
374 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
376 /* min and max macros */
379 #define max(a,b) (((a) > (b)) ? (a) : (b))
382 #define min(a,b) (((a) < (b)) ? (a) : (b))
384 #endif /* NOMINMAX */
386 #ifdef MAX_PATH /* Work-around for Mingw */
388 #endif /* MAX_PATH */
391 #define HFILE_ERROR ((HFILE)-1)
393 /* The SIZE structure */
394 typedef struct tagSIZE
398 } SIZE
, *PSIZE
, *LPSIZE
;
400 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
402 /* The POINT structure */
403 typedef struct tagPOINT
407 } POINT
, *PPOINT
, *LPPOINT
;
409 typedef struct _POINTL
415 /* The POINTS structure */
417 typedef struct tagPOINTS
419 #ifdef WORDS_BIGENDIAN
426 } POINTS
, *PPOINTS
, *LPPOINTS
;
428 typedef struct _FILETIME
{
429 #ifdef WORDS_BIGENDIAN
430 DWORD dwHighDateTime
;
434 DWORD dwHighDateTime
;
436 } FILETIME
, *PFILETIME
, *LPFILETIME
;
439 /* The RECT structure */
440 typedef struct tagRECT
446 } RECT
, *PRECT
, *LPRECT
;
447 typedef const RECT
*LPCRECT
;
449 typedef struct _RECTL
455 } RECTL
, *PRECTL
, *LPRECTL
;
457 typedef const RECTL
*LPCRECTL
;
460 typedef enum DPI_AWARENESS
462 DPI_AWARENESS_INVALID
= -1,
463 DPI_AWARENESS_UNAWARE
= 0,
464 DPI_AWARENESS_SYSTEM_AWARE
,
465 DPI_AWARENESS_PER_MONITOR_AWARE
468 #define DPI_AWARENESS_CONTEXT_UNAWARE ((DPI_AWARENESS_CONTEXT)-1)
469 #define DPI_AWARENESS_CONTEXT_SYSTEM_AWARE ((DPI_AWARENESS_CONTEXT)-2)
470 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ((DPI_AWARENESS_CONTEXT)-3)
471 #define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
472 #define DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED ((DPI_AWARENESS_CONTEXT)-5)
478 #endif /* _WINDEF_ */