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 # define __stdcall __attribute__((ms_abi))
70 # endif /* __i386__ */
71 #endif /* __stdcall */
74 # if defined(__i386__) && defined(__GNUC__)
75 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
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)
88 # if defined(__x86_64__) && defined (__GNUC__)
89 # define __ms_va_list __builtin_ms_va_list
90 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
91 # define __ms_va_end(list) __builtin_ms_va_end(list)
93 # define __ms_va_list va_list
94 # define __ms_va_start(list,arg) va_start(list,arg)
95 # define __ms_va_end(list) va_end(list)
100 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
102 #define __ONLY_IN_WINELIB(x) x
106 #define pascal __ONLY_IN_WINELIB(__stdcall)
109 #define _pascal __ONLY_IN_WINELIB(__stdcall)
112 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
115 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
118 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
121 #define __export __ONLY_IN_WINELIB(__stdcall)
124 #define cdecl __ONLY_IN_WINELIB(__cdecl)
127 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
131 #define near __ONLY_IN_WINELIB(/* nothing */)
134 #define far __ONLY_IN_WINELIB(/* nothing */)
137 #define _near __ONLY_IN_WINELIB(/* nothing */)
140 #define _far __ONLY_IN_WINELIB(/* nothing */)
143 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
146 #define FAR __ONLY_IN_WINELIB(/* nothing */)
151 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
154 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
159 # define inline __inline
162 #define CALLBACK __stdcall
163 #define WINAPI __stdcall
164 #define APIPRIVATE __stdcall
165 #define PASCAL __stdcall
166 #define CDECL __cdecl
167 #define _CDECL __cdecl
168 #define WINAPIV __cdecl
169 #define APIENTRY WINAPI
172 /* Misc. constants. */
178 #define NULL ((void*)0)
203 /* Standard data types */
205 typedef void *LPVOID;
206 typedef const void *LPCVOID;
207 typedef int BOOL, *PBOOL, *LPBOOL;
208 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
209 typedef unsigned char UCHAR, *PUCHAR;
210 typedef unsigned short WORD, *PWORD, *LPWORD;
211 typedef unsigned short USHORT, *PUSHORT;
212 typedef int INT, *PINT, *LPINT;
213 typedef unsigned int UINT, *PUINT;
214 typedef float FLOAT, *PFLOAT;
217 typedef long *LPLONG;
218 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
219 typedef unsigned long ULONG, *PULONG;
222 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
223 typedef unsigned int ULONG, *PULONG;
226 /* Macros to map Winelib names to the correct implementation name */
227 /* Note that Winelib is purely Win32. */
230 #define WINE_NO_UNICODE_MACROS 1
231 #define WINE_STRICT_PROTOTYPES 1
234 #ifdef WINE_NO_UNICODE_MACROS
235 # define WINELIB_NAME_AW(func) \
236 func##_must_be_suffixed_with_W_or_A_in_this_context \
237 func##_must_be_suffixed_with_W_or_A_in_this_context
238 #else /* WINE_NO_UNICODE_MACROS */
240 # define WINELIB_NAME_AW(func) func##W
242 # define WINELIB_NAME_AW(func) func##A
244 #endif /* WINE_NO_UNICODE_MACROS */
246 #ifdef WINE_NO_UNICODE_MACROS
247 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
249 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
254 /* Polymorphic types */
256 typedef UINT_PTR WPARAM;
257 typedef LONG_PTR LPARAM;
258 typedef LONG_PTR LRESULT;
263 typedef DWORD COLORREF, *LPCOLORREF;
269 DECLARE_HANDLE(HACCEL);
270 DECLARE_HANDLE(HBITMAP);
271 DECLARE_HANDLE(HBRUSH);
272 DECLARE_HANDLE(HCOLORSPACE);
274 DECLARE_HANDLE(HDESK);
275 DECLARE_HANDLE(HENHMETAFILE);
276 DECLARE_HANDLE(HFONT);
277 DECLARE_HANDLE(HGLRC);
278 DECLARE_HANDLE(HHOOK);
279 DECLARE_HANDLE(HICON);
280 DECLARE_HANDLE(HINSTANCE);
281 DECLARE_HANDLE(HKEY);
284 DECLARE_HANDLE(HMENU);
285 DECLARE_HANDLE(HMETAFILE);
286 DECLARE_HANDLE(HMONITOR);
287 DECLARE_HANDLE(HPALETTE);
288 DECLARE_HANDLE(HPEN);
289 DECLARE_HANDLE(HRGN);
290 DECLARE_HANDLE(HRSRC);
291 DECLARE_HANDLE(HTASK);
292 DECLARE_HANDLE(HWINEVENTHOOK);
293 DECLARE_HANDLE(HWINSTA);
294 DECLARE_HANDLE(HWND);
296 /* Handle types that must remain interchangeable even with strict on */
298 typedef HINSTANCE HMODULE;
299 typedef HANDLE HGDIOBJ;
300 typedef HANDLE HGLOBAL;
301 typedef HANDLE HLOCAL;
302 typedef HANDLE GLOBALHANDLE;
303 typedef HANDLE LOCALHANDLE;
304 typedef HICON HCURSOR;
306 /* Callback function pointers types */
308 #ifdef WINE_STRICT_PROTOTYPES
309 typedef INT_PTR (CALLBACK *FARPROC)(void);
310 typedef INT_PTR (CALLBACK *NEARPROC)(void);
311 typedef INT_PTR (CALLBACK *PROC)(void);
313 typedef INT_PTR (CALLBACK *FARPROC)();
314 typedef INT_PTR (CALLBACK *NEARPROC)();
315 typedef INT_PTR (CALLBACK *PROC)();
318 /* Macros to split words and longs. */
320 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
321 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
323 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
324 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
326 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
327 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
329 /* min and max macros */
332 #define max(a,b) (((a) > (b)) ? (a) : (b))
335 #define min(a,b) (((a) < (b)) ? (a) : (b))
337 #endif /* NOMINMAX */
339 #ifdef MAX_PATH /* Work-around for Mingw */
341 #endif /* MAX_PATH */
344 #define HFILE_ERROR ((HFILE)-1)
346 /* The SIZE structure */
347 typedef struct tagSIZE
351 } SIZE, *PSIZE, *LPSIZE;
353 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
355 /* The POINT structure */
356 typedef struct tagPOINT
360 } POINT, *PPOINT, *LPPOINT;
362 typedef struct _POINTL
368 /* The POINTS structure */
370 typedef struct tagPOINTS
372 #ifdef WORDS_BIGENDIAN
379 } POINTS, *PPOINTS, *LPPOINTS;
381 typedef struct _FILETIME {
382 #ifdef WORDS_BIGENDIAN
383 DWORD dwHighDateTime;
387 DWORD dwHighDateTime;
389 } FILETIME, *PFILETIME, *LPFILETIME;
392 /* The RECT structure */
393 typedef struct tagRECT
399 } RECT, *PRECT, *LPRECT;
400 typedef const RECT *LPCRECT;
402 typedef struct _RECTL
408 } RECTL, *PRECTL, *LPRECTL;
410 typedef const RECTL *LPCRECTL;
416 #endif /* _WINDEF_ */