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