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
21 #ifndef __WINE_WINDEF_H
22 #define __WINE_WINDEF_H
26 #endif /* __WINESRC__ */
36 #endif /* NO_STRICT */
42 /* Calling conventions definitions */
48 # if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
49 # define __stdcall __attribute__((__stdcall__))
50 # define __cdecl __attribute__((__cdecl__))
51 # elif defined(_MSC_VER)
52 /* Nothing needs to be done. __cdecl/__stdcall already exists */
54 # error You need gcc >= 2.7 to build Wine on a 386
55 # endif /* __GNUC__ */
64 #define pascal __stdcall
67 #define _pascal __stdcall
70 #define _stdcall __stdcall
73 #define _fastcall __stdcall
76 #define __fastcall __stdcall
79 #define __export __stdcall
85 #define _cdecl __cdecl
111 #define __declspec(x)
114 #endif /* __WINESRC__ */
116 #define CALLBACK __stdcall
117 #define WINAPI __stdcall
118 #define APIPRIVATE __stdcall
119 #define PASCAL __stdcall
120 #define CDECL __cdecl
121 #define _CDECL __cdecl
122 #define WINAPIV __cdecl
123 #define APIENTRY WINAPI
126 /* Misc. constants. */
132 #define NULL ((void*)0)
157 /* Standard data types */
159 typedef void *LPVOID;
160 typedef const void *LPCVOID;
161 typedef int BOOL, *PBOOL, *LPBOOL;
162 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
163 typedef unsigned char UCHAR, *PUCHAR;
164 typedef unsigned short WORD, *PWORD, *LPWORD;
165 typedef unsigned short USHORT, *PUSHORT;
166 typedef int INT, *PINT, *LPINT;
167 typedef unsigned int UINT, *PUINT;
168 typedef long *LPLONG;
169 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
170 typedef unsigned long ULONG, *PULONG;
171 typedef float FLOAT, *PFLOAT;
172 typedef double DOUBLE;
177 /* Macros to map Winelib names to the correct implementation name */
178 /* depending on __WINESRC__ and UNICODE macros. */
179 /* Note that Winelib is purely Win32. */
182 # define WINELIB_NAME_AW(func) \
183 func##_must_be_suffixed_with_W_or_A_in_this_context \
184 func##_must_be_suffixed_with_W_or_A_in_this_context
185 #else /* __WINESRC__ */
187 # define WINELIB_NAME_AW(func) func##W
189 # define WINELIB_NAME_AW(func) func##A
190 # endif /* UNICODE */
191 #endif /* __WINESRC__ */
194 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
195 #else /* __WINESRC__ */
196 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
197 #endif /* __WINESRC__ */
200 /* Polymorphic types */
202 typedef UINT_PTR WPARAM;
203 typedef LONG_PTR LPARAM;
204 typedef LONG_PTR LRESULT;
209 typedef WORD CATCHBUF[9];
210 typedef WORD *LPCATCHBUF;
211 typedef DWORD COLORREF, *LPCOLORREF;
217 DECLARE_HANDLE(HACCEL);
218 DECLARE_HANDLE(HBITMAP);
219 DECLARE_HANDLE(HBRUSH);
220 DECLARE_HANDLE(HCOLORSPACE);
222 DECLARE_HANDLE(HDESK);
223 DECLARE_HANDLE(HENHMETAFILE);
224 DECLARE_HANDLE(HFONT);
225 DECLARE_HANDLE(HHOOK);
226 DECLARE_HANDLE(HICON);
227 DECLARE_HANDLE(HINSTANCE);
228 DECLARE_HANDLE(HKEY);
231 DECLARE_HANDLE(HMENU);
232 DECLARE_HANDLE(HMETAFILE);
233 DECLARE_HANDLE(HMONITOR);
234 DECLARE_HANDLE(HPALETTE);
235 DECLARE_HANDLE(HPEN);
236 DECLARE_HANDLE(HRGN);
237 DECLARE_HANDLE(HRSRC);
238 DECLARE_HANDLE(HTASK);
239 DECLARE_HANDLE(HWINEVENTHOOK);
240 DECLARE_HANDLE(HWINSTA);
241 DECLARE_HANDLE(HWND);
243 /* Handle types that must remain interchangeable even with strict on */
245 typedef HINSTANCE HMODULE;
246 typedef HANDLE HGDIOBJ;
247 typedef HANDLE HGLOBAL;
248 typedef HANDLE HLOCAL;
249 typedef HANDLE GLOBALHANDLE;
250 typedef HANDLE LOCALHANDLE;
251 typedef HICON HCURSOR;
253 /* Callback function pointers types */
255 typedef INT (CALLBACK *FARPROC)();
256 typedef INT (CALLBACK *PROC)();
259 /* Macros to split words and longs. */
261 #define LOBYTE(w) ((BYTE)(WORD)(w))
262 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
264 #define LOWORD(l) ((WORD)(DWORD)(l))
265 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
267 #define SLOWORD(l) ((SHORT)(LONG)(l))
268 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
270 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
271 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
272 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
273 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
274 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
276 #define SELECTOROF(ptr) (HIWORD(ptr))
277 #define OFFSETOF(ptr) (LOWORD(ptr))
279 /* min and max macros */
282 #define max(a,b) (((a) > (b)) ? (a) : (b))
285 #define min(a,b) (((a) < (b)) ? (a) : (b))
287 #endif /* NOMINMAX */
289 #ifdef MAX_PATH /* Work-around for Mingw */
291 #endif /* MAX_PATH */
294 #define HFILE_ERROR ((HFILE)-1)
296 /* The SIZE structure */
297 typedef struct tagSIZE
301 } SIZE, *PSIZE, *LPSIZE;
303 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
305 /* The POINT structure */
306 typedef struct tagPOINT
310 } POINT, *PPOINT, *LPPOINT;
312 typedef struct _POINTL
318 /* The POINTS structure */
320 typedef struct tagPOINTS
324 } POINTS, *PPOINTS, *LPPOINTS;
326 /* The RECT structure */
327 typedef struct tagRECT
333 } RECT, *PRECT, *LPRECT;
334 typedef const RECT *LPCRECT;
336 typedef struct tagRECTL
342 } RECTL, *PRECTL, *LPRECTL;
344 typedef const RECTL *LPCRECTL;
350 #endif /* __WINE_WINDEF_H */