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