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(__i386__) && !defined(_X86_)
44 #if defined(_X86_) && !defined(__i386__)
48 #if defined(__x86_64__) && !defined(_WIN64)
55 # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
56 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
58 # define __stdcall __attribute__((__stdcall__))
60 # elif defined(_MSC_VER)
61 /* Nothing needs to be done. __stdcall already exists */
63 # error You need to define __stdcall for your compiler
65 # elif defined(__x86_64__) && defined (__GNUC__)
66 # define __stdcall __attribute__((ms_abi))
69 # endif /* __i386__ */
70 #endif /* __stdcall */
73 # if defined(__i386__) && defined(__GNUC__)
74 # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
75 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
77 # define __cdecl __attribute__((__cdecl__))
79 # elif defined(__x86_64__) && defined (__GNUC__)
80 # define __cdecl __attribute__((ms_abi))
81 # elif !defined(_MSC_VER)
87 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
89 #define __ONLY_IN_WINELIB(x) x
93 #define pascal __ONLY_IN_WINELIB(__stdcall)
96 #define _pascal __ONLY_IN_WINELIB(__stdcall)
99 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
102 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
105 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
108 #define __export __ONLY_IN_WINELIB(__stdcall)
111 #define cdecl __ONLY_IN_WINELIB(__cdecl)
114 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
118 #define near __ONLY_IN_WINELIB(/* nothing */)
121 #define far __ONLY_IN_WINELIB(/* nothing */)
124 #define _near __ONLY_IN_WINELIB(/* nothing */)
127 #define _far __ONLY_IN_WINELIB(/* nothing */)
130 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
133 #define FAR __ONLY_IN_WINELIB(/* nothing */)
138 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
141 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
146 # define inline __inline
149 #define CALLBACK __stdcall
150 #define WINAPI __stdcall
151 #define APIPRIVATE __stdcall
152 #define PASCAL __stdcall
153 #define CDECL __cdecl
154 #define _CDECL __cdecl
155 #define WINAPIV __cdecl
156 #define APIENTRY WINAPI
159 /* Misc. constants. */
165 #define NULL ((void*)0)
190 /* Standard data types */
192 typedef void *LPVOID
;
193 typedef const void *LPCVOID
;
194 typedef int BOOL
, *PBOOL
, *LPBOOL
;
195 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
196 typedef unsigned char UCHAR
, *PUCHAR
;
197 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
198 typedef unsigned short USHORT
, *PUSHORT
;
199 typedef int INT
, *PINT
, *LPINT
;
200 typedef unsigned int UINT
, *PUINT
;
201 typedef float FLOAT
, *PFLOAT
;
204 typedef long *LPLONG
;
205 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
206 typedef unsigned long ULONG
, *PULONG
;
209 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
210 typedef unsigned int ULONG
, *PULONG
;
213 /* Macros to map Winelib names to the correct implementation name */
214 /* Note that Winelib is purely Win32. */
217 #define WINE_NO_UNICODE_MACROS
220 #ifdef WINE_NO_UNICODE_MACROS
221 # define WINELIB_NAME_AW(func) \
222 func##_must_be_suffixed_with_W_or_A_in_this_context \
223 func##_must_be_suffixed_with_W_or_A_in_this_context
224 #else /* WINE_NO_UNICODE_MACROS */
226 # define WINELIB_NAME_AW(func) func##W
228 # define WINELIB_NAME_AW(func) func##A
230 #endif /* WINE_NO_UNICODE_MACROS */
232 #ifdef WINE_NO_UNICODE_MACROS
233 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
235 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
240 /* Polymorphic types */
242 typedef UINT_PTR WPARAM
;
243 typedef LONG_PTR LPARAM
;
244 typedef LONG_PTR LRESULT
;
249 typedef DWORD COLORREF
, *LPCOLORREF
;
255 DECLARE_HANDLE(HACCEL
);
256 DECLARE_HANDLE(HBITMAP
);
257 DECLARE_HANDLE(HBRUSH
);
258 DECLARE_HANDLE(HCOLORSPACE
);
260 DECLARE_HANDLE(HDESK
);
261 DECLARE_HANDLE(HENHMETAFILE
);
262 DECLARE_HANDLE(HFONT
);
263 DECLARE_HANDLE(HGLRC
);
264 DECLARE_HANDLE(HHOOK
);
265 DECLARE_HANDLE(HICON
);
266 DECLARE_HANDLE(HINSTANCE
);
267 DECLARE_HANDLE(HKEY
);
270 DECLARE_HANDLE(HMENU
);
271 DECLARE_HANDLE(HMETAFILE
);
272 DECLARE_HANDLE(HMONITOR
);
273 DECLARE_HANDLE(HPALETTE
);
274 DECLARE_HANDLE(HPEN
);
275 DECLARE_HANDLE(HRGN
);
276 DECLARE_HANDLE(HRSRC
);
277 DECLARE_HANDLE(HTASK
);
278 DECLARE_HANDLE(HWINEVENTHOOK
);
279 DECLARE_HANDLE(HWINSTA
);
280 DECLARE_HANDLE(HWND
);
282 /* Handle types that must remain interchangeable even with strict on */
284 typedef HINSTANCE HMODULE
;
285 typedef HANDLE HGDIOBJ
;
286 typedef HANDLE HGLOBAL
;
287 typedef HANDLE HLOCAL
;
288 typedef HANDLE GLOBALHANDLE
;
289 typedef HANDLE LOCALHANDLE
;
290 typedef HICON HCURSOR
;
292 /* Callback function pointers types */
294 typedef INT_PTR (CALLBACK
*FARPROC
)();
295 typedef INT_PTR (CALLBACK
*NEARPROC
)();
296 typedef INT_PTR (CALLBACK
*PROC
)();
299 /* Macros to split words and longs. */
301 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
302 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
304 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
305 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
307 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
308 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
310 /* min and max macros */
313 #define max(a,b) (((a) > (b)) ? (a) : (b))
316 #define min(a,b) (((a) < (b)) ? (a) : (b))
318 #endif /* NOMINMAX */
320 #ifdef MAX_PATH /* Work-around for Mingw */
322 #endif /* MAX_PATH */
325 #define HFILE_ERROR ((HFILE)-1)
327 /* The SIZE structure */
328 typedef struct tagSIZE
332 } SIZE
, *PSIZE
, *LPSIZE
;
334 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
336 /* The POINT structure */
337 typedef struct tagPOINT
341 } POINT
, *PPOINT
, *LPPOINT
;
343 typedef struct _POINTL
349 /* The POINTS structure */
351 typedef struct tagPOINTS
353 #ifdef WORDS_BIGENDIAN
360 } POINTS
, *PPOINTS
, *LPPOINTS
;
362 typedef struct _FILETIME
{
363 #ifdef WORDS_BIGENDIAN
364 DWORD dwHighDateTime
;
368 DWORD dwHighDateTime
;
370 } FILETIME
, *PFILETIME
, *LPFILETIME
;
373 /* The RECT structure */
374 typedef struct tagRECT
380 } RECT
, *PRECT
, *LPRECT
;
381 typedef const RECT
*LPCRECT
;
383 typedef struct _RECTL
389 } RECTL
, *PRECTL
, *LPRECTL
;
391 typedef const RECTL
*LPCRECTL
;
397 #endif /* _WINDEF_ */