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(__sparc64__) || 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))
74 # endif /* __i386__ */
75 #endif /* __stdcall */
78 # if defined(__i386__) && defined(__GNUC__)
79 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
80 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
82 # define __cdecl __attribute__((__cdecl__))
84 # elif defined(__x86_64__) && defined (__GNUC__)
85 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
86 # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
88 # define __cdecl __attribute__((ms_abi))
90 # elif !defined(_MSC_VER)
96 # if defined(__x86_64__) && defined (__GNUC__)
97 # define __ms_va_list __builtin_ms_va_list
98 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
99 # define __ms_va_end(list) __builtin_ms_va_end(list)
100 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
102 # define __ms_va_list va_list
103 # define __ms_va_start(list,arg) va_start(list,arg)
104 # define __ms_va_end(list) va_end(list)
106 # define __ms_va_copy(dest,src) va_copy(dest,src)
108 # define __ms_va_copy(dest,src) ((dest) = (src))
114 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
116 #define __ONLY_IN_WINELIB(x) x
120 #define pascal __ONLY_IN_WINELIB(__stdcall)
123 #define _pascal __ONLY_IN_WINELIB(__stdcall)
126 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
129 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
132 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
135 #define __export __ONLY_IN_WINELIB(__stdcall)
138 #define cdecl __ONLY_IN_WINELIB(__cdecl)
141 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
145 #define near __ONLY_IN_WINELIB(/* nothing */)
148 #define far __ONLY_IN_WINELIB(/* nothing */)
151 #define _near __ONLY_IN_WINELIB(/* nothing */)
154 #define _far __ONLY_IN_WINELIB(/* nothing */)
157 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
160 #define FAR __ONLY_IN_WINELIB(/* nothing */)
165 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
168 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
173 # define inline __inline
176 #define CALLBACK __stdcall
177 #define WINAPI __stdcall
178 #define APIPRIVATE __stdcall
179 #define PASCAL __stdcall
180 #define CDECL __cdecl
181 #define _CDECL __cdecl
182 #define WINAPIV __cdecl
183 #define APIENTRY WINAPI
184 #define CONST __ONLY_IN_WINELIB(const)
186 /* Misc. constants. */
192 #define NULL ((void*)0)
217 /* Standard data types */
219 typedef void *LPVOID
;
220 typedef const void *LPCVOID
;
221 typedef int BOOL
, *PBOOL
, *LPBOOL
;
222 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
223 typedef unsigned char UCHAR
, *PUCHAR
;
224 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
225 typedef unsigned short USHORT
, *PUSHORT
;
226 typedef int INT
, *PINT
, *LPINT
;
227 typedef unsigned int UINT
, *PUINT
;
228 typedef float FLOAT
, *PFLOAT
;
231 typedef long *LPLONG
;
232 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
233 typedef unsigned long ULONG
, *PULONG
;
236 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
237 typedef unsigned int ULONG
, *PULONG
;
240 /* Macros to map Winelib names to the correct implementation name */
241 /* Note that Winelib is purely Win32. */
244 #define WINE_NO_UNICODE_MACROS 1
245 #define WINE_STRICT_PROTOTYPES 1
248 #ifdef WINE_NO_UNICODE_MACROS
249 # define WINELIB_NAME_AW(func) \
250 func##_must_be_suffixed_with_W_or_A_in_this_context \
251 func##_must_be_suffixed_with_W_or_A_in_this_context
252 #else /* WINE_NO_UNICODE_MACROS */
254 # define WINELIB_NAME_AW(func) func##W
256 # define WINELIB_NAME_AW(func) func##A
258 #endif /* WINE_NO_UNICODE_MACROS */
260 #ifdef WINE_NO_UNICODE_MACROS
261 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
263 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
268 /* Polymorphic types */
270 typedef UINT_PTR WPARAM
;
271 typedef LONG_PTR LPARAM
;
272 typedef LONG_PTR LRESULT
;
277 typedef DWORD COLORREF
, *LPCOLORREF
;
283 DECLARE_HANDLE(HACCEL
);
284 DECLARE_HANDLE(HBITMAP
);
285 DECLARE_HANDLE(HBRUSH
);
286 DECLARE_HANDLE(HCOLORSPACE
);
288 DECLARE_HANDLE(HDESK
);
289 DECLARE_HANDLE(HENHMETAFILE
);
290 DECLARE_HANDLE(HFONT
);
291 DECLARE_HANDLE(HGLRC
);
292 DECLARE_HANDLE(HHOOK
);
293 DECLARE_HANDLE(HICON
);
294 DECLARE_HANDLE(HINSTANCE
);
295 DECLARE_HANDLE(HKEY
);
298 DECLARE_HANDLE(HMENU
);
299 DECLARE_HANDLE(HMETAFILE
);
300 DECLARE_HANDLE(HMONITOR
);
301 DECLARE_HANDLE(HPALETTE
);
302 DECLARE_HANDLE(HPEN
);
303 DECLARE_HANDLE(HRGN
);
304 DECLARE_HANDLE(HRSRC
);
305 DECLARE_HANDLE(HTASK
);
306 DECLARE_HANDLE(HWINEVENTHOOK
);
307 DECLARE_HANDLE(HWINSTA
);
308 DECLARE_HANDLE(HWND
);
310 /* Handle types that must remain interchangeable even with strict on */
312 typedef HINSTANCE HMODULE
;
313 typedef HANDLE HGDIOBJ
;
314 typedef HANDLE HGLOBAL
;
315 typedef HANDLE HLOCAL
;
316 typedef HANDLE GLOBALHANDLE
;
317 typedef HANDLE LOCALHANDLE
;
318 typedef HICON HCURSOR
;
320 /* Callback function pointers types */
322 #ifdef WINE_STRICT_PROTOTYPES
323 typedef INT_PTR (CALLBACK
*FARPROC
)(void);
324 typedef INT_PTR (CALLBACK
*NEARPROC
)(void);
325 typedef INT_PTR (CALLBACK
*PROC
)(void);
327 typedef INT_PTR (CALLBACK
*FARPROC
)();
328 typedef INT_PTR (CALLBACK
*NEARPROC
)();
329 typedef INT_PTR (CALLBACK
*PROC
)();
332 /* Macros to split words and longs. */
334 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
335 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
337 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
338 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
340 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
341 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
343 /* min and max macros */
346 #define max(a,b) (((a) > (b)) ? (a) : (b))
349 #define min(a,b) (((a) < (b)) ? (a) : (b))
351 #endif /* NOMINMAX */
353 #ifdef MAX_PATH /* Work-around for Mingw */
355 #endif /* MAX_PATH */
358 #define HFILE_ERROR ((HFILE)-1)
360 /* The SIZE structure */
361 typedef struct tagSIZE
365 } SIZE
, *PSIZE
, *LPSIZE
;
367 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
369 /* The POINT structure */
370 typedef struct tagPOINT
374 } POINT
, *PPOINT
, *LPPOINT
;
376 typedef struct _POINTL
382 /* The POINTS structure */
384 typedef struct tagPOINTS
386 #ifdef WORDS_BIGENDIAN
393 } POINTS
, *PPOINTS
, *LPPOINTS
;
395 typedef struct _FILETIME
{
396 #ifdef WORDS_BIGENDIAN
397 DWORD dwHighDateTime
;
401 DWORD dwHighDateTime
;
403 } FILETIME
, *PFILETIME
, *LPFILETIME
;
406 /* The RECT structure */
407 typedef struct tagRECT
413 } RECT
, *PRECT
, *LPRECT
;
414 typedef const RECT
*LPCRECT
;
416 typedef struct _RECTL
422 } RECTL
, *PRECTL
, *LPRECTL
;
424 typedef const RECTL
*LPCRECTL
;
430 #endif /* _WINDEF_ */