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