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)
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
233 #ifdef WINE_NO_UNICODE_MACROS
234 # define WINELIB_NAME_AW(func) \
235 func##_must_be_suffixed_with_W_or_A_in_this_context \
236 func##_must_be_suffixed_with_W_or_A_in_this_context
237 #else /* WINE_NO_UNICODE_MACROS */
239 # define WINELIB_NAME_AW(func) func##W
241 # define WINELIB_NAME_AW(func) func##A
243 #endif /* WINE_NO_UNICODE_MACROS */
245 #ifdef WINE_NO_UNICODE_MACROS
246 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
248 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
253 /* Polymorphic types */
255 typedef UINT_PTR WPARAM
;
256 typedef LONG_PTR LPARAM
;
257 typedef LONG_PTR LRESULT
;
262 typedef DWORD COLORREF
, *LPCOLORREF
;
268 DECLARE_HANDLE(HACCEL
);
269 DECLARE_HANDLE(HBITMAP
);
270 DECLARE_HANDLE(HBRUSH
);
271 DECLARE_HANDLE(HCOLORSPACE
);
273 DECLARE_HANDLE(HDESK
);
274 DECLARE_HANDLE(HENHMETAFILE
);
275 DECLARE_HANDLE(HFONT
);
276 DECLARE_HANDLE(HGLRC
);
277 DECLARE_HANDLE(HHOOK
);
278 DECLARE_HANDLE(HICON
);
279 DECLARE_HANDLE(HINSTANCE
);
280 DECLARE_HANDLE(HKEY
);
283 DECLARE_HANDLE(HMENU
);
284 DECLARE_HANDLE(HMETAFILE
);
285 DECLARE_HANDLE(HMONITOR
);
286 DECLARE_HANDLE(HPALETTE
);
287 DECLARE_HANDLE(HPEN
);
288 DECLARE_HANDLE(HRGN
);
289 DECLARE_HANDLE(HRSRC
);
290 DECLARE_HANDLE(HTASK
);
291 DECLARE_HANDLE(HWINEVENTHOOK
);
292 DECLARE_HANDLE(HWINSTA
);
293 DECLARE_HANDLE(HWND
);
295 /* Handle types that must remain interchangeable even with strict on */
297 typedef HINSTANCE HMODULE
;
298 typedef HANDLE HGDIOBJ
;
299 typedef HANDLE HGLOBAL
;
300 typedef HANDLE HLOCAL
;
301 typedef HANDLE GLOBALHANDLE
;
302 typedef HANDLE LOCALHANDLE
;
303 typedef HICON HCURSOR
;
305 /* Callback function pointers types */
307 typedef INT_PTR (CALLBACK
*FARPROC
)();
308 typedef INT_PTR (CALLBACK
*NEARPROC
)();
309 typedef INT_PTR (CALLBACK
*PROC
)();
312 /* Macros to split words and longs. */
314 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
315 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
317 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
318 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
320 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
321 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
323 /* min and max macros */
326 #define max(a,b) (((a) > (b)) ? (a) : (b))
329 #define min(a,b) (((a) < (b)) ? (a) : (b))
331 #endif /* NOMINMAX */
333 #ifdef MAX_PATH /* Work-around for Mingw */
335 #endif /* MAX_PATH */
338 #define HFILE_ERROR ((HFILE)-1)
340 /* The SIZE structure */
341 typedef struct tagSIZE
345 } SIZE
, *PSIZE
, *LPSIZE
;
347 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
349 /* The POINT structure */
350 typedef struct tagPOINT
354 } POINT
, *PPOINT
, *LPPOINT
;
356 typedef struct _POINTL
362 /* The POINTS structure */
364 typedef struct tagPOINTS
366 #ifdef WORDS_BIGENDIAN
373 } POINTS
, *PPOINTS
, *LPPOINTS
;
375 typedef struct _FILETIME
{
376 #ifdef WORDS_BIGENDIAN
377 DWORD dwHighDateTime
;
381 DWORD dwHighDateTime
;
383 } FILETIME
, *PFILETIME
, *LPFILETIME
;
386 /* The RECT structure */
387 typedef struct tagRECT
393 } RECT
, *PRECT
, *LPRECT
;
394 typedef const RECT
*LPCRECT
;
396 typedef struct _RECTL
402 } RECTL
, *PRECTL
, *LPRECTL
;
404 typedef const RECTL
*LPCRECTL
;
410 #endif /* _WINDEF_ */