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
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 /* __WINE__ */
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 __WINE__ 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
187 # define WINELIB_NAME_AW(func) func##W
189 # define WINELIB_NAME_AW(func) func##A
190 # endif /* UNICODE */
191 #endif /* __WINE__ */
194 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
196 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
197 #endif /* __WINE__ */
203 typedef LONG LRESULT;
205 typedef WORD CATCHBUF[9];
206 typedef WORD *LPCATCHBUF;
207 typedef DWORD COLORREF, *LPCOLORREF;
213 DECLARE_HANDLE(HACCEL);
214 DECLARE_HANDLE(HBITMAP);
215 DECLARE_HANDLE(HBRUSH);
216 DECLARE_HANDLE(HCOLORSPACE);
218 DECLARE_HANDLE(HDESK);
219 DECLARE_HANDLE(HENHMETAFILE);
220 DECLARE_HANDLE(HFONT);
221 DECLARE_HANDLE(HHOOK);
222 DECLARE_HANDLE(HICON);
223 DECLARE_HANDLE(HINSTANCE);
224 DECLARE_HANDLE(HKEY);
227 DECLARE_HANDLE(HMENU);
228 DECLARE_HANDLE(HMETAFILE);
229 DECLARE_HANDLE(HMONITOR);
230 DECLARE_HANDLE(HPALETTE);
231 DECLARE_HANDLE(HPEN);
232 DECLARE_HANDLE(HRGN);
233 DECLARE_HANDLE(HRSRC);
234 DECLARE_HANDLE(HTASK);
235 DECLARE_HANDLE(HWINEVENTHOOK);
236 DECLARE_HANDLE(HWINSTA);
237 DECLARE_HANDLE(HWND);
239 /* Handle types that must remain interchangeable even with strict on */
241 typedef HINSTANCE HMODULE;
242 typedef HANDLE HGDIOBJ;
243 typedef HANDLE HGLOBAL;
244 typedef HANDLE HLOCAL;
245 typedef HANDLE GLOBALHANDLE;
246 typedef HANDLE LOCALHANDLE;
247 typedef HICON HCURSOR;
249 /* Callback function pointers types */
251 typedef INT (CALLBACK *FARPROC)();
252 typedef INT (CALLBACK *PROC)();
255 /* Macros to split words and longs. */
257 #define LOBYTE(w) ((BYTE)(WORD)(w))
258 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
260 #define LOWORD(l) ((WORD)(DWORD)(l))
261 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
263 #define SLOWORD(l) ((SHORT)(LONG)(l))
264 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
266 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
267 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
268 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
269 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
270 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
272 #define SELECTOROF(ptr) (HIWORD(ptr))
273 #define OFFSETOF(ptr) (LOWORD(ptr))
275 /* min and max macros */
278 #define max(a,b) (((a) > (b)) ? (a) : (b))
281 #define min(a,b) (((a) < (b)) ? (a) : (b))
283 #endif /* NOMINMAX */
285 #ifdef MAX_PATH /* Work-around for Mingw */
287 #endif /* MAX_PATH */
290 #define HFILE_ERROR ((HFILE)-1)
292 /* The SIZE structure */
293 typedef struct tagSIZE
297 } SIZE, *PSIZE, *LPSIZE;
299 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
301 /* The POINT structure */
302 typedef struct tagPOINT
306 } POINT, *PPOINT, *LPPOINT;
308 typedef struct _POINTL
314 /* The POINTS structure */
316 typedef struct tagPOINTS
320 } POINTS, *PPOINTS, *LPPOINTS;
322 /* The RECT structure */
323 typedef struct tagRECT
329 } RECT, *PRECT, *LPRECT;
330 typedef const RECT *LPCRECT;
333 typedef struct tagRECTL
339 } RECTL, *PRECTL, *LPRECTL;
341 typedef const RECTL *LPCRECTL;
347 #endif /* __WINE_WINDEF_H */