Guard ANONYMOUS defines by __ANONYMOUS_DEFINED guard to prevent double definitions...
[reactos.git] / include / psdk / windef.h
1 #ifndef _WINDEF_H
2 #define _WINDEF_H
3
4 #ifndef _M_AMD64
5 #if !defined(__ROS_LONG64__)
6 #ifdef __WINESRC__
7 #define __ROS_LONG64__
8 #endif
9 #endif
10 #endif
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 #ifdef _MSC_VER
17 #pragma warning(push)
18 #pragma warning(disable:4255)
19 #endif
20
21 #ifndef WINVER
22 #define WINVER 0x0400
23 /*
24 * If you need Win32 API features newer the Win95 and WinNT then you must
25 * define WINVER before including windows.h or any other method of including
26 * the windef.h header.
27 */
28 #endif
29 #ifndef _WIN32_WINNT
30 #define _WIN32_WINNT WINVER
31 /*
32 * There may be the need to define _WIN32_WINNT to a value different from
33 * the value of WINVER. I don't have any example of why you would do that.
34 * However, if you must then define _WIN32_WINNT to the value required before
35 * including windows.h or any other method of including the windef.h header.
36 */
37 #endif
38 #ifndef WIN32
39 #define WIN32
40 #endif
41 #ifndef _WIN32
42 #define _WIN32
43 #endif
44 #define FAR
45 #define far
46 #define NEAR
47 #define near
48 #ifndef CONST
49 #define CONST const
50 #endif
51 #undef MAX_PATH
52 #define MAX_PATH 260
53
54 #ifndef NULL
55 #ifdef __cplusplus
56 #define NULL 0
57 #else
58 #define NULL ((void*)0)
59 #endif
60 #endif
61 #ifndef FALSE
62 #define FALSE 0
63 #endif
64 #ifndef TRUE
65 #define TRUE 1
66 #endif
67 #define IN
68 #define OUT
69 #ifndef OPTIONAL
70 #define OPTIONAL
71 #endif
72
73 /* needed by header files generated by WIDL */
74 #ifdef __WINESRC__
75 #define WINE_NO_UNICODE_MACROS
76 #endif
77
78 #ifdef WINE_NO_UNICODE_MACROS
79 # define WINELIB_NAME_AW(func) \
80 func##_must_be_suffixed_with_W_or_A_in_this_context \
81 func##_must_be_suffixed_with_W_or_A_in_this_context
82 #else /* WINE_NO_UNICODE_MACROS */
83 # ifdef UNICODE
84 # define WINELIB_NAME_AW(func) func##W
85 # else
86 # define WINELIB_NAME_AW(func) func##A
87 # endif
88 #endif /* WINE_NO_UNICODE_MACROS */
89
90 #ifdef WINE_NO_UNICODE_MACROS
91 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
92 #else
93 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
94 #endif
95
96 #ifdef __GNUC__
97 #define PACKED __attribute__((packed))
98 #ifndef _fastcall
99 #define _fastcall __attribute__((fastcall))
100 #endif
101 #ifndef __fastcall
102 #define __fastcall __attribute__((fastcall))
103 #endif
104 #ifndef _stdcall
105 #define _stdcall __attribute__((stdcall))
106 #endif
107 #ifndef __stdcall
108 #define __stdcall __attribute__((stdcall))
109 #endif
110 #ifndef _cdecl
111 #define _cdecl __attribute__((cdecl))
112 #endif
113 #ifndef __cdecl
114 #define __cdecl __attribute__((cdecl))
115 #endif
116 #ifndef __declspec
117 #define __declspec(e) __attribute__((e))
118 #endif
119 #ifndef _declspec
120 #define _declspec(e) __attribute__((e))
121 #endif
122 #elif defined(__WATCOMC__)
123 #define PACKED
124 #else
125 #define PACKED
126 #define _cdecl
127 #define __cdecl
128 #endif
129
130 #undef pascal
131 #undef _pascal
132 #undef __pascal
133 #define pascal __stdcall
134 #define _pascal __stdcall
135 #define __pascal __stdcall
136
137 #define CDECL _cdecl
138
139 #if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED)
140 #define CALLBACK __stdcall
141 #define WINAPI __stdcall
142 #define WINAPIV __cdecl
143 #define APIENTRY WINAPI
144 #define APIPRIVATE __stdcall
145 #define PASCAL __stdcall
146 #else
147 #define CALLBACK
148 #define WINAPI
149 #define WINAPIV
150 #define APIENTRY WINAPI
151 #define APIPRIVATE
152 #define PASCAL pascal
153 #endif
154
155 #define DECLSPEC_IMPORT __declspec(dllimport)
156 #define DECLSPEC_EXPORT __declspec(dllexport)
157 #ifndef DECLSPEC_NOINLINE
158 #if (_MSC_VER >= 1300)
159 #define DECLSPEC_NOINLINE __declspec(noinline)
160 #elif defined(__GNUC__)
161 #define DECLSPEC_NOINLINE __attribute__((noinline))
162 #else
163 #define DECLSPEC_NOINLINE
164 #endif
165 #endif
166 #ifdef __GNUC__
167 #define DECLSPEC_NORETURN __declspec(noreturn)
168 #define DECLARE_STDCALL_P( type ) __stdcall type
169 #elif defined(__WATCOMC__)
170 #define DECLSPEC_NORETURN
171 #define DECLARE_STDCALL_P( type ) type __stdcall
172 #elif defined(_MSC_VER)
173 #define DECLSPEC_NORETURN __declspec(noreturn)
174 #define DECLARE_STDCALL_P( type ) type __stdcall
175 #endif /* __GNUC__/__WATCOMC__ */
176 #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
177 #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
178 #define LOWORD(l) ((WORD)((DWORD_PTR)(l)))
179 #define HIWORD(l) ((WORD)(((DWORD_PTR)(l)>>16)&0xFFFF))
180 #define LOBYTE(w) ((BYTE)(w))
181 #define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF))
182
183 #ifndef __WATCOMC__
184 #ifndef _export
185 #define _export
186 #endif
187 #ifndef __export
188 #define __export
189 #endif
190 #endif
191
192 #ifndef NOMINMAX
193 #ifndef max
194 #define max(a,b) ((a)>(b)?(a):(b))
195 #endif
196
197 #ifndef min
198 #define min(a,b) ((a)<(b)?(a):(b))
199 #endif
200 #endif
201
202 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
203 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
204 #define DBG_UNREFERENCED_PARAMETER(P)
205 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
206
207 #ifndef __ANONYMOUS_DEFINED
208 #define __ANONYMOUS_DEFINED
209
210 #ifndef NONAMELESSUNION
211 #ifdef __GNUC__
212 #define _ANONYMOUS_UNION __extension__
213 #define _ANONYMOUS_STRUCT __extension__
214 #elif defined(__WATCOMC__) || defined(_MSC_VER)
215 #define _ANONYMOUS_UNION
216 #define _ANONYMOUS_STRUCT
217 #endif /* __GNUC__/__WATCOMC__ */
218 #endif /* NONAMELESSUNION */
219
220 #ifndef _ANONYMOUS_UNION
221 #define _ANONYMOUS_UNION
222 #define _UNION_NAME(x) x
223 #define DUMMYUNIONNAME u
224 #define DUMMYUNIONNAME1 u1
225 #define DUMMYUNIONNAME2 u2
226 #define DUMMYUNIONNAME3 u3
227 #define DUMMYUNIONNAME4 u4
228 #define DUMMYUNIONNAME5 u5
229 #define DUMMYUNIONNAME6 u6
230 #define DUMMYUNIONNAME7 u7
231 #define DUMMYUNIONNAME8 u8
232 #else
233 #define _UNION_NAME(x)
234 #define DUMMYUNIONNAME
235 #define DUMMYUNIONNAME1
236 #define DUMMYUNIONNAME2
237 #define DUMMYUNIONNAME3
238 #define DUMMYUNIONNAME4
239 #define DUMMYUNIONNAME5
240 #define DUMMYUNIONNAME6
241 #define DUMMYUNIONNAME7
242 #define DUMMYUNIONNAME8
243 #endif
244 #ifndef _ANONYMOUS_STRUCT
245 #define _ANONYMOUS_STRUCT
246 #define _STRUCT_NAME(x) x
247 #define DUMMYSTRUCTNAME s
248 #define DUMMYSTRUCTNAME1 s1
249 #define DUMMYSTRUCTNAME2 s2
250 #define DUMMYSTRUCTNAME3 s3
251 #define DUMMYSTRUCTNAME4 s4
252 #define DUMMYSTRUCTNAME5 s5
253 #else
254 #define _STRUCT_NAME(x)
255 #define DUMMYSTRUCTNAME
256 #define DUMMYSTRUCTNAME1
257 #define DUMMYSTRUCTNAME2
258 #define DUMMYSTRUCTNAME3
259 #define DUMMYSTRUCTNAME4
260 #define DUMMYSTRUCTNAME5
261 #endif
262
263 #endif /* __ANONYMOUS_DEFINED */
264
265 #ifndef NO_STRICT
266 #ifndef STRICT
267 #define STRICT 1
268 #endif
269 #endif
270
271 #ifndef DWORD_DEFINED
272 #define DWORD_DEFINED
273 #ifndef __ROS_LONG64__
274 typedef unsigned long DWORD;
275 #else
276 typedef unsigned int DWORD;
277 #endif
278 #endif//DWORD_DEFINED
279
280 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
281 /* FIXME: Is there a good solution to this? */
282 #ifndef XFree86Server
283 #ifndef __OBJC__
284 typedef WINBOOL BOOL;
285 #else
286 #define BOOL WINBOOL
287 #endif
288 typedef unsigned char BYTE;
289 #endif /* ndef XFree86Server */
290 typedef BOOL *PBOOL,*LPBOOL;
291 typedef unsigned short WORD;
292 typedef float FLOAT;
293 typedef FLOAT *PFLOAT;
294 typedef BYTE *PBYTE,*LPBYTE;
295 typedef int *PINT,*LPINT;
296 typedef WORD *PWORD,*LPWORD;
297 #ifndef __ROS_LONG64__
298 typedef long *LPLONG;
299 #else
300 typedef int *LPLONG;
301 #endif
302 typedef DWORD *PDWORD,*LPDWORD;
303 typedef CONST void *PCVOID,*LPCVOID;
304
305 typedef unsigned int UINT,*PUINT,*LPUINT;
306
307 typedef void *LPVOID;
308
309 #ifndef __ms_va_list
310 # if defined(__x86_64__) && defined (__GNUC__)
311 # define __ms_va_list __builtin_ms_va_list
312 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
313 # define __ms_va_end(list) __builtin_ms_va_end(list)
314 # else
315 # define __ms_va_list va_list
316 # define __ms_va_start(list,arg) va_start(list,arg)
317 # define __ms_va_end(list) va_end(list)
318 # endif
319 #endif
320
321 //
322 // Check if ntdef.h already defined these for us
323 //
324 #ifndef BASETYPES
325 #define BASETYPES
326 #ifndef __ROS_LONG64__
327 typedef unsigned long ULONG, *PULONG;
328 #else
329 typedef unsigned int ULONG, *PULONG;
330 #endif
331 typedef unsigned short USHORT, *PUSHORT;
332 typedef unsigned char UCHAR, *PUCHAR;
333 typedef char *PSZ;
334 typedef int INT;
335 #endif /* BASETYPES */
336
337 #ifndef NT_INCLUDED
338 #include <winnt.h>
339 #endif
340
341 typedef HANDLE *LPHANDLE;
342 typedef UINT_PTR WPARAM;
343 typedef LONG_PTR LPARAM;
344 typedef LONG_PTR LRESULT;
345 #ifndef _HRESULT_DEFINED
346 typedef LONG HRESULT;
347 #define _HRESULT_DEFINED
348 #endif
349 #ifndef XFree86Server
350 typedef WORD ATOM;
351 #endif /* XFree86Server */
352 typedef HANDLE HGLOBAL;
353 typedef HANDLE HLOCAL;
354 typedef HANDLE GLOBALHANDLE;
355 typedef HANDLE LOCALHANDLE;
356 typedef void *HGDIOBJ;
357 DECLARE_HANDLE(HACCEL);
358 DECLARE_HANDLE(HBITMAP);
359 DECLARE_HANDLE(HBRUSH);
360 DECLARE_HANDLE(HCOLORSPACE);
361 DECLARE_HANDLE(HDC);
362 DECLARE_HANDLE(HGLRC);
363 DECLARE_HANDLE(HDESK);
364 DECLARE_HANDLE(HENHMETAFILE);
365 DECLARE_HANDLE(HFONT);
366 DECLARE_HANDLE(HICON);
367 DECLARE_HANDLE(HKEY);
368 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
369 /* #if (WINVER >= 0x0500) */
370 DECLARE_HANDLE(HMONITOR);
371 DECLARE_HANDLE(HUMPD);
372 #define HMONITOR_DECLARED 1
373 DECLARE_HANDLE(HTERMINAL);
374 DECLARE_HANDLE(HWINEVENTHOOK);
375 /* #endif */
376 typedef HKEY *PHKEY;
377 DECLARE_HANDLE(HMENU);
378 DECLARE_HANDLE(HMETAFILE);
379 DECLARE_HANDLE(HINSTANCE);
380 typedef HINSTANCE HMODULE;
381 DECLARE_HANDLE(HPALETTE);
382 DECLARE_HANDLE(HPEN);
383 DECLARE_HANDLE(HRGN);
384 DECLARE_HANDLE(HRSRC);
385 DECLARE_HANDLE(HSTR);
386 DECLARE_HANDLE(HTASK);
387 DECLARE_HANDLE(HWND);
388 DECLARE_HANDLE(HWINSTA);
389 DECLARE_HANDLE(HKL);
390 typedef int HFILE;
391 typedef HICON HCURSOR;
392 typedef DWORD COLORREF;
393 #ifdef _WIN64
394 typedef INT_PTR (FAR WINAPI *FARPROC)();
395 typedef INT_PTR (NEAR WINAPI *NEARPROC)();
396 typedef INT_PTR (WINAPI *PROC)();
397 #else
398 typedef int (FAR WINAPI *FARPROC)();
399 typedef int (NEAR WINAPI *NEARPROC)();
400 typedef int (WINAPI *PROC)();
401 #endif
402 typedef struct tagRECT {
403 LONG left;
404 LONG top;
405 LONG right;
406 LONG bottom;
407 } RECT,*PRECT,*LPRECT;
408 typedef const RECT *LPCRECT;
409 typedef struct tagRECTL {
410 LONG left;
411 LONG top;
412 LONG right;
413 LONG bottom;
414 } RECTL,*PRECTL,*LPRECTL;
415 typedef const RECTL *LPCRECTL;
416 typedef struct tagPOINT {
417 LONG x;
418 LONG y;
419 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
420 typedef struct tagSIZE {
421 LONG cx;
422 LONG cy;
423 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
424 typedef struct tagPOINTS {
425 SHORT x;
426 SHORT y;
427 } POINTS,*PPOINTS,*LPPOINTS;
428
429 #ifdef _MSC_VER
430 #pragma warning(pop)
431 #endif
432
433 #ifdef __cplusplus
434 }
435 #endif
436 #endif