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(_WIN64)
45 # if defined(__i386__) && !defined(_X86_)
48 # if defined(_X86_) && !defined(__i386__)
56 # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
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 # define __stdcall __attribute__((ms_abi))
70 # endif /* __i386__ */
71 #endif /* __stdcall */
74 # if defined(__i386__) && defined(__GNUC__)
75 # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
76 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
78 # define __cdecl __attribute__((__cdecl__))
80 # elif defined(__x86_64__) && defined (__GNUC__)
81 # define __cdecl __attribute__((ms_abi))
82 # elif !defined(_MSC_VER)
87 #if defined(__x86_64__) && defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))) && !defined(__MINGW64__)
88 /* redefine va_XXX to be compatible only with ms calling convention
89 * Note: This means all variadic functions in wine will have to have the ms calling convention too,
90 * including the functions in wine/debug.h
92 /* Include first to avoid conflicts */
95 #define ms_va_list __builtin_ms_va_list
96 /* va_arg is same for ms and sysv */
97 #define ms_va_arg __builtin_va_arg
98 #define ms_va_start __builtin_ms_va_start
99 #define ms_va_copy __builtin_ms_va_copy
100 #define ms_va_end __builtin_ms_va_end
101 #elif !defined(RC_INVOKED)
102 /* Include first to avoid conflicts */
105 #define ms_va_list va_list
106 #define ms_va_arg va_arg
107 #define ms_va_start va_start
108 #define ms_va_copy va_copy
109 #define ms_va_end va_end
113 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
115 #define __ONLY_IN_WINELIB(x) x
119 #define pascal __ONLY_IN_WINELIB(__stdcall)
122 #define _pascal __ONLY_IN_WINELIB(__stdcall)
125 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
128 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
131 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
134 #define __export __ONLY_IN_WINELIB(__stdcall)
137 #define cdecl __ONLY_IN_WINELIB(__cdecl)
140 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
144 #define near __ONLY_IN_WINELIB(/* nothing */)
147 #define far __ONLY_IN_WINELIB(/* nothing */)
150 #define _near __ONLY_IN_WINELIB(/* nothing */)
153 #define _far __ONLY_IN_WINELIB(/* nothing */)
156 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
159 #define FAR __ONLY_IN_WINELIB(/* nothing */)
164 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
167 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
172 # define inline __inline
175 #define CALLBACK __stdcall
176 #define WINAPI __stdcall
177 #define APIPRIVATE __stdcall
178 #define PASCAL __stdcall
179 #define CDECL __cdecl
180 #define _CDECL __cdecl
181 #define WINAPIV __cdecl
182 #define APIENTRY WINAPI
185 /* Misc. constants. */
191 #define NULL ((void*)0)
216 /* Standard data types */
218 typedef void *LPVOID
;
219 typedef const void *LPCVOID
;
220 typedef int BOOL
, *PBOOL
, *LPBOOL
;
221 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
222 typedef unsigned char UCHAR
, *PUCHAR
;
223 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
224 typedef unsigned short USHORT
, *PUSHORT
;
225 typedef int INT
, *PINT
, *LPINT
;
226 typedef unsigned int UINT
, *PUINT
;
227 typedef float FLOAT
, *PFLOAT
;
230 typedef long *LPLONG
;
231 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
232 typedef unsigned long ULONG
, *PULONG
;
235 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
236 typedef unsigned int ULONG
, *PULONG
;
239 /* Macros to map Winelib names to the correct implementation name */
240 /* Note that Winelib is purely Win32. */
243 #define WINE_NO_UNICODE_MACROS
246 #ifdef WINE_NO_UNICODE_MACROS
247 # define WINELIB_NAME_AW(func) \
248 func##_must_be_suffixed_with_W_or_A_in_this_context \
249 func##_must_be_suffixed_with_W_or_A_in_this_context
250 #else /* WINE_NO_UNICODE_MACROS */
252 # define WINELIB_NAME_AW(func) func##W
254 # define WINELIB_NAME_AW(func) func##A
256 #endif /* WINE_NO_UNICODE_MACROS */
258 #ifdef WINE_NO_UNICODE_MACROS
259 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
261 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
266 /* Polymorphic types */
268 typedef UINT_PTR WPARAM
;
269 typedef LONG_PTR LPARAM
;
270 typedef LONG_PTR LRESULT
;
275 typedef DWORD COLORREF
, *LPCOLORREF
;
281 DECLARE_HANDLE(HACCEL
);
282 DECLARE_HANDLE(HBITMAP
);
283 DECLARE_HANDLE(HBRUSH
);
284 DECLARE_HANDLE(HCOLORSPACE
);
286 DECLARE_HANDLE(HDESK
);
287 DECLARE_HANDLE(HENHMETAFILE
);
288 DECLARE_HANDLE(HFONT
);
289 DECLARE_HANDLE(HGLRC
);
290 DECLARE_HANDLE(HHOOK
);
291 DECLARE_HANDLE(HICON
);
292 DECLARE_HANDLE(HINSTANCE
);
293 DECLARE_HANDLE(HKEY
);
296 DECLARE_HANDLE(HMENU
);
297 DECLARE_HANDLE(HMETAFILE
);
298 DECLARE_HANDLE(HMONITOR
);
299 DECLARE_HANDLE(HPALETTE
);
300 DECLARE_HANDLE(HPEN
);
301 DECLARE_HANDLE(HRGN
);
302 DECLARE_HANDLE(HRSRC
);
303 DECLARE_HANDLE(HTASK
);
304 DECLARE_HANDLE(HWINEVENTHOOK
);
305 DECLARE_HANDLE(HWINSTA
);
306 DECLARE_HANDLE(HWND
);
308 /* Handle types that must remain interchangeable even with strict on */
310 typedef HINSTANCE HMODULE
;
311 typedef HANDLE HGDIOBJ
;
312 typedef HANDLE HGLOBAL
;
313 typedef HANDLE HLOCAL
;
314 typedef HANDLE GLOBALHANDLE
;
315 typedef HANDLE LOCALHANDLE
;
316 typedef HICON HCURSOR
;
318 /* Callback function pointers types */
320 typedef INT_PTR (CALLBACK
*FARPROC
)();
321 typedef INT_PTR (CALLBACK
*NEARPROC
)();
322 typedef INT_PTR (CALLBACK
*PROC
)();
325 /* Macros to split words and longs. */
327 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
328 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
330 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
331 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
333 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
334 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
336 /* min and max macros */
339 #define max(a,b) (((a) > (b)) ? (a) : (b))
342 #define min(a,b) (((a) < (b)) ? (a) : (b))
344 #endif /* NOMINMAX */
346 #ifdef MAX_PATH /* Work-around for Mingw */
348 #endif /* MAX_PATH */
351 #define HFILE_ERROR ((HFILE)-1)
353 /* The SIZE structure */
354 typedef struct tagSIZE
358 } SIZE
, *PSIZE
, *LPSIZE
;
360 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
362 /* The POINT structure */
363 typedef struct tagPOINT
367 } POINT
, *PPOINT
, *LPPOINT
;
369 typedef struct _POINTL
375 /* The POINTS structure */
377 typedef struct tagPOINTS
379 #ifdef WORDS_BIGENDIAN
386 } POINTS
, *PPOINTS
, *LPPOINTS
;
388 typedef struct _FILETIME
{
389 #ifdef WORDS_BIGENDIAN
390 DWORD dwHighDateTime
;
394 DWORD dwHighDateTime
;
396 } FILETIME
, *PFILETIME
, *LPFILETIME
;
399 /* The RECT structure */
400 typedef struct tagRECT
406 } RECT
, *PRECT
, *LPRECT
;
407 typedef const RECT
*LPCRECT
;
409 typedef struct _RECTL
415 } RECTL
, *PRECTL
, *LPRECTL
;
417 typedef const RECTL
*LPCRECTL
;
423 #endif /* _WINDEF_ */