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_)
51 # define __stdcall __attribute__((__stdcall__))
52 # elif defined(_MSC_VER)
53 /* Nothing needs to be done. __stdcall already exists */
55 # error You need to define __stdcall for your compiler
59 # endif /* __i386__ */
60 #endif /* __stdcall */
63 # if defined(__i386__) && defined(__GNUC__)
64 # define __cdecl __attribute__((__cdecl__))
65 # elif !defined(_MSC_VER)
71 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
73 #define __ONLY_IN_WINELIB(x) x
77 #define pascal __ONLY_IN_WINELIB(__stdcall)
80 #define _pascal __ONLY_IN_WINELIB(__stdcall)
83 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
86 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
89 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
92 #define __export __ONLY_IN_WINELIB(__stdcall)
95 #define cdecl __ONLY_IN_WINELIB(__cdecl)
98 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
102 #define near __ONLY_IN_WINELIB()
105 #define far __ONLY_IN_WINELIB()
108 #define _near __ONLY_IN_WINELIB()
111 #define _far __ONLY_IN_WINELIB()
114 #define NEAR __ONLY_IN_WINELIB()
117 #define FAR __ONLY_IN_WINELIB()
122 # define _declspec(x) __ONLY_IN_WINELIB()
125 # define __declspec(x) __ONLY_IN_WINELIB()
129 #define CALLBACK __stdcall
130 #define WINAPI __stdcall
131 #define APIPRIVATE __stdcall
132 #define PASCAL __stdcall
133 #define CDECL __cdecl
134 #define _CDECL __cdecl
135 #define WINAPIV __cdecl
136 #define APIENTRY WINAPI
139 /* Misc. constants. */
145 #define NULL ((void*)0)
170 /* Standard data types */
172 typedef void *LPVOID
;
173 typedef const void *LPCVOID
;
174 typedef int BOOL
, *PBOOL
, *LPBOOL
;
175 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
176 typedef unsigned char UCHAR
, *PUCHAR
;
177 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
178 typedef unsigned short USHORT
, *PUSHORT
;
179 typedef int INT
, *PINT
, *LPINT
;
180 typedef unsigned int UINT
, *PUINT
;
181 typedef float FLOAT
, *PFLOAT
;
183 #if defined(_WIN64) && !defined(_MSC_VER)
185 typedef unsigned int DWORD
, *PDWORD
, *LPDWORD
;
186 typedef unsigned int ULONG
, *PULONG
;
188 typedef long *LPLONG
;
189 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
190 typedef unsigned long ULONG
, *PULONG
;
193 /* Macros to map Winelib names to the correct implementation name */
194 /* Note that Winelib is purely Win32. */
197 #define WINE_NO_UNICODE_MACROS
200 #ifdef WINE_NO_UNICODE_MACROS
201 # define WINELIB_NAME_AW(func) \
202 func##_must_be_suffixed_with_W_or_A_in_this_context \
203 func##_must_be_suffixed_with_W_or_A_in_this_context
204 #else /* WINE_NO_UNICODE_MACROS */
206 # define WINELIB_NAME_AW(func) func##W
208 # define WINELIB_NAME_AW(func) func##A
210 #endif /* WINE_NO_UNICODE_MACROS */
212 #ifdef WINE_NO_UNICODE_MACROS
213 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
215 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
220 /* Polymorphic types */
222 typedef UINT_PTR WPARAM
;
223 typedef LONG_PTR LPARAM
;
224 typedef LONG_PTR LRESULT
;
229 typedef DWORD COLORREF
, *LPCOLORREF
;
235 DECLARE_HANDLE(HACCEL
);
236 DECLARE_HANDLE(HBITMAP
);
237 DECLARE_HANDLE(HBRUSH
);
238 DECLARE_HANDLE(HCOLORSPACE
);
240 DECLARE_HANDLE(HDESK
);
241 DECLARE_HANDLE(HENHMETAFILE
);
242 DECLARE_HANDLE(HFONT
);
243 DECLARE_HANDLE(HGLRC
);
244 DECLARE_HANDLE(HHOOK
);
245 DECLARE_HANDLE(HICON
);
246 DECLARE_HANDLE(HINSTANCE
);
247 DECLARE_HANDLE(HKEY
);
250 DECLARE_HANDLE(HMENU
);
251 DECLARE_HANDLE(HMETAFILE
);
252 DECLARE_HANDLE(HMONITOR
);
253 DECLARE_HANDLE(HPALETTE
);
254 DECLARE_HANDLE(HPEN
);
255 DECLARE_HANDLE(HRGN
);
256 DECLARE_HANDLE(HRSRC
);
257 DECLARE_HANDLE(HTASK
);
258 DECLARE_HANDLE(HWINEVENTHOOK
);
259 DECLARE_HANDLE(HWINSTA
);
260 DECLARE_HANDLE(HWND
);
262 /* Handle types that must remain interchangeable even with strict on */
264 typedef HINSTANCE HMODULE
;
265 typedef HANDLE HGDIOBJ
;
266 typedef HANDLE HGLOBAL
;
267 typedef HANDLE HLOCAL
;
268 typedef HANDLE GLOBALHANDLE
;
269 typedef HANDLE LOCALHANDLE
;
270 typedef HICON HCURSOR
;
272 /* Callback function pointers types */
274 typedef INT (CALLBACK
*FARPROC
)();
275 typedef INT (CALLBACK
*PROC
)();
278 /* Macros to split words and longs. */
280 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
281 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
283 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
284 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
286 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
287 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
289 /* min and max macros */
292 #define max(a,b) (((a) > (b)) ? (a) : (b))
295 #define min(a,b) (((a) < (b)) ? (a) : (b))
297 #endif /* NOMINMAX */
299 #ifdef MAX_PATH /* Work-around for Mingw */
301 #endif /* MAX_PATH */
304 #define HFILE_ERROR ((HFILE)-1)
306 /* The SIZE structure */
307 typedef struct tagSIZE
311 } SIZE
, *PSIZE
, *LPSIZE
;
313 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
315 /* The POINT structure */
316 typedef struct tagPOINT
320 } POINT
, *PPOINT
, *LPPOINT
;
322 typedef struct _POINTL
328 /* The POINTS structure */
330 typedef struct tagPOINTS
332 #ifdef WORDS_BIGENDIAN
339 } POINTS
, *PPOINTS
, *LPPOINTS
;
341 /* The RECT structure */
342 typedef struct tagRECT
348 } RECT
, *PRECT
, *LPRECT
;
349 typedef const RECT
*LPCRECT
;
351 typedef struct _RECTL
357 } RECTL
, *PRECTL
, *LPRECTL
;
359 typedef const RECTL
*LPCRECTL
;
365 #endif /* _WINDEF_ */