itss: Remove unneeded casts.
[wine.git] / include / windef.h
blobfd3d4233b381cdb0940d79daf34c7025f4808205
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(__i386__) && !defined(_X86_)
41 # define _X86_
42 #endif
44 #if defined(_X86_) && !defined(__i386__)
45 # define __i386__
46 #endif
48 #if defined(__x86_64__) && !defined(_WIN64)
49 #define _WIN64
50 #endif
52 #ifndef __stdcall
53 # ifdef __i386__
54 # ifdef __GNUC__
55 # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
56 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
57 # else
58 # define __stdcall __attribute__((__stdcall__))
59 # endif
60 # elif defined(_MSC_VER)
61 /* Nothing needs to be done. __stdcall already exists */
62 # else
63 # error You need to define __stdcall for your compiler
64 # endif
65 # else /* __i386__ */
66 # define __stdcall
67 # endif /* __i386__ */
68 #endif /* __stdcall */
70 #ifndef __cdecl
71 # if defined(__i386__) && defined(__GNUC__)
72 # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
73 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
74 # else
75 # define __cdecl __attribute__((__cdecl__))
76 # endif
77 # elif !defined(_MSC_VER)
78 # define __cdecl
79 # endif
80 #endif /* __cdecl */
82 #ifdef __WINESRC__
83 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
84 #else
85 #define __ONLY_IN_WINELIB(x) x
86 #endif
88 #ifndef pascal
89 #define pascal __ONLY_IN_WINELIB(__stdcall)
90 #endif
91 #ifndef _pascal
92 #define _pascal __ONLY_IN_WINELIB(__stdcall)
93 #endif
94 #ifndef _stdcall
95 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
96 #endif
97 #ifndef _fastcall
98 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
99 #endif
100 #ifndef __fastcall
101 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
102 #endif
103 #ifndef __export
104 #define __export __ONLY_IN_WINELIB(__stdcall)
105 #endif
106 #ifndef cdecl
107 #define cdecl __ONLY_IN_WINELIB(__cdecl)
108 #endif
109 #ifndef _cdecl
110 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
111 #endif
113 #ifndef near
114 #define near __ONLY_IN_WINELIB(/* nothing */)
115 #endif
116 #ifndef far
117 #define far __ONLY_IN_WINELIB(/* nothing */)
118 #endif
119 #ifndef _near
120 #define _near __ONLY_IN_WINELIB(/* nothing */)
121 #endif
122 #ifndef _far
123 #define _far __ONLY_IN_WINELIB(/* nothing */)
124 #endif
125 #ifndef NEAR
126 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
127 #endif
128 #ifndef FAR
129 #define FAR __ONLY_IN_WINELIB(/* nothing */)
130 #endif
132 #ifndef _MSC_VER
133 # ifndef _declspec
134 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
135 # endif
136 # ifndef __declspec
137 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
138 # endif
139 #endif
141 #ifdef _MSC_VER
142 # define inline __inline
143 #endif
145 #define CALLBACK __stdcall
146 #define WINAPI __stdcall
147 #define APIPRIVATE __stdcall
148 #define PASCAL __stdcall
149 #define CDECL __cdecl
150 #define _CDECL __cdecl
151 #define WINAPIV __cdecl
152 #define APIENTRY WINAPI
153 #define CONST const
155 /* Misc. constants. */
157 #undef NULL
158 #ifdef __cplusplus
159 #define NULL 0
160 #else
161 #define NULL ((void*)0)
162 #endif
164 #ifdef FALSE
165 #undef FALSE
166 #endif
167 #define FALSE 0
169 #ifdef TRUE
170 #undef TRUE
171 #endif
172 #define TRUE 1
174 #ifndef IN
175 #define IN
176 #endif
178 #ifndef OUT
179 #define OUT
180 #endif
182 #ifndef OPTIONAL
183 #define OPTIONAL
184 #endif
186 /* Standard data types */
188 typedef void *LPVOID;
189 typedef const void *LPCVOID;
190 typedef int BOOL, *PBOOL, *LPBOOL;
191 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
192 typedef unsigned char UCHAR, *PUCHAR;
193 typedef unsigned short WORD, *PWORD, *LPWORD;
194 typedef unsigned short USHORT, *PUSHORT;
195 typedef int INT, *PINT, *LPINT;
196 typedef unsigned int UINT, *PUINT;
197 typedef float FLOAT, *PFLOAT;
198 typedef char *PSZ;
199 #ifdef _MSC_VER
200 typedef long *LPLONG;
201 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
202 typedef unsigned long ULONG, *PULONG;
203 #else
204 typedef int *LPLONG;
205 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
206 typedef unsigned int ULONG, *PULONG;
207 #endif
209 /* Macros to map Winelib names to the correct implementation name */
210 /* Note that Winelib is purely Win32. */
212 #ifdef __WINESRC__
213 #define WINE_NO_UNICODE_MACROS
214 #endif
216 #ifdef WINE_NO_UNICODE_MACROS
217 # define WINELIB_NAME_AW(func) \
218 func##_must_be_suffixed_with_W_or_A_in_this_context \
219 func##_must_be_suffixed_with_W_or_A_in_this_context
220 #else /* WINE_NO_UNICODE_MACROS */
221 # ifdef UNICODE
222 # define WINELIB_NAME_AW(func) func##W
223 # else
224 # define WINELIB_NAME_AW(func) func##A
225 # endif
226 #endif /* WINE_NO_UNICODE_MACROS */
228 #ifdef WINE_NO_UNICODE_MACROS
229 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
230 #else
231 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
232 #endif
234 #include <winnt.h>
236 /* Polymorphic types */
238 typedef UINT_PTR WPARAM;
239 typedef LONG_PTR LPARAM;
240 typedef LONG_PTR LRESULT;
242 /* Integer types */
244 typedef WORD ATOM;
245 typedef DWORD COLORREF, *LPCOLORREF;
248 /* Handle types */
250 typedef int HFILE;
251 DECLARE_HANDLE(HACCEL);
252 DECLARE_HANDLE(HBITMAP);
253 DECLARE_HANDLE(HBRUSH);
254 DECLARE_HANDLE(HCOLORSPACE);
255 DECLARE_HANDLE(HDC);
256 DECLARE_HANDLE(HDESK);
257 DECLARE_HANDLE(HENHMETAFILE);
258 DECLARE_HANDLE(HFONT);
259 DECLARE_HANDLE(HGLRC);
260 DECLARE_HANDLE(HHOOK);
261 DECLARE_HANDLE(HICON);
262 DECLARE_HANDLE(HINSTANCE);
263 DECLARE_HANDLE(HKEY);
264 typedef HKEY *PHKEY;
265 DECLARE_HANDLE(HKL);
266 DECLARE_HANDLE(HMENU);
267 DECLARE_HANDLE(HMETAFILE);
268 DECLARE_HANDLE(HMONITOR);
269 DECLARE_HANDLE(HPALETTE);
270 DECLARE_HANDLE(HPEN);
271 DECLARE_HANDLE(HRGN);
272 DECLARE_HANDLE(HRSRC);
273 DECLARE_HANDLE(HTASK);
274 DECLARE_HANDLE(HWINEVENTHOOK);
275 DECLARE_HANDLE(HWINSTA);
276 DECLARE_HANDLE(HWND);
278 /* Handle types that must remain interchangeable even with strict on */
280 typedef HINSTANCE HMODULE;
281 typedef HANDLE HGDIOBJ;
282 typedef HANDLE HGLOBAL;
283 typedef HANDLE HLOCAL;
284 typedef HANDLE GLOBALHANDLE;
285 typedef HANDLE LOCALHANDLE;
286 typedef HICON HCURSOR;
288 /* Callback function pointers types */
290 typedef INT_PTR (CALLBACK *FARPROC)();
291 typedef INT_PTR (CALLBACK *NEARPROC)();
292 typedef INT_PTR (CALLBACK *PROC)();
295 /* Macros to split words and longs. */
297 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
298 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
300 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
301 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
303 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
304 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
306 /* min and max macros */
307 #ifndef NOMINMAX
308 #ifndef max
309 #define max(a,b) (((a) > (b)) ? (a) : (b))
310 #endif
311 #ifndef min
312 #define min(a,b) (((a) < (b)) ? (a) : (b))
313 #endif
314 #endif /* NOMINMAX */
316 #ifdef MAX_PATH /* Work-around for Mingw */
317 #undef MAX_PATH
318 #endif /* MAX_PATH */
320 #define MAX_PATH 260
321 #define HFILE_ERROR ((HFILE)-1)
323 /* The SIZE structure */
324 typedef struct tagSIZE
326 LONG cx;
327 LONG cy;
328 } SIZE, *PSIZE, *LPSIZE;
330 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
332 /* The POINT structure */
333 typedef struct tagPOINT
335 LONG x;
336 LONG y;
337 } POINT, *PPOINT, *LPPOINT;
339 typedef struct _POINTL
341 LONG x;
342 LONG y;
343 } POINTL, *PPOINTL;
345 /* The POINTS structure */
347 typedef struct tagPOINTS
349 #ifdef WORDS_BIGENDIAN
350 SHORT y;
351 SHORT x;
352 #else
353 SHORT x;
354 SHORT y;
355 #endif
356 } POINTS, *PPOINTS, *LPPOINTS;
358 typedef struct _FILETIME {
359 #ifdef WORDS_BIGENDIAN
360 DWORD dwHighDateTime;
361 DWORD dwLowDateTime;
362 #else
363 DWORD dwLowDateTime;
364 DWORD dwHighDateTime;
365 #endif
366 } FILETIME, *PFILETIME, *LPFILETIME;
367 #define _FILETIME_
369 /* The RECT structure */
370 typedef struct tagRECT
372 LONG left;
373 LONG top;
374 LONG right;
375 LONG bottom;
376 } RECT, *PRECT, *LPRECT;
377 typedef const RECT *LPCRECT;
379 typedef struct _RECTL
381 LONG left;
382 LONG top;
383 LONG right;
384 LONG bottom;
385 } RECTL, *PRECTL, *LPRECTL;
387 typedef const RECTL *LPCRECTL;
389 #ifdef __cplusplus
391 #endif
393 #endif /* _WINDEF_ */