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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #endif /* NO_STRICT */
38 /* Calling conventions definitions */
40 #if defined(__i386__) && !defined(_X86_)
44 #if defined(_X86_) && !defined(__i386__)
55 # define __stdcall __attribute__((__stdcall__))
56 # elif defined(_MSC_VER)
57 /* Nothing needs to be done. __stdcall already exists */
59 # error You need to define __stdcall for your compiler
63 # endif /* __i386__ */
64 #endif /* __stdcall */
67 # if defined(__i386__) && defined(__GNUC__)
68 # define __cdecl __attribute__((__cdecl__))
69 # elif !defined(_MSC_VER)
75 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
77 #define __ONLY_IN_WINELIB(x) x
81 #define pascal __ONLY_IN_WINELIB(__stdcall)
84 #define _pascal __ONLY_IN_WINELIB(__stdcall)
87 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
90 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
93 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
96 #define __export __ONLY_IN_WINELIB(__stdcall)
99 #define cdecl __ONLY_IN_WINELIB(__cdecl)
102 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
106 #define near __ONLY_IN_WINELIB(/* nothing */)
109 #define far __ONLY_IN_WINELIB(/* nothing */)
112 #define _near __ONLY_IN_WINELIB(/* nothing */)
115 #define _far __ONLY_IN_WINELIB(/* nothing */)
118 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
121 #define FAR __ONLY_IN_WINELIB(/* nothing */)
126 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
129 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
134 # define inline __inline
137 #define CALLBACK __stdcall
138 #define WINAPI __stdcall
139 #define APIPRIVATE __stdcall
140 #define PASCAL __stdcall
141 #define CDECL __cdecl
142 #define _CDECL __cdecl
143 #define WINAPIV __cdecl
144 #define APIENTRY WINAPI
147 /* Misc. constants. */
153 #define NULL ((void*)0)
178 /* Standard data types */
180 typedef void *LPVOID;
181 typedef const void *LPCVOID;
182 typedef int BOOL, *PBOOL, *LPBOOL;
183 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
184 typedef unsigned char UCHAR, *PUCHAR;
185 typedef unsigned short WORD, *PWORD, *LPWORD;
186 typedef unsigned short USHORT, *PUSHORT;
187 typedef int INT, *PINT, *LPINT;
188 typedef unsigned int UINT, *PUINT;
189 typedef float FLOAT, *PFLOAT;
191 #if defined(_WIN64) && !defined(_MSC_VER)
193 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
194 typedef unsigned int ULONG, *PULONG;
196 typedef long *LPLONG;
197 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
198 typedef unsigned long ULONG, *PULONG;
201 /* Macros to map Winelib names to the correct implementation name */
202 /* Note that Winelib is purely Win32. */
205 #define WINE_NO_UNICODE_MACROS
208 #ifdef WINE_NO_UNICODE_MACROS
209 # define WINELIB_NAME_AW(func) \
210 func##_must_be_suffixed_with_W_or_A_in_this_context \
211 func##_must_be_suffixed_with_W_or_A_in_this_context
212 #else /* WINE_NO_UNICODE_MACROS */
214 # define WINELIB_NAME_AW(func) func##W
216 # define WINELIB_NAME_AW(func) func##A
218 #endif /* WINE_NO_UNICODE_MACROS */
220 #ifdef WINE_NO_UNICODE_MACROS
221 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
223 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
228 /* Polymorphic types */
230 typedef UINT_PTR WPARAM;
231 typedef LONG_PTR LPARAM;
232 typedef LONG_PTR LRESULT;
237 typedef DWORD COLORREF, *LPCOLORREF;
243 DECLARE_HANDLE(HACCEL);
244 DECLARE_HANDLE(HBITMAP);
245 DECLARE_HANDLE(HBRUSH);
246 DECLARE_HANDLE(HCOLORSPACE);
248 DECLARE_HANDLE(HDESK);
249 DECLARE_HANDLE(HENHMETAFILE);
250 DECLARE_HANDLE(HFONT);
251 DECLARE_HANDLE(HGLRC);
252 DECLARE_HANDLE(HHOOK);
253 DECLARE_HANDLE(HICON);
254 DECLARE_HANDLE(HINSTANCE);
255 DECLARE_HANDLE(HKEY);
258 DECLARE_HANDLE(HMENU);
259 DECLARE_HANDLE(HMETAFILE);
260 DECLARE_HANDLE(HMONITOR);
261 DECLARE_HANDLE(HPALETTE);
262 DECLARE_HANDLE(HPEN);
263 DECLARE_HANDLE(HRGN);
264 DECLARE_HANDLE(HRSRC);
265 DECLARE_HANDLE(HTASK);
266 DECLARE_HANDLE(HWINEVENTHOOK);
267 DECLARE_HANDLE(HWINSTA);
268 DECLARE_HANDLE(HWND);
270 /* Handle types that must remain interchangeable even with strict on */
272 typedef HINSTANCE HMODULE;
273 typedef HANDLE HGDIOBJ;
274 typedef HANDLE HGLOBAL;
275 typedef HANDLE HLOCAL;
276 typedef HANDLE GLOBALHANDLE;
277 typedef HANDLE LOCALHANDLE;
278 typedef HICON HCURSOR;
280 /* Callback function pointers types */
282 typedef INT (CALLBACK *FARPROC)();
283 typedef INT (CALLBACK *PROC)();
286 /* Macros to split words and longs. */
288 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
289 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
291 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
292 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
294 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
295 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
297 /* min and max macros */
300 #define max(a,b) (((a) > (b)) ? (a) : (b))
303 #define min(a,b) (((a) < (b)) ? (a) : (b))
305 #endif /* NOMINMAX */
307 #ifdef MAX_PATH /* Work-around for Mingw */
309 #endif /* MAX_PATH */
312 #define HFILE_ERROR ((HFILE)-1)
314 /* The SIZE structure */
315 typedef struct tagSIZE
319 } SIZE, *PSIZE, *LPSIZE;
321 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
323 /* The POINT structure */
324 typedef struct tagPOINT
328 } POINT, *PPOINT, *LPPOINT;
330 typedef struct _POINTL
336 /* The POINTS structure */
338 typedef struct tagPOINTS
340 #ifdef WORDS_BIGENDIAN
347 } POINTS, *PPOINTS, *LPPOINTS;
349 /* The RECT structure */
350 typedef struct tagRECT
356 } RECT, *PRECT, *LPRECT;
357 typedef const RECT *LPCRECT;
359 typedef struct _RECTL
365 } RECTL, *PRECTL, *LPRECTL;
367 typedef const RECTL *LPCRECTL;
373 #endif /* _WINDEF_ */