Took some advice from alex re: w32api headers. Use ..._DEFINED to override
[reactos.git] / reactos / w32api / include / windef.h
1 #ifndef _WINDEF_H
2 #define _WINDEF_H
3 #if __GNUC__ >=3
4 #pragma GCC system_header
5 #endif
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 #ifndef WINVER
12 #define WINVER 0x0400
13 /*
14 * If you need Win32 API features newer the Win95 and WinNT then you must
15 * define WINVER before including windows.h or any other method of including
16 * the windef.h header.
17 */
18 #endif
19 #ifndef _WIN32_WINNT
20 #define _WIN32_WINNT WINVER
21 /*
22 * There may be the need to define _WIN32_WINNT to a value different from
23 * the value of WINVER. I don't have any example of why you would do that.
24 * However, if you must then define _WIN32_WINNT to the value required before
25 * including windows.h or any other method of including the windef.h header.
26 */
27 #endif
28 #ifndef WIN32
29 #define WIN32
30 #endif
31 #ifndef _WIN32
32 #define _WIN32
33 #endif
34 #define FAR
35 #define far
36 #define NEAR
37 #define near
38 #ifndef CONST
39 #define CONST const
40 #endif
41 #undef MAX_PATH
42 #define MAX_PATH 260
43
44 #ifndef NULL
45 #ifdef __cplusplus
46 #define NULL 0
47 #else
48 #define NULL ((void*)0)
49 #endif
50 #endif
51 #ifndef FALSE
52 #define FALSE 0
53 #endif
54 #ifndef TRUE
55 #define TRUE 1
56 #endif
57 #define IN
58 #define OUT
59 #ifndef OPTIONAL
60 #define OPTIONAL
61 #endif
62
63 #ifdef __GNUC__
64 #define PACKED __attribute__((packed))
65 #ifndef _fastcall
66 #define _fastcall __attribute__((fastcall))
67 #endif
68 #ifndef __fastcall
69 #define __fastcall __attribute__((fastcall))
70 #endif
71 #ifndef _stdcall
72 #define _stdcall __attribute__((stdcall))
73 #endif
74 #ifndef __stdcall
75 #define __stdcall __attribute__((stdcall))
76 #endif
77 #ifndef _cdecl
78 #define _cdecl __attribute__((cdecl))
79 #endif
80 #ifndef __cdecl
81 #define __cdecl __attribute__((cdecl))
82 #endif
83 #ifndef __declspec
84 #define __declspec(e) __attribute__((e))
85 #endif
86 #ifndef _declspec
87 #define _declspec(e) __attribute__((e))
88 #endif
89 #elif defined(__WATCOMC__)
90 #define PACKED
91 #else
92 #define PACKED
93 #define _cdecl
94 #define __cdecl
95 #endif
96
97 #undef pascal
98 #undef _pascal
99 #undef __pascal
100 #define pascal __stdcall
101 #define _pascal __stdcall
102 #define __pascal __stdcall
103 #define PASCAL _pascal
104 #define CDECL _cdecl
105 #define STDCALL __stdcall
106 #define FASTCALL __fastcall
107 #define WINAPI __stdcall
108 #define WINAPIV __cdecl
109 #define APIENTRY __stdcall
110 #define CALLBACK __stdcall
111 #define APIPRIVATE __stdcall
112
113 #define DECLSPEC_IMPORT __declspec(dllimport)
114 #define DECLSPEC_EXPORT __declspec(dllexport)
115 #ifdef __GNUC__
116 #define DECLSPEC_NORETURN __declspec(noreturn)
117 #define DECLARE_STDCALL_P( type ) __stdcall type
118 #elif defined(__WATCOMC__)
119 #define DECLSPEC_NORETURN
120 #define DECLARE_STDCALL_P( type ) type __stdcall
121 #elif defined(_MSC_VER)
122 #define DECLSPEC_NORETURN __declspec(noreturn)
123 #define DECLARE_STDCALL_P( type ) type __stdcall
124 #endif /* __GNUC__/__WATCOMC__ */
125 #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
126 #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
127 #define LOWORD(l) ((WORD)((DWORD)(l)))
128 #define HIWORD(l) ((WORD)(((DWORD)(l)>>16)&0xFFFF))
129 #define LOBYTE(w) ((BYTE)(w))
130 #define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF))
131
132 #ifndef __WATCOMC__
133 #ifndef _export
134 #define _export
135 #endif
136 #ifndef __export
137 #define __export
138 #endif
139 #endif
140
141 #ifndef NOMINMAX
142 #ifndef max
143 #define max(a,b) ((a)>(b)?(a):(b))
144 #endif
145 #ifndef min
146 #define min(a,b) ((a)<(b)?(a):(b))
147 #endif
148 #endif
149
150 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
151 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
152 #define DBG_UNREFERENCED_PARAMETER(P)
153 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
154
155 #ifdef __GNUC__
156 #ifndef NONAMELESSUNION
157 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
158 #define _ANONYMOUS_UNION __extension__
159 #define _ANONYMOUS_STRUCT __extension__
160 #else
161 #if defined(__cplusplus)
162 #define _ANONYMOUS_UNION __extension__
163 #endif /* __cplusplus */
164 #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
165 #endif /* NONAMELESSUNION */
166 #elif defined(__WATCOMC__) || defined(_MSC_VER)
167 #define _ANONYMOUS_UNION
168 #define _ANONYMOUS_STRUCT
169 #endif /* __GNUC__/__WATCOMC__ */
170
171 #ifndef _ANONYMOUS_UNION
172 #define _ANONYMOUS_UNION
173 #define _UNION_NAME(x) x
174 #define DUMMYUNIONNAME u
175 #define DUMMYUNIONNAME2 u2
176 #define DUMMYUNIONNAME3 u3
177 #define DUMMYUNIONNAME4 u4
178 #define DUMMYUNIONNAME5 u5
179 #define DUMMYUNIONNAME6 u6
180 #define DUMMYUNIONNAME7 u7
181 #define DUMMYUNIONNAME8 u8
182 #else
183 #define _UNION_NAME(x)
184 #define DUMMYUNIONNAME
185 #define DUMMYUNIONNAME2
186 #define DUMMYUNIONNAME3
187 #define DUMMYUNIONNAME4
188 #define DUMMYUNIONNAME5
189 #define DUMMYUNIONNAME6
190 #define DUMMYUNIONNAME7
191 #define DUMMYUNIONNAME8
192 #endif
193 #ifndef _ANONYMOUS_STRUCT
194 #define _ANONYMOUS_STRUCT
195 #define _STRUCT_NAME(x) x
196 #define DUMMYSTRUCTNAME s
197 #define DUMMYSTRUCTNAME2 s2
198 #define DUMMYSTRUCTNAME3 s3
199 #else
200 #define _STRUCT_NAME(x)
201 #define DUMMYSTRUCTNAME
202 #define DUMMYSTRUCTNAME2
203 #define DUMMYSTRUCTNAME3
204 #endif
205
206 #ifndef NO_STRICT
207 #ifndef STRICT
208 #define STRICT 1
209 #endif
210 #endif
211
212 /* FIXME: This will make some code compile. The programs will most
213 likely crash when an exception is raised, but at least they will
214 compile. */
215 #if defined (__GNUC__) && defined (__SEH_NOOP)
216 #define __try
217 #define __except(x) if (0) /* don't execute handler */
218 #define __finally
219
220 #define _try __try
221 #define _except __except
222 #define _finally __finally
223 #endif
224
225 #ifndef DWORD_DEFINED
226 #define DWORD_DEFINED
227 typedef unsigned long DWORD;
228 #endif//DWORD_DEFINED
229
230 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
231 /* FIXME: Is there a good solution to this? */
232 #ifndef XFree86Server
233 #ifndef __OBJC__
234 typedef WINBOOL BOOL;
235 #else
236 #define BOOL WINBOOL
237 #endif
238 typedef unsigned char BYTE;
239 #endif /* ndef XFree86Server */
240 typedef BOOL *PBOOL,*LPBOOL;
241 typedef unsigned short WORD;
242 typedef float FLOAT;
243 typedef FLOAT *PFLOAT;
244 typedef BYTE *PBYTE,*LPBYTE;
245 typedef int *PINT,*LPINT;
246 typedef WORD *PWORD,*LPWORD;
247 typedef long *LPLONG;
248 typedef DWORD *PDWORD,*LPDWORD;
249 typedef CONST void *PCVOID,*LPCVOID;
250 typedef int INT;
251 typedef unsigned int UINT,*PUINT,*LPUINT;
252
253 #include <winnt.h>
254
255 typedef UINT_PTR WPARAM;
256 typedef LONG_PTR LPARAM;
257 typedef LONG_PTR LRESULT;
258 #ifndef _HRESULT_DEFINED
259 typedef LONG HRESULT;
260 #define _HRESULT_DEFINED
261 #endif
262 #ifndef XFree86Server
263 typedef WORD ATOM;
264 #endif /* XFree86Server */
265 typedef HANDLE HGLOBAL;
266 typedef HANDLE HLOCAL;
267 typedef HANDLE GLOBALHANDLE;
268 typedef HANDLE LOCALHANDLE;
269 typedef void *HGDIOBJ;
270 DECLARE_HANDLE(HACCEL);
271 DECLARE_HANDLE(HBITMAP);
272 DECLARE_HANDLE(HBRUSH);
273 DECLARE_HANDLE(HCOLORSPACE);
274 DECLARE_HANDLE(HDC);
275 DECLARE_HANDLE(HGLRC);
276 DECLARE_HANDLE(HDESK);
277 DECLARE_HANDLE(HENHMETAFILE);
278 DECLARE_HANDLE(HFONT);
279 DECLARE_HANDLE(HICON);
280 DECLARE_HANDLE(HKEY);
281 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
282 /* #if (WINVER >= 0x0500) */
283 DECLARE_HANDLE(HMONITOR);
284 #define HMONITOR_DECLARED 1
285 DECLARE_HANDLE(HTERMINAL);
286 DECLARE_HANDLE(HWINEVENTHOOK);
287 /* #endif */
288 typedef HKEY *PHKEY;
289 DECLARE_HANDLE(HMENU);
290 DECLARE_HANDLE(HMETAFILE);
291 DECLARE_HANDLE(HINSTANCE);
292 typedef HINSTANCE HMODULE;
293 DECLARE_HANDLE(HPALETTE);
294 DECLARE_HANDLE(HPEN);
295 DECLARE_HANDLE(HRGN);
296 DECLARE_HANDLE(HRSRC);
297 DECLARE_HANDLE(HSTR);
298 DECLARE_HANDLE(HTASK);
299 DECLARE_HANDLE(HWND);
300 DECLARE_HANDLE(HWINSTA);
301 DECLARE_HANDLE(HKL);
302 typedef int HFILE;
303 typedef HICON HCURSOR;
304 typedef DWORD COLORREF;
305 typedef int (WINAPI *FARPROC)();
306 typedef int (WINAPI *NEARPROC)();
307 typedef int (WINAPI *PROC)();
308 typedef struct tagRECT {
309 LONG left;
310 LONG top;
311 LONG right;
312 LONG bottom;
313 } RECT,*PRECT,*LPRECT;
314 typedef const RECT *LPCRECT;
315 typedef struct tagRECTL {
316 LONG left;
317 LONG top;
318 LONG right;
319 LONG bottom;
320 } RECTL,*PRECTL,*LPRECTL;
321 typedef const RECTL *LPCRECTL;
322 typedef struct tagPOINT {
323 LONG x;
324 LONG y;
325 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
326 typedef struct tagSIZE {
327 LONG cx;
328 LONG cy;
329 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
330 typedef struct tagPOINTS {
331 SHORT x;
332 SHORT y;
333 } POINTS,*PPOINTS,*LPPOINTS;
334
335 #ifdef __cplusplus
336 }
337 #endif
338 #endif