msvcirt: Print error messages in unimplemented functions.
[wine.git] / include / windef.h
blobe91472681ebec9aab101b1fad8422ce5a74c0887
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(__powerpc64__) || defined(__sparc64__) || defined(__aarch64__)) && !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 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
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 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
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 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
93 # else
94 # define __ms_va_list va_list
95 # define __ms_va_start(list,arg) va_start(list,arg)
96 # define __ms_va_end(list) va_end(list)
97 # ifdef va_copy
98 # define __ms_va_copy(dest,src) va_copy(dest,src)
99 # else
100 # define __ms_va_copy(dest,src) ((dest) = (src))
101 # endif
102 # endif
103 #endif
105 #ifdef __WINESRC__
106 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
107 #else
108 #define __ONLY_IN_WINELIB(x) x
109 #endif
111 #ifndef pascal
112 #define pascal __ONLY_IN_WINELIB(__stdcall)
113 #endif
114 #ifndef _pascal
115 #define _pascal __ONLY_IN_WINELIB(__stdcall)
116 #endif
117 #ifndef _stdcall
118 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
119 #endif
120 #ifndef _fastcall
121 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
122 #endif
123 #ifndef __fastcall
124 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
125 #endif
126 #ifndef __export
127 #define __export __ONLY_IN_WINELIB(__stdcall)
128 #endif
129 #ifndef cdecl
130 #define cdecl __ONLY_IN_WINELIB(__cdecl)
131 #endif
132 #ifndef _cdecl
133 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
134 #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
148 #ifndef NEAR
149 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
150 #endif
151 #ifndef FAR
152 #define FAR __ONLY_IN_WINELIB(/* nothing */)
153 #endif
155 #ifndef _MSC_VER
156 # ifndef _declspec
157 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
158 # endif
159 # ifndef __declspec
160 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
161 # endif
162 #endif
164 #ifdef _MSC_VER
165 # define inline __inline
166 #endif
168 #define CALLBACK __stdcall
169 #define WINAPI __stdcall
170 #define APIPRIVATE __stdcall
171 #define PASCAL __stdcall
172 #define CDECL __cdecl
173 #define _CDECL __cdecl
174 #define WINAPIV __cdecl
175 #define APIENTRY WINAPI
176 #define CONST __ONLY_IN_WINELIB(const)
178 /* Misc. constants. */
180 #undef NULL
181 #ifdef __cplusplus
182 #define NULL 0
183 #else
184 #define NULL ((void*)0)
185 #endif
187 #ifdef FALSE
188 #undef FALSE
189 #endif
190 #define FALSE 0
192 #ifdef TRUE
193 #undef TRUE
194 #endif
195 #define TRUE 1
197 #ifndef IN
198 #define IN
199 #endif
201 #ifndef OUT
202 #define OUT
203 #endif
205 #ifndef OPTIONAL
206 #define OPTIONAL
207 #endif
209 /* Standard data types */
211 typedef void *LPVOID;
212 typedef const void *LPCVOID;
213 typedef int BOOL, *PBOOL, *LPBOOL;
214 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
215 typedef unsigned char UCHAR, *PUCHAR;
216 typedef unsigned short WORD, *PWORD, *LPWORD;
217 typedef unsigned short USHORT, *PUSHORT;
218 typedef int INT, *PINT, *LPINT;
219 typedef unsigned int UINT, *PUINT;
220 typedef float FLOAT, *PFLOAT;
221 typedef char *PSZ;
222 #ifdef _MSC_VER
223 typedef long *LPLONG;
224 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
225 typedef unsigned long ULONG, *PULONG;
226 #else
227 typedef int *LPLONG;
228 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
229 typedef unsigned int ULONG, *PULONG;
230 #endif
232 /* Macros to map Winelib names to the correct implementation name */
233 /* Note that Winelib is purely Win32. */
235 #ifdef __WINESRC__
236 #define WINE_NO_UNICODE_MACROS 1
237 #define WINE_STRICT_PROTOTYPES 1
238 #endif
240 #ifdef WINE_NO_UNICODE_MACROS
241 # define WINELIB_NAME_AW(func) \
242 func##_must_be_suffixed_with_W_or_A_in_this_context \
243 func##_must_be_suffixed_with_W_or_A_in_this_context
244 #else /* WINE_NO_UNICODE_MACROS */
245 # ifdef UNICODE
246 # define WINELIB_NAME_AW(func) func##W
247 # else
248 # define WINELIB_NAME_AW(func) func##A
249 # endif
250 #endif /* WINE_NO_UNICODE_MACROS */
252 #ifdef WINE_NO_UNICODE_MACROS
253 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
254 #else
255 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
256 #endif
258 #include <winnt.h>
260 /* Polymorphic types */
262 typedef UINT_PTR WPARAM;
263 typedef LONG_PTR LPARAM;
264 typedef LONG_PTR LRESULT;
266 /* Integer types */
268 typedef WORD ATOM;
269 typedef DWORD COLORREF, *LPCOLORREF;
272 /* Handle types */
274 typedef int HFILE;
275 DECLARE_HANDLE(HACCEL);
276 DECLARE_HANDLE(HBITMAP);
277 DECLARE_HANDLE(HBRUSH);
278 DECLARE_HANDLE(HCOLORSPACE);
279 DECLARE_HANDLE(HDC);
280 DECLARE_HANDLE(HDESK);
281 DECLARE_HANDLE(HENHMETAFILE);
282 DECLARE_HANDLE(HFONT);
283 DECLARE_HANDLE(HGLRC);
284 DECLARE_HANDLE(HHOOK);
285 DECLARE_HANDLE(HICON);
286 DECLARE_HANDLE(HINSTANCE);
287 DECLARE_HANDLE(HKEY);
288 typedef HKEY *PHKEY;
289 DECLARE_HANDLE(HKL);
290 DECLARE_HANDLE(HMENU);
291 DECLARE_HANDLE(HMETAFILE);
292 DECLARE_HANDLE(HMONITOR);
293 DECLARE_HANDLE(HPALETTE);
294 DECLARE_HANDLE(HPEN);
295 DECLARE_HANDLE(HRGN);
296 DECLARE_HANDLE(HRSRC);
297 DECLARE_HANDLE(HTASK);
298 DECLARE_HANDLE(HWINEVENTHOOK);
299 DECLARE_HANDLE(HWINSTA);
300 DECLARE_HANDLE(HWND);
302 /* Handle types that must remain interchangeable even with strict on */
304 typedef HINSTANCE HMODULE;
305 typedef HANDLE HGDIOBJ;
306 typedef HANDLE HGLOBAL;
307 typedef HANDLE HLOCAL;
308 typedef HANDLE GLOBALHANDLE;
309 typedef HANDLE LOCALHANDLE;
310 typedef HICON HCURSOR;
312 /* Callback function pointers types */
314 #ifdef WINE_STRICT_PROTOTYPES
315 typedef INT_PTR (CALLBACK *FARPROC)(void);
316 typedef INT_PTR (CALLBACK *NEARPROC)(void);
317 typedef INT_PTR (CALLBACK *PROC)(void);
318 #else
319 typedef INT_PTR (CALLBACK *FARPROC)();
320 typedef INT_PTR (CALLBACK *NEARPROC)();
321 typedef INT_PTR (CALLBACK *PROC)();
322 #endif
324 /* Macros to split words and longs. */
326 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
327 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
329 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
330 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
332 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
333 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
335 /* min and max macros */
336 #ifndef NOMINMAX
337 #ifndef max
338 #define max(a,b) (((a) > (b)) ? (a) : (b))
339 #endif
340 #ifndef min
341 #define min(a,b) (((a) < (b)) ? (a) : (b))
342 #endif
343 #endif /* NOMINMAX */
345 #ifdef MAX_PATH /* Work-around for Mingw */
346 #undef MAX_PATH
347 #endif /* MAX_PATH */
349 #define MAX_PATH 260
350 #define HFILE_ERROR ((HFILE)-1)
352 /* The SIZE structure */
353 typedef struct tagSIZE
355 LONG cx;
356 LONG cy;
357 } SIZE, *PSIZE, *LPSIZE;
359 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
361 /* The POINT structure */
362 typedef struct tagPOINT
364 LONG x;
365 LONG y;
366 } POINT, *PPOINT, *LPPOINT;
368 typedef struct _POINTL
370 LONG x;
371 LONG y;
372 } POINTL, *PPOINTL;
374 /* The POINTS structure */
376 typedef struct tagPOINTS
378 #ifdef WORDS_BIGENDIAN
379 SHORT y;
380 SHORT x;
381 #else
382 SHORT x;
383 SHORT y;
384 #endif
385 } POINTS, *PPOINTS, *LPPOINTS;
387 typedef struct _FILETIME {
388 #ifdef WORDS_BIGENDIAN
389 DWORD dwHighDateTime;
390 DWORD dwLowDateTime;
391 #else
392 DWORD dwLowDateTime;
393 DWORD dwHighDateTime;
394 #endif
395 } FILETIME, *PFILETIME, *LPFILETIME;
396 #define _FILETIME_
398 /* The RECT structure */
399 typedef struct tagRECT
401 LONG left;
402 LONG top;
403 LONG right;
404 LONG bottom;
405 } RECT, *PRECT, *LPRECT;
406 typedef const RECT *LPCRECT;
408 typedef struct _RECTL
410 LONG left;
411 LONG top;
412 LONG right;
413 LONG bottom;
414 } RECTL, *PRECTL, *LPRECTL;
416 typedef const RECTL *LPCRECTL;
418 #ifdef __cplusplus
420 #endif
422 #endif /* _WINDEF_ */