winemaker: Update man page.
[wine.git] / include / windef.h
blob825255b537b7383278eea21d808c4478c143a8e4
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 #ifndef __ms_va_list
88 # if defined(__x86_64__) && defined (__GNUC__)
89 # define __ms_va_list __builtin_ms_va_list
90 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
91 # define __ms_va_end(list) __builtin_ms_va_end(list)
92 # else
93 # define __ms_va_list va_list
94 # define __ms_va_start(list,arg) va_start(list,arg)
95 # define __ms_va_end(list) va_end(list)
96 # endif
97 #endif
99 #ifdef __WINESRC__
100 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
101 #else
102 #define __ONLY_IN_WINELIB(x) x
103 #endif
105 #ifndef pascal
106 #define pascal __ONLY_IN_WINELIB(__stdcall)
107 #endif
108 #ifndef _pascal
109 #define _pascal __ONLY_IN_WINELIB(__stdcall)
110 #endif
111 #ifndef _stdcall
112 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
113 #endif
114 #ifndef _fastcall
115 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
116 #endif
117 #ifndef __fastcall
118 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
119 #endif
120 #ifndef __export
121 #define __export __ONLY_IN_WINELIB(__stdcall)
122 #endif
123 #ifndef cdecl
124 #define cdecl __ONLY_IN_WINELIB(__cdecl)
125 #endif
126 #ifndef _cdecl
127 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
128 #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
136 #ifndef _near
137 #define _near __ONLY_IN_WINELIB(/* nothing */)
138 #endif
139 #ifndef _far
140 #define _far __ONLY_IN_WINELIB(/* nothing */)
141 #endif
142 #ifndef NEAR
143 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
144 #endif
145 #ifndef FAR
146 #define FAR __ONLY_IN_WINELIB(/* nothing */)
147 #endif
149 #ifndef _MSC_VER
150 # ifndef _declspec
151 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
152 # endif
153 # ifndef __declspec
154 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
155 # endif
156 #endif
158 #ifdef _MSC_VER
159 # define inline __inline
160 #endif
162 #define CALLBACK __stdcall
163 #define WINAPI __stdcall
164 #define APIPRIVATE __stdcall
165 #define PASCAL __stdcall
166 #define CDECL __cdecl
167 #define _CDECL __cdecl
168 #define WINAPIV __cdecl
169 #define APIENTRY WINAPI
170 #define CONST const
172 /* Misc. constants. */
174 #undef NULL
175 #ifdef __cplusplus
176 #define NULL 0
177 #else
178 #define NULL ((void*)0)
179 #endif
181 #ifdef FALSE
182 #undef FALSE
183 #endif
184 #define FALSE 0
186 #ifdef TRUE
187 #undef TRUE
188 #endif
189 #define TRUE 1
191 #ifndef IN
192 #define IN
193 #endif
195 #ifndef OUT
196 #define OUT
197 #endif
199 #ifndef OPTIONAL
200 #define OPTIONAL
201 #endif
203 /* Standard data types */
205 typedef void *LPVOID;
206 typedef const void *LPCVOID;
207 typedef int BOOL, *PBOOL, *LPBOOL;
208 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
209 typedef unsigned char UCHAR, *PUCHAR;
210 typedef unsigned short WORD, *PWORD, *LPWORD;
211 typedef unsigned short USHORT, *PUSHORT;
212 typedef int INT, *PINT, *LPINT;
213 typedef unsigned int UINT, *PUINT;
214 typedef float FLOAT, *PFLOAT;
215 typedef char *PSZ;
216 #ifdef _MSC_VER
217 typedef long *LPLONG;
218 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
219 typedef unsigned long ULONG, *PULONG;
220 #else
221 typedef int *LPLONG;
222 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
223 typedef unsigned int ULONG, *PULONG;
224 #endif
226 /* Macros to map Winelib names to the correct implementation name */
227 /* Note that Winelib is purely Win32. */
229 #ifdef __WINESRC__
230 #define WINE_NO_UNICODE_MACROS
231 #endif
233 #ifdef WINE_NO_UNICODE_MACROS
234 # define WINELIB_NAME_AW(func) \
235 func##_must_be_suffixed_with_W_or_A_in_this_context \
236 func##_must_be_suffixed_with_W_or_A_in_this_context
237 #else /* WINE_NO_UNICODE_MACROS */
238 # ifdef UNICODE
239 # define WINELIB_NAME_AW(func) func##W
240 # else
241 # define WINELIB_NAME_AW(func) func##A
242 # endif
243 #endif /* WINE_NO_UNICODE_MACROS */
245 #ifdef WINE_NO_UNICODE_MACROS
246 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
247 #else
248 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
249 #endif
251 #include <winnt.h>
253 /* Polymorphic types */
255 typedef UINT_PTR WPARAM;
256 typedef LONG_PTR LPARAM;
257 typedef LONG_PTR LRESULT;
259 /* Integer types */
261 typedef WORD ATOM;
262 typedef DWORD COLORREF, *LPCOLORREF;
265 /* Handle types */
267 typedef int HFILE;
268 DECLARE_HANDLE(HACCEL);
269 DECLARE_HANDLE(HBITMAP);
270 DECLARE_HANDLE(HBRUSH);
271 DECLARE_HANDLE(HCOLORSPACE);
272 DECLARE_HANDLE(HDC);
273 DECLARE_HANDLE(HDESK);
274 DECLARE_HANDLE(HENHMETAFILE);
275 DECLARE_HANDLE(HFONT);
276 DECLARE_HANDLE(HGLRC);
277 DECLARE_HANDLE(HHOOK);
278 DECLARE_HANDLE(HICON);
279 DECLARE_HANDLE(HINSTANCE);
280 DECLARE_HANDLE(HKEY);
281 typedef HKEY *PHKEY;
282 DECLARE_HANDLE(HKL);
283 DECLARE_HANDLE(HMENU);
284 DECLARE_HANDLE(HMETAFILE);
285 DECLARE_HANDLE(HMONITOR);
286 DECLARE_HANDLE(HPALETTE);
287 DECLARE_HANDLE(HPEN);
288 DECLARE_HANDLE(HRGN);
289 DECLARE_HANDLE(HRSRC);
290 DECLARE_HANDLE(HTASK);
291 DECLARE_HANDLE(HWINEVENTHOOK);
292 DECLARE_HANDLE(HWINSTA);
293 DECLARE_HANDLE(HWND);
295 /* Handle types that must remain interchangeable even with strict on */
297 typedef HINSTANCE HMODULE;
298 typedef HANDLE HGDIOBJ;
299 typedef HANDLE HGLOBAL;
300 typedef HANDLE HLOCAL;
301 typedef HANDLE GLOBALHANDLE;
302 typedef HANDLE LOCALHANDLE;
303 typedef HICON HCURSOR;
305 /* Callback function pointers types */
307 typedef INT_PTR (CALLBACK *FARPROC)();
308 typedef INT_PTR (CALLBACK *NEARPROC)();
309 typedef INT_PTR (CALLBACK *PROC)();
312 /* Macros to split words and longs. */
314 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
315 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
317 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
318 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
320 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
321 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
323 /* min and max macros */
324 #ifndef NOMINMAX
325 #ifndef max
326 #define max(a,b) (((a) > (b)) ? (a) : (b))
327 #endif
328 #ifndef min
329 #define min(a,b) (((a) < (b)) ? (a) : (b))
330 #endif
331 #endif /* NOMINMAX */
333 #ifdef MAX_PATH /* Work-around for Mingw */
334 #undef MAX_PATH
335 #endif /* MAX_PATH */
337 #define MAX_PATH 260
338 #define HFILE_ERROR ((HFILE)-1)
340 /* The SIZE structure */
341 typedef struct tagSIZE
343 LONG cx;
344 LONG cy;
345 } SIZE, *PSIZE, *LPSIZE;
347 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
349 /* The POINT structure */
350 typedef struct tagPOINT
352 LONG x;
353 LONG y;
354 } POINT, *PPOINT, *LPPOINT;
356 typedef struct _POINTL
358 LONG x;
359 LONG y;
360 } POINTL, *PPOINTL;
362 /* The POINTS structure */
364 typedef struct tagPOINTS
366 #ifdef WORDS_BIGENDIAN
367 SHORT y;
368 SHORT x;
369 #else
370 SHORT x;
371 SHORT y;
372 #endif
373 } POINTS, *PPOINTS, *LPPOINTS;
375 typedef struct _FILETIME {
376 #ifdef WORDS_BIGENDIAN
377 DWORD dwHighDateTime;
378 DWORD dwLowDateTime;
379 #else
380 DWORD dwLowDateTime;
381 DWORD dwHighDateTime;
382 #endif
383 } FILETIME, *PFILETIME, *LPFILETIME;
384 #define _FILETIME_
386 /* The RECT structure */
387 typedef struct tagRECT
389 LONG left;
390 LONG top;
391 LONG right;
392 LONG bottom;
393 } RECT, *PRECT, *LPRECT;
394 typedef const RECT *LPCRECT;
396 typedef struct _RECTL
398 LONG left;
399 LONG top;
400 LONG right;
401 LONG bottom;
402 } RECTL, *PRECTL, *LPRECTL;
404 typedef const RECTL *LPCRECTL;
406 #ifdef __cplusplus
408 #endif
410 #endif /* _WINDEF_ */