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
67 # endif /* __i386__ */
68 #endif /* __stdcall */
71 # if defined(__i386__) && defined(__GNUC__)
72 # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
73 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
75 # define __cdecl __attribute__((__cdecl__))
77 # elif !defined(_MSC_VER)
83 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
85 #define __ONLY_IN_WINELIB(x) x
89 #define pascal __ONLY_IN_WINELIB(__stdcall)
92 #define _pascal __ONLY_IN_WINELIB(__stdcall)
95 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
98 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
101 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
104 #define __export __ONLY_IN_WINELIB(__stdcall)
107 #define cdecl __ONLY_IN_WINELIB(__cdecl)
110 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
114 #define near __ONLY_IN_WINELIB(/* nothing */)
117 #define far __ONLY_IN_WINELIB(/* nothing */)
120 #define _near __ONLY_IN_WINELIB(/* nothing */)
123 #define _far __ONLY_IN_WINELIB(/* nothing */)
126 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
129 #define FAR __ONLY_IN_WINELIB(/* nothing */)
134 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
137 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
142 # define inline __inline
145 #define CALLBACK __stdcall
146 #define WINAPI __stdcall
147 #define APIPRIVATE __stdcall
148 #define PASCAL __stdcall
149 #define CDECL __cdecl
150 #define _CDECL __cdecl
151 #define WINAPIV __cdecl
152 #define APIENTRY WINAPI
155 /* Misc. constants. */
161 #define NULL ((void*)0)
186 /* Standard data types */
188 typedef void *LPVOID
;
189 typedef const void *LPCVOID
;
190 typedef int BOOL
, *PBOOL
, *LPBOOL
;
191 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
192 typedef unsigned char UCHAR
, *PUCHAR
;
193 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
194 typedef unsigned short USHORT
, *PUSHORT
;
195 typedef int INT
, *PINT
, *LPINT
;
196 typedef unsigned int UINT
, *PUINT
;
197 typedef float FLOAT
, *PFLOAT
;
200 typedef long *LPLONG
;
201 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
202 typedef unsigned long ULONG
, *PULONG
;
205 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
206 typedef unsigned int ULONG
, *PULONG
;
209 /* Macros to map Winelib names to the correct implementation name */
210 /* Note that Winelib is purely Win32. */
213 #define WINE_NO_UNICODE_MACROS
216 #ifdef WINE_NO_UNICODE_MACROS
217 # define WINELIB_NAME_AW(func) \
218 func##_must_be_suffixed_with_W_or_A_in_this_context \
219 func##_must_be_suffixed_with_W_or_A_in_this_context
220 #else /* WINE_NO_UNICODE_MACROS */
222 # define WINELIB_NAME_AW(func) func##W
224 # define WINELIB_NAME_AW(func) func##A
226 #endif /* WINE_NO_UNICODE_MACROS */
228 #ifdef WINE_NO_UNICODE_MACROS
229 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
231 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
236 /* Polymorphic types */
238 typedef UINT_PTR WPARAM
;
239 typedef LONG_PTR LPARAM
;
240 typedef LONG_PTR LRESULT
;
245 typedef DWORD COLORREF
, *LPCOLORREF
;
251 DECLARE_HANDLE(HACCEL
);
252 DECLARE_HANDLE(HBITMAP
);
253 DECLARE_HANDLE(HBRUSH
);
254 DECLARE_HANDLE(HCOLORSPACE
);
256 DECLARE_HANDLE(HDESK
);
257 DECLARE_HANDLE(HENHMETAFILE
);
258 DECLARE_HANDLE(HFONT
);
259 DECLARE_HANDLE(HGLRC
);
260 DECLARE_HANDLE(HHOOK
);
261 DECLARE_HANDLE(HICON
);
262 DECLARE_HANDLE(HINSTANCE
);
263 DECLARE_HANDLE(HKEY
);
266 DECLARE_HANDLE(HMENU
);
267 DECLARE_HANDLE(HMETAFILE
);
268 DECLARE_HANDLE(HMONITOR
);
269 DECLARE_HANDLE(HPALETTE
);
270 DECLARE_HANDLE(HPEN
);
271 DECLARE_HANDLE(HRGN
);
272 DECLARE_HANDLE(HRSRC
);
273 DECLARE_HANDLE(HTASK
);
274 DECLARE_HANDLE(HWINEVENTHOOK
);
275 DECLARE_HANDLE(HWINSTA
);
276 DECLARE_HANDLE(HWND
);
278 /* Handle types that must remain interchangeable even with strict on */
280 typedef HINSTANCE HMODULE
;
281 typedef HANDLE HGDIOBJ
;
282 typedef HANDLE HGLOBAL
;
283 typedef HANDLE HLOCAL
;
284 typedef HANDLE GLOBALHANDLE
;
285 typedef HANDLE LOCALHANDLE
;
286 typedef HICON HCURSOR
;
288 /* Callback function pointers types */
290 typedef INT_PTR (CALLBACK
*FARPROC
)();
291 typedef INT_PTR (CALLBACK
*NEARPROC
)();
292 typedef INT_PTR (CALLBACK
*PROC
)();
295 /* Macros to split words and longs. */
297 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
298 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
300 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
301 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
303 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
304 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
306 /* min and max macros */
309 #define max(a,b) (((a) > (b)) ? (a) : (b))
312 #define min(a,b) (((a) < (b)) ? (a) : (b))
314 #endif /* NOMINMAX */
316 #ifdef MAX_PATH /* Work-around for Mingw */
318 #endif /* MAX_PATH */
321 #define HFILE_ERROR ((HFILE)-1)
323 /* The SIZE structure */
324 typedef struct tagSIZE
328 } SIZE
, *PSIZE
, *LPSIZE
;
330 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
332 /* The POINT structure */
333 typedef struct tagPOINT
337 } POINT
, *PPOINT
, *LPPOINT
;
339 typedef struct _POINTL
345 /* The POINTS structure */
347 typedef struct tagPOINTS
349 #ifdef WORDS_BIGENDIAN
356 } POINTS
, *PPOINTS
, *LPPOINTS
;
358 typedef struct _FILETIME
{
359 #ifdef WORDS_BIGENDIAN
360 DWORD dwHighDateTime
;
364 DWORD dwHighDateTime
;
366 } FILETIME
, *PFILETIME
, *LPFILETIME
;
369 /* The RECT structure */
370 typedef struct tagRECT
376 } RECT
, *PRECT
, *LPRECT
;
377 typedef const RECT
*LPCRECT
;
379 typedef struct _RECTL
385 } RECTL
, *PRECTL
, *LPRECTL
;
387 typedef const RECTL
*LPCRECTL
;
393 #endif /* _WINDEF_ */