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__)
73 # define __stdcall __attribute__((pcs("aapcs-vfp")))
76 # endif /* __i386__ */
77 #endif /* __stdcall */
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__))
84 # define __cdecl __attribute__((__cdecl__))
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__))
90 # define __cdecl __attribute__((ms_abi))
92 # elif defined(__arm__) && defined (__GNUC__)
93 # define __cdecl __attribute__((pcs("aapcs-vfp")))
94 # elif !defined(_MSC_VER)
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)
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)
110 # define __ms_va_copy(dest,src) va_copy(dest,src)
112 # define __ms_va_copy(dest,src) ((dest) = (src))
117 #if defined(__arm__) && defined (__GNUC__)
118 # define WINAPIV __attribute__((pcs("aapcs")))
120 # define WINAPIV __cdecl
124 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
126 #define __ONLY_IN_WINELIB(x) x
130 #define pascal __ONLY_IN_WINELIB(__stdcall)
133 #define _pascal __ONLY_IN_WINELIB(__stdcall)
136 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
139 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
142 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
145 #define __export __ONLY_IN_WINELIB(__stdcall)
148 #define cdecl __ONLY_IN_WINELIB(__cdecl)
151 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
155 #define near __ONLY_IN_WINELIB(/* nothing */)
158 #define far __ONLY_IN_WINELIB(/* nothing */)
161 #define _near __ONLY_IN_WINELIB(/* nothing */)
164 #define _far __ONLY_IN_WINELIB(/* nothing */)
167 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
170 #define FAR __ONLY_IN_WINELIB(/* nothing */)
175 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
178 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
183 # define inline __inline
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. */
201 #define NULL ((void*)0)
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
;
240 typedef long *LPLONG
;
241 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
242 typedef unsigned long ULONG
, *PULONG
;
245 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
246 typedef unsigned int ULONG
, *PULONG
;
249 /* Macros to map Winelib names to the correct implementation name */
250 /* Note that Winelib is purely Win32. */
253 #define WINE_NO_UNICODE_MACROS 1
254 #define WINE_STRICT_PROTOTYPES 1
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 */
263 # define WINELIB_NAME_AW(func) func##W
265 # define WINELIB_NAME_AW(func) func##A
267 #endif /* WINE_NO_UNICODE_MACROS */
269 #ifdef WINE_NO_UNICODE_MACROS
270 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
272 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
277 /* Polymorphic types */
279 typedef UINT_PTR WPARAM
;
280 typedef LONG_PTR LPARAM
;
281 typedef LONG_PTR LRESULT
;
286 typedef DWORD COLORREF
, *LPCOLORREF
;
292 DECLARE_HANDLE(HACCEL
);
293 DECLARE_HANDLE(HBITMAP
);
294 DECLARE_HANDLE(HBRUSH
);
295 DECLARE_HANDLE(HCOLORSPACE
);
297 DECLARE_HANDLE(HDESK
);
298 DECLARE_HANDLE(HENHMETAFILE
);
299 DECLARE_HANDLE(HFONT
);
300 DECLARE_HANDLE(HGLRC
);
301 DECLARE_HANDLE(HHOOK
);
302 DECLARE_HANDLE(HICON
);
303 DECLARE_HANDLE(HINSTANCE
);
304 DECLARE_HANDLE(HKEY
);
307 DECLARE_HANDLE(HMENU
);
308 DECLARE_HANDLE(HMETAFILE
);
309 DECLARE_HANDLE(HMONITOR
);
310 DECLARE_HANDLE(HPALETTE
);
311 DECLARE_HANDLE(HPEN
);
312 DECLARE_HANDLE(HRGN
);
313 DECLARE_HANDLE(HRSRC
);
314 DECLARE_HANDLE(HTASK
);
315 DECLARE_HANDLE(HWINEVENTHOOK
);
316 DECLARE_HANDLE(HWINSTA
);
317 DECLARE_HANDLE(HWND
);
319 /* Handle types that must remain interchangeable even with strict on */
321 typedef HINSTANCE HMODULE
;
322 typedef HANDLE HGDIOBJ
;
323 typedef HANDLE HGLOBAL
;
324 typedef HANDLE HLOCAL
;
325 typedef HANDLE GLOBALHANDLE
;
326 typedef HANDLE LOCALHANDLE
;
327 typedef HICON HCURSOR
;
329 /* Callback function pointers types */
331 #ifdef WINE_STRICT_PROTOTYPES
332 typedef INT_PTR (CALLBACK
*FARPROC
)(void);
333 typedef INT_PTR (CALLBACK
*NEARPROC
)(void);
334 typedef INT_PTR (CALLBACK
*PROC
)(void);
336 typedef INT_PTR (CALLBACK
*FARPROC
)();
337 typedef INT_PTR (CALLBACK
*NEARPROC
)();
338 typedef INT_PTR (CALLBACK
*PROC
)();
341 /* Macros to split words and longs. */
343 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
344 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
346 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
347 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
349 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
350 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
352 /* min and max macros */
355 #define max(a,b) (((a) > (b)) ? (a) : (b))
358 #define min(a,b) (((a) < (b)) ? (a) : (b))
360 #endif /* NOMINMAX */
362 #ifdef MAX_PATH /* Work-around for Mingw */
364 #endif /* MAX_PATH */
367 #define HFILE_ERROR ((HFILE)-1)
369 /* The SIZE structure */
370 typedef struct tagSIZE
374 } SIZE
, *PSIZE
, *LPSIZE
;
376 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
378 /* The POINT structure */
379 typedef struct tagPOINT
383 } POINT
, *PPOINT
, *LPPOINT
;
385 typedef struct _POINTL
391 /* The POINTS structure */
393 typedef struct tagPOINTS
395 #ifdef WORDS_BIGENDIAN
402 } POINTS
, *PPOINTS
, *LPPOINTS
;
404 typedef struct _FILETIME
{
405 #ifdef WORDS_BIGENDIAN
406 DWORD dwHighDateTime
;
410 DWORD dwHighDateTime
;
412 } FILETIME
, *PFILETIME
, *LPFILETIME
;
415 /* The RECT structure */
416 typedef struct tagRECT
422 } RECT
, *PRECT
, *LPRECT
;
423 typedef const RECT
*LPCRECT
;
425 typedef struct _RECTL
431 } RECTL
, *PRECTL
, *LPRECTL
;
433 typedef const RECTL
*LPCRECTL
;
439 #endif /* _WINDEF_ */