push 3cf4bc9cdb38c4fc36232fe19b9b904fd4d068e9
[wine/hacks.git] / include / windef.h
blob3c9de7a9137441bb8df4f80e159994499424e5eb
1 /*
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
21 #ifndef _WINDEF_
22 #define _WINDEF_
24 #ifndef WINVER
25 #define WINVER 0x0500
26 #endif
28 #ifndef NO_STRICT
29 # ifndef STRICT
30 # define STRICT
31 # endif /* STRICT */
32 #endif /* NO_STRICT */
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 /* Calling conventions definitions */
40 #if defined(__x86_64__) && !defined(_WIN64)
41 #define _WIN64
42 #endif
44 #ifndef _WIN64
45 # if defined(__i386__) && !defined(_X86_)
46 # define _X86_
47 # endif
48 # if defined(_X86_) && !defined(__i386__)
49 # define __i386__
50 # endif
51 #endif
53 #ifndef __stdcall
54 # ifdef __i386__
55 # ifdef __GNUC__
56 # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
57 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
58 # else
59 # define __stdcall __attribute__((__stdcall__))
60 # endif
61 # elif defined(_MSC_VER)
62 /* Nothing needs to be done. __stdcall already exists */
63 # else
64 # error You need to define __stdcall for your compiler
65 # endif
66 # elif defined(__x86_64__) && defined (__GNUC__)
67 # define __stdcall __attribute__((ms_abi))
68 # else /* __i386__ */
69 # define __stdcall
70 # endif /* __i386__ */
71 #endif /* __stdcall */
73 #ifndef __cdecl
74 # if defined(__i386__) && defined(__GNUC__)
75 # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
76 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
77 # else
78 # define __cdecl __attribute__((__cdecl__))
79 # endif
80 # elif defined(__x86_64__) && defined (__GNUC__)
81 # define __cdecl __attribute__((ms_abi))
82 # elif !defined(_MSC_VER)
83 # define __cdecl
84 # endif
85 #endif /* __cdecl */
87 #ifdef __WINESRC__
88 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
89 #else
90 #define __ONLY_IN_WINELIB(x) x
91 #endif
93 #ifndef pascal
94 #define pascal __ONLY_IN_WINELIB(__stdcall)
95 #endif
96 #ifndef _pascal
97 #define _pascal __ONLY_IN_WINELIB(__stdcall)
98 #endif
99 #ifndef _stdcall
100 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
101 #endif
102 #ifndef _fastcall
103 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
104 #endif
105 #ifndef __fastcall
106 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
107 #endif
108 #ifndef __export
109 #define __export __ONLY_IN_WINELIB(__stdcall)
110 #endif
111 #ifndef cdecl
112 #define cdecl __ONLY_IN_WINELIB(__cdecl)
113 #endif
114 #ifndef _cdecl
115 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
116 #endif
118 #ifndef near
119 #define near __ONLY_IN_WINELIB(/* nothing */)
120 #endif
121 #ifndef far
122 #define far __ONLY_IN_WINELIB(/* nothing */)
123 #endif
124 #ifndef _near
125 #define _near __ONLY_IN_WINELIB(/* nothing */)
126 #endif
127 #ifndef _far
128 #define _far __ONLY_IN_WINELIB(/* nothing */)
129 #endif
130 #ifndef NEAR
131 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
132 #endif
133 #ifndef FAR
134 #define FAR __ONLY_IN_WINELIB(/* nothing */)
135 #endif
137 #ifndef _MSC_VER
138 # ifndef _declspec
139 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
140 # endif
141 # ifndef __declspec
142 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
143 # endif
144 #endif
146 #ifdef _MSC_VER
147 # define inline __inline
148 #endif
150 #define CALLBACK __stdcall
151 #define WINAPI __stdcall
152 #define APIPRIVATE __stdcall
153 #define PASCAL __stdcall
154 #define CDECL __cdecl
155 #define _CDECL __cdecl
156 #define WINAPIV __cdecl
157 #define APIENTRY WINAPI
158 #define CONST const
160 /* Misc. constants. */
162 #undef NULL
163 #ifdef __cplusplus
164 #define NULL 0
165 #else
166 #define NULL ((void*)0)
167 #endif
169 #ifdef FALSE
170 #undef FALSE
171 #endif
172 #define FALSE 0
174 #ifdef TRUE
175 #undef TRUE
176 #endif
177 #define TRUE 1
179 #ifndef IN
180 #define IN
181 #endif
183 #ifndef OUT
184 #define OUT
185 #endif
187 #ifndef OPTIONAL
188 #define OPTIONAL
189 #endif
191 /* Standard data types */
193 typedef void *LPVOID;
194 typedef const void *LPCVOID;
195 typedef int BOOL, *PBOOL, *LPBOOL;
196 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
197 typedef unsigned char UCHAR, *PUCHAR;
198 typedef unsigned short WORD, *PWORD, *LPWORD;
199 typedef unsigned short USHORT, *PUSHORT;
200 typedef int INT, *PINT, *LPINT;
201 typedef unsigned int UINT, *PUINT;
202 typedef float FLOAT, *PFLOAT;
203 typedef char *PSZ;
204 #ifdef _MSC_VER
205 typedef long *LPLONG;
206 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
207 typedef unsigned long ULONG, *PULONG;
208 #else
209 typedef int *LPLONG;
210 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
211 typedef unsigned int ULONG, *PULONG;
212 #endif
214 /* Macros to map Winelib names to the correct implementation name */
215 /* Note that Winelib is purely Win32. */
217 #ifdef __WINESRC__
218 #define WINE_NO_UNICODE_MACROS
219 #endif
221 #ifdef WINE_NO_UNICODE_MACROS
222 # define WINELIB_NAME_AW(func) \
223 func##_must_be_suffixed_with_W_or_A_in_this_context \
224 func##_must_be_suffixed_with_W_or_A_in_this_context
225 #else /* WINE_NO_UNICODE_MACROS */
226 # ifdef UNICODE
227 # define WINELIB_NAME_AW(func) func##W
228 # else
229 # define WINELIB_NAME_AW(func) func##A
230 # endif
231 #endif /* WINE_NO_UNICODE_MACROS */
233 #ifdef WINE_NO_UNICODE_MACROS
234 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
235 #else
236 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
237 #endif
239 #include <winnt.h>
241 /* Polymorphic types */
243 typedef UINT_PTR WPARAM;
244 typedef LONG_PTR LPARAM;
245 typedef LONG_PTR LRESULT;
247 /* Integer types */
249 typedef WORD ATOM;
250 typedef DWORD COLORREF, *LPCOLORREF;
253 /* Handle types */
255 typedef int HFILE;
256 DECLARE_HANDLE(HACCEL);
257 DECLARE_HANDLE(HBITMAP);
258 DECLARE_HANDLE(HBRUSH);
259 DECLARE_HANDLE(HCOLORSPACE);
260 DECLARE_HANDLE(HDC);
261 DECLARE_HANDLE(HDESK);
262 DECLARE_HANDLE(HENHMETAFILE);
263 DECLARE_HANDLE(HFONT);
264 DECLARE_HANDLE(HGLRC);
265 DECLARE_HANDLE(HHOOK);
266 DECLARE_HANDLE(HICON);
267 DECLARE_HANDLE(HINSTANCE);
268 DECLARE_HANDLE(HKEY);
269 typedef HKEY *PHKEY;
270 DECLARE_HANDLE(HKL);
271 DECLARE_HANDLE(HMENU);
272 DECLARE_HANDLE(HMETAFILE);
273 DECLARE_HANDLE(HMONITOR);
274 DECLARE_HANDLE(HPALETTE);
275 DECLARE_HANDLE(HPEN);
276 DECLARE_HANDLE(HRGN);
277 DECLARE_HANDLE(HRSRC);
278 DECLARE_HANDLE(HTASK);
279 DECLARE_HANDLE(HWINEVENTHOOK);
280 DECLARE_HANDLE(HWINSTA);
281 DECLARE_HANDLE(HWND);
283 /* Handle types that must remain interchangeable even with strict on */
285 typedef HINSTANCE HMODULE;
286 typedef HANDLE HGDIOBJ;
287 typedef HANDLE HGLOBAL;
288 typedef HANDLE HLOCAL;
289 typedef HANDLE GLOBALHANDLE;
290 typedef HANDLE LOCALHANDLE;
291 typedef HICON HCURSOR;
293 /* Callback function pointers types */
295 typedef INT_PTR (CALLBACK *FARPROC)();
296 typedef INT_PTR (CALLBACK *NEARPROC)();
297 typedef INT_PTR (CALLBACK *PROC)();
300 /* Macros to split words and longs. */
302 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
303 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
305 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
306 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
308 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
309 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
311 /* min and max macros */
312 #ifndef NOMINMAX
313 #ifndef max
314 #define max(a,b) (((a) > (b)) ? (a) : (b))
315 #endif
316 #ifndef min
317 #define min(a,b) (((a) < (b)) ? (a) : (b))
318 #endif
319 #endif /* NOMINMAX */
321 #ifdef MAX_PATH /* Work-around for Mingw */
322 #undef MAX_PATH
323 #endif /* MAX_PATH */
325 #define MAX_PATH 260
326 #define HFILE_ERROR ((HFILE)-1)
328 /* The SIZE structure */
329 typedef struct tagSIZE
331 LONG cx;
332 LONG cy;
333 } SIZE, *PSIZE, *LPSIZE;
335 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
337 /* The POINT structure */
338 typedef struct tagPOINT
340 LONG x;
341 LONG y;
342 } POINT, *PPOINT, *LPPOINT;
344 typedef struct _POINTL
346 LONG x;
347 LONG y;
348 } POINTL, *PPOINTL;
350 /* The POINTS structure */
352 typedef struct tagPOINTS
354 #ifdef WORDS_BIGENDIAN
355 SHORT y;
356 SHORT x;
357 #else
358 SHORT x;
359 SHORT y;
360 #endif
361 } POINTS, *PPOINTS, *LPPOINTS;
363 typedef struct _FILETIME {
364 #ifdef WORDS_BIGENDIAN
365 DWORD dwHighDateTime;
366 DWORD dwLowDateTime;
367 #else
368 DWORD dwLowDateTime;
369 DWORD dwHighDateTime;
370 #endif
371 } FILETIME, *PFILETIME, *LPFILETIME;
372 #define _FILETIME_
374 /* The RECT structure */
375 typedef struct tagRECT
377 LONG left;
378 LONG top;
379 LONG right;
380 LONG bottom;
381 } RECT, *PRECT, *LPRECT;
382 typedef const RECT *LPCRECT;
384 typedef struct _RECTL
386 LONG left;
387 LONG top;
388 LONG right;
389 LONG bottom;
390 } RECTL, *PRECTL, *LPRECTL;
392 typedef const RECTL *LPCRECTL;
394 #ifdef __cplusplus
396 #endif
398 #endif /* _WINDEF_ */