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