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