b1de03d90df79fd83694383f2f653f6e224bf4f7
[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 #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 NONAMELESSUNION
208 #ifdef __GNUC__
209 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
210 #define _ANONYMOUS_UNION __extension__
211 #define _ANONYMOUS_STRUCT __extension__
212 #else
213 #if defined(__cplusplus)
214 #define _ANONYMOUS_UNION __extension__
215 #endif /* __cplusplus */
216 #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
217 #elif defined(__WATCOMC__) || defined(_MSC_VER)
218 #define _ANONYMOUS_UNION
219 #define _ANONYMOUS_STRUCT
220 #endif /* __GNUC__/__WATCOMC__ */
221 #endif /* NONAMELESSUNION */
222
223 #ifndef _ANONYMOUS_UNION
224 #define _ANONYMOUS_UNION
225 #define _UNION_NAME(x) x
226 #define DUMMYUNIONNAME u
227 #define DUMMYUNIONNAME1 u1
228 #define DUMMYUNIONNAME2 u2
229 #define DUMMYUNIONNAME3 u3
230 #define DUMMYUNIONNAME4 u4
231 #define DUMMYUNIONNAME5 u5
232 #define DUMMYUNIONNAME6 u6
233 #define DUMMYUNIONNAME7 u7
234 #define DUMMYUNIONNAME8 u8
235 #else
236 #define _UNION_NAME(x)
237 #define DUMMYUNIONNAME
238 #define DUMMYUNIONNAME1
239 #define DUMMYUNIONNAME2
240 #define DUMMYUNIONNAME3
241 #define DUMMYUNIONNAME4
242 #define DUMMYUNIONNAME5
243 #define DUMMYUNIONNAME6
244 #define DUMMYUNIONNAME7
245 #define DUMMYUNIONNAME8
246 #endif
247 #ifndef _ANONYMOUS_STRUCT
248 #define _ANONYMOUS_STRUCT
249 #define _STRUCT_NAME(x) x
250 #define DUMMYSTRUCTNAME s
251 #define DUMMYSTRUCTNAME1 s1
252 #define DUMMYSTRUCTNAME2 s2
253 #define DUMMYSTRUCTNAME3 s3
254 #define DUMMYSTRUCTNAME4 s4
255 #define DUMMYSTRUCTNAME5 s5
256 #else
257 #define _STRUCT_NAME(x)
258 #define DUMMYSTRUCTNAME
259 #define DUMMYSTRUCTNAME1
260 #define DUMMYSTRUCTNAME2
261 #define DUMMYSTRUCTNAME3
262 #define DUMMYSTRUCTNAME4
263 #define DUMMYSTRUCTNAME5
264 #endif
265
266 #ifndef NO_STRICT
267 #ifndef STRICT
268 #define STRICT 1
269 #endif
270 #endif
271
272 #ifndef DWORD_DEFINED
273 #define DWORD_DEFINED
274 #ifndef __ROS_LONG64__
275 typedef unsigned long DWORD;
276 #else
277 typedef unsigned int DWORD;
278 #endif
279 #endif//DWORD_DEFINED
280
281 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
282 /* FIXME: Is there a good solution to this? */
283 #ifndef XFree86Server
284 #ifndef __OBJC__
285 typedef WINBOOL BOOL;
286 #else
287 #define BOOL WINBOOL
288 #endif
289 typedef unsigned char BYTE;
290 #endif /* ndef XFree86Server */
291 typedef BOOL *PBOOL,*LPBOOL;
292 typedef unsigned short WORD;
293 typedef float FLOAT;
294 typedef FLOAT *PFLOAT;
295 typedef BYTE *PBYTE,*LPBYTE;
296 typedef int *PINT,*LPINT;
297 typedef WORD *PWORD,*LPWORD;
298 #ifndef __ROS_LONG64__
299 typedef long *LPLONG;
300 #else
301 typedef int *LPLONG;
302 #endif
303 typedef DWORD *PDWORD,*LPDWORD;
304 typedef CONST void *PCVOID,*LPCVOID;
305
306 typedef unsigned int UINT,*PUINT,*LPUINT;
307
308 typedef void *LPVOID;
309
310 #ifndef __ms_va_list
311 # if defined(__x86_64__) && defined (__GNUC__)
312 # define __ms_va_list __builtin_ms_va_list
313 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
314 # define __ms_va_end(list) __builtin_ms_va_end(list)
315 # else
316 # define __ms_va_list va_list
317 # define __ms_va_start(list,arg) va_start(list,arg)
318 # define __ms_va_end(list) va_end(list)
319 # endif
320 #endif
321
322 //
323 // Check if ntdef.h already defined these for us
324 //
325 #ifndef BASETYPES
326 #define BASETYPES
327 #ifndef __ROS_LONG64__
328 typedef unsigned long ULONG, *PULONG;
329 #else
330 typedef unsigned int ULONG, *PULONG;
331 #endif
332 typedef unsigned short USHORT, *PUSHORT;
333 typedef unsigned char UCHAR, *PUCHAR;
334 typedef char *PSZ;
335 typedef int INT;
336 #endif /* BASETYPES */
337
338 #ifndef NT_INCLUDED
339 #include <winnt.h>
340 #endif
341
342 typedef HANDLE *LPHANDLE;
343 typedef UINT_PTR WPARAM;
344 typedef LONG_PTR LPARAM;
345 typedef LONG_PTR LRESULT;
346 #ifndef _HRESULT_DEFINED
347 typedef LONG HRESULT;
348 #define _HRESULT_DEFINED
349 #endif
350 #ifndef XFree86Server
351 typedef WORD ATOM;
352 #endif /* XFree86Server */
353 typedef HANDLE HGLOBAL;
354 typedef HANDLE HLOCAL;
355 typedef HANDLE GLOBALHANDLE;
356 typedef HANDLE LOCALHANDLE;
357 typedef void *HGDIOBJ;
358 DECLARE_HANDLE(HACCEL);
359 DECLARE_HANDLE(HBITMAP);
360 DECLARE_HANDLE(HBRUSH);
361 DECLARE_HANDLE(HCOLORSPACE);
362 DECLARE_HANDLE(HDC);
363 DECLARE_HANDLE(HGLRC);
364 DECLARE_HANDLE(HDESK);
365 DECLARE_HANDLE(HENHMETAFILE);
366 DECLARE_HANDLE(HFONT);
367 DECLARE_HANDLE(HICON);
368 DECLARE_HANDLE(HKEY);
369 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
370 /* #if (WINVER >= 0x0500) */
371 DECLARE_HANDLE(HMONITOR);
372 DECLARE_HANDLE(HUMPD);
373 #define HMONITOR_DECLARED 1
374 DECLARE_HANDLE(HTERMINAL);
375 DECLARE_HANDLE(HWINEVENTHOOK);
376 /* #endif */
377 typedef HKEY *PHKEY;
378 DECLARE_HANDLE(HMENU);
379 DECLARE_HANDLE(HMETAFILE);
380 DECLARE_HANDLE(HINSTANCE);
381 typedef HINSTANCE HMODULE;
382 DECLARE_HANDLE(HPALETTE);
383 DECLARE_HANDLE(HPEN);
384 DECLARE_HANDLE(HRGN);
385 DECLARE_HANDLE(HRSRC);
386 DECLARE_HANDLE(HSTR);
387 DECLARE_HANDLE(HTASK);
388 DECLARE_HANDLE(HWND);
389 DECLARE_HANDLE(HWINSTA);
390 DECLARE_HANDLE(HKL);
391 typedef int HFILE;
392 typedef HICON HCURSOR;
393 typedef DWORD COLORREF;
394 #ifdef _WIN64
395 typedef INT_PTR (FAR WINAPI *FARPROC)();
396 typedef INT_PTR (NEAR WINAPI *NEARPROC)();
397 typedef INT_PTR (WINAPI *PROC)();
398 #else
399 typedef int (FAR WINAPI *FARPROC)();
400 typedef int (NEAR WINAPI *NEARPROC)();
401 typedef int (WINAPI *PROC)();
402 #endif
403 typedef struct tagRECT {
404 LONG left;
405 LONG top;
406 LONG right;
407 LONG bottom;
408 } RECT,*PRECT,*LPRECT;
409 typedef const RECT *LPCRECT;
410 typedef struct tagRECTL {
411 LONG left;
412 LONG top;
413 LONG right;
414 LONG bottom;
415 } RECTL,*PRECTL,*LPRECTL;
416 typedef const RECTL *LPCRECTL;
417 typedef struct tagPOINT {
418 LONG x;
419 LONG y;
420 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
421 typedef struct tagSIZE {
422 LONG cx;
423 LONG cy;
424 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
425 typedef struct tagPOINTS {
426 SHORT x;
427 SHORT y;
428 } POINTS,*PPOINTS,*LPPOINTS;
429
430 #ifdef _MSC_VER
431 #pragma warning(pop)
432 #endif
433
434 #ifdef __cplusplus
435 }
436 #endif
437 #endif