[PSDK]
[reactos.git] / reactos / include / psdk / windef.h
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6 #ifndef _WINDEF_
7 #define _WINDEF_
8
9 #define _WINDEF_H // wine ...
10
11 #ifdef _MSC_VER
12 #pragma warning(push)
13 #pragma warning(disable:4255)
14 #endif
15
16 #ifndef _M_AMD64
17 #if !defined(__ROS_LONG64__)
18 #ifdef __WINESRC__
19 #define __ROS_LONG64__
20 #endif
21 #endif
22 #endif
23
24 #ifndef NO_STRICT
25 #ifndef STRICT
26 #define STRICT 1
27 #endif
28 #endif
29
30 #ifndef WIN32
31 #define WIN32
32 #endif
33
34 #if defined(_MAC) && !defined(_WIN32)
35 #define _WIN32
36 #endif
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #ifndef WINVER
43 #define WINVER 0x0502
44 #endif
45
46 #ifndef BASETYPES
47 #define BASETYPES
48 #ifndef __ROS_LONG64__
49 typedef unsigned long ULONG;
50 #else
51 typedef unsigned int ULONG;
52 #endif
53 typedef ULONG *PULONG;
54 typedef unsigned short USHORT;
55 typedef USHORT *PUSHORT;
56 typedef unsigned char UCHAR;
57 typedef UCHAR *PUCHAR;
58 typedef char *PSZ;
59 typedef int INT;
60 #endif /* BASETYPES */
61
62 #undef MAX_PATH
63 #define MAX_PATH 260
64
65 #ifndef NULL
66 #ifdef __cplusplus
67 #ifndef _WIN64
68 #define NULL 0
69 #else
70 #define NULL 0LL
71 #endif /* W64 */
72 #else
73 #define NULL ((void *)0)
74 #endif
75 #endif
76
77 #ifndef FALSE
78 #define FALSE 0
79 #endif
80
81 #ifndef TRUE
82 #define TRUE 1
83 #endif
84
85 #ifndef _NO_W32_PSEUDO_MODIFIERS
86 #ifndef IN
87 #define IN
88 #endif
89 #ifndef OUT
90 #define OUT
91 #endif
92 #ifndef OPTIONAL
93 #define OPTIONAL
94 #endif
95 #endif
96
97 #ifdef __GNUC__
98 #define PACKED __attribute__((packed))
99 #ifndef __declspec
100 #define __declspec(e) __attribute__((e))
101 #endif
102 #ifndef _declspec
103 #define _declspec(e) __attribute__((e))
104 #endif
105 #elif defined(__WATCOMC__)
106 #define PACKED
107 #else
108 #define PACKED
109 #define _cdecl
110 #define __cdecl
111 #endif
112
113 #ifdef __GNUC__
114 #define DECLSPEC_NORETURN __declspec(noreturn)
115 #define DECLARE_STDCALL_P( type ) __stdcall type
116 #elif defined(__WATCOMC__)
117 #define DECLSPEC_NORETURN
118 #define DECLARE_STDCALL_P( type ) type __stdcall
119 #elif defined(_MSC_VER)
120 #define DECLSPEC_NORETURN __declspec(noreturn)
121 #define DECLARE_STDCALL_P( type ) type __stdcall
122 #endif /* __GNUC__/__WATCOMC__ */
123
124 #define DECLSPEC_IMPORT __declspec(dllimport)
125 #define DECLSPEC_EXPORT __declspec(dllexport)
126 #ifndef DECLSPEC_NOINLINE
127 #if (_MSC_VER >= 1300)
128 #define DECLSPEC_NOINLINE __declspec(noinline)
129 #elif defined(__GNUC__)
130 #define DECLSPEC_NOINLINE __attribute__((noinline))
131 #else
132 #define DECLSPEC_NOINLINE
133 #endif
134 #endif
135
136 #undef far
137 #undef near
138 #undef pascal
139
140 #define far
141 #define near
142 #define pascal __stdcall
143
144 //#define cdecl _cdecl
145 #ifndef CDECL
146 #define CDECL _cdecl
147 #endif
148
149 #if !defined(__x86_64__) //defined(_STDCALL_SUPPORTED)
150 #ifndef CALLBACK
151 #define CALLBACK __stdcall
152 #endif
153 #ifndef WINAPI
154 #define WINAPI __stdcall
155 #endif
156 #define WINAPIV __cdecl
157 #define APIENTRY WINAPI
158 #define APIPRIVATE WINAPI
159 #define PASCAL WINAPI
160 #else
161 #define CALLBACK
162 #define WINAPI
163 #define WINAPIV
164 #define APIENTRY WINAPI
165 #define APIPRIVATE
166 #define PASCAL pascal
167 #endif
168
169 #undef FAR
170 #undef NEAR
171 #define FAR
172 #define NEAR
173
174 #ifndef CONST
175 #define CONST const
176 #endif
177
178 #ifndef _DEF_WINBOOL_
179 #define _DEF_WINBOOL_
180 typedef int WINBOOL;
181 #pragma push_macro("BOOL")
182 #undef BOOL
183 #if !defined(__OBJC__) && !defined(__OBJC_BOOL) && !defined(__objc_INCLUDE_GNU)
184 typedef int BOOL;
185 #endif
186 #define BOOL WINBOOL
187 typedef BOOL *PBOOL;
188 typedef BOOL *LPBOOL;
189 #pragma pop_macro("BOOL")
190 #endif /* _DEF_WINBOOL_ */
191
192 typedef unsigned char BYTE;
193 typedef unsigned short WORD;
194 #ifndef __ROS_LONG64__
195 typedef unsigned long DWORD;
196 #else
197 typedef unsigned int DWORD;
198 #endif
199 typedef float FLOAT;
200 typedef FLOAT *PFLOAT;
201 typedef BYTE *PBYTE;
202 typedef BYTE *LPBYTE;
203 typedef int *PINT;
204 typedef int *LPINT;
205 typedef WORD *PWORD;
206 typedef WORD *LPWORD;
207 #ifndef __ROS_LONG64__
208 typedef long *LPLONG;
209 #else
210 typedef int *LPLONG;
211 #endif
212 typedef DWORD *PDWORD;
213 typedef DWORD *LPDWORD;
214 typedef void *LPVOID;
215 #ifndef _LPCVOID_DEFINED
216 #define _LPCVOID_DEFINED
217 typedef CONST void *LPCVOID;
218 #endif
219 //typedef int INT;
220 typedef unsigned int UINT;
221 typedef unsigned int *PUINT;
222 typedef unsigned int *LPUINT;
223
224
225
226
227 #ifndef NT_INCLUDED
228 #include <winnt.h>
229 #endif
230
231 //#include <specstrings.h>
232
233 typedef UINT_PTR WPARAM;
234 typedef LONG_PTR LPARAM;
235 typedef LONG_PTR LRESULT;
236 #ifndef _HRESULT_DEFINED
237 typedef LONG HRESULT;
238 #define _HRESULT_DEFINED
239 #endif
240
241 #ifndef NOMINMAX
242 #ifndef max
243 #define max(a,b) (((a) > (b)) ? (a) : (b))
244 #endif
245 #ifndef min
246 #define min(a,b) (((a) < (b)) ? (a) : (b))
247 #endif
248 #endif
249
250 #define MAKEWORD(a,b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8))
251 #define MAKELONG(a,b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16))
252 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff))
253 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
254 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff))
255 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
256
257 #ifndef WIN_INTERNAL
258 DECLARE_HANDLE (HWND);
259 //DECLARE_HANDLE (HHOOK);
260 #ifdef WINABLE
261 DECLARE_HANDLE (HEVENT);
262 #endif
263 #endif
264
265 typedef WORD ATOM;
266
267 typedef HANDLE *SPHANDLE;
268 typedef HANDLE *LPHANDLE;
269 typedef HANDLE HGLOBAL;
270 typedef HANDLE HLOCAL;
271 typedef HANDLE GLOBALHANDLE;
272 typedef HANDLE LOCALHANDLE;
273 #ifdef _WIN64
274 typedef INT_PTR (WINAPI *FARPROC)();
275 typedef INT_PTR (WINAPI *NEARPROC)();
276 typedef INT_PTR (WINAPI *PROC)();
277 #else
278 typedef int (WINAPI *FARPROC)();
279 typedef int (WINAPI *NEARPROC)();
280 typedef int (WINAPI *PROC)();
281 #endif
282
283 typedef void *HGDIOBJ;
284
285 DECLARE_HANDLE(HKEY);
286 typedef HKEY *PHKEY;
287
288 DECLARE_HANDLE(HACCEL);
289 DECLARE_HANDLE(HBITMAP);
290 DECLARE_HANDLE(HBRUSH);
291 DECLARE_HANDLE(HCOLORSPACE);
292 DECLARE_HANDLE(HDC);
293 DECLARE_HANDLE(HGLRC);
294 DECLARE_HANDLE(HDESK);
295 DECLARE_HANDLE(HENHMETAFILE);
296 DECLARE_HANDLE(HFONT);
297 DECLARE_HANDLE(HICON);
298 DECLARE_HANDLE(HMENU);
299 DECLARE_HANDLE(HMETAFILE);
300 DECLARE_HANDLE(HINSTANCE);
301 typedef HINSTANCE HMODULE;
302 DECLARE_HANDLE(HPALETTE);
303 DECLARE_HANDLE(HPEN);
304 DECLARE_HANDLE(HRGN);
305 DECLARE_HANDLE(HRSRC);
306 DECLARE_HANDLE(HSTR);
307 DECLARE_HANDLE(HTASK);
308 DECLARE_HANDLE(HWINSTA);
309 DECLARE_HANDLE(HKL);
310 DECLARE_HANDLE(HMONITOR);
311 DECLARE_HANDLE(HWINEVENTHOOK);
312 DECLARE_HANDLE(HUMPD);
313
314 typedef int HFILE;
315 typedef HICON HCURSOR;
316 typedef DWORD COLORREF;
317 typedef DWORD *LPCOLORREF;
318
319 #define HFILE_ERROR ((HFILE)-1)
320
321 typedef struct tagRECT {
322 LONG left;
323 LONG top;
324 LONG right;
325 LONG bottom;
326 } RECT,*PRECT,*NPRECT,*LPRECT;
327
328 typedef const RECT *LPCRECT;
329
330 typedef struct _RECTL {
331 LONG left;
332 LONG top;
333 LONG right;
334 LONG bottom;
335 } RECTL,*PRECTL,*LPRECTL;
336
337 typedef const RECTL *LPCRECTL;
338
339 typedef struct tagPOINT {
340 LONG x;
341 LONG y;
342 } POINT,*PPOINT,*NPPOINT,*LPPOINT;
343
344 typedef struct _POINTL {
345 LONG x;
346 LONG y;
347 } POINTL,*PPOINTL;
348
349 typedef struct tagSIZE {
350 LONG cx;
351 LONG cy;
352 } SIZE,*PSIZE,*LPSIZE;
353
354 typedef SIZE SIZEL;
355 typedef SIZE *PSIZEL,*LPSIZEL;
356
357 typedef struct tagPOINTS {
358 SHORT x;
359 SHORT y;
360 } POINTS,*PPOINTS,*LPPOINTS;
361
362 typedef struct _FILETIME {
363 DWORD dwLowDateTime;
364 DWORD dwHighDateTime;
365 } FILETIME,*PFILETIME,*LPFILETIME;
366 #define _FILETIME_
367
368 #define DM_UPDATE 1
369 #define DM_COPY 2
370 #define DM_PROMPT 4
371 #define DM_MODIFY 8
372
373 #define DM_IN_BUFFER DM_MODIFY
374 #define DM_IN_PROMPT DM_PROMPT
375 #define DM_OUT_BUFFER DM_COPY
376 #define DM_OUT_DEFAULT DM_UPDATE
377
378 #define DC_FIELDS 1
379 #define DC_PAPERS 2
380 #define DC_PAPERSIZE 3
381 #define DC_MINEXTENT 4
382 #define DC_MAXEXTENT 5
383 #define DC_BINS 6
384 #define DC_DUPLEX 7
385 #define DC_SIZE 8
386 #define DC_EXTRA 9
387 #define DC_VERSION 10
388 #define DC_DRIVER 11
389 #define DC_BINNAMES 12
390 #define DC_ENUMRESOLUTIONS 13
391 #define DC_FILEDEPENDENCIES 14
392 #define DC_TRUETYPE 15
393 #define DC_PAPERNAMES 16
394 #define DC_ORIENTATION 17
395 #define DC_COPIES 18
396
397 /* needed by header files generated by WIDL */
398 #ifdef __WINESRC__
399 #define WINE_NO_UNICODE_MACROS
400 #endif
401
402 #ifdef WINE_NO_UNICODE_MACROS
403 # define WINELIB_NAME_AW(func) \
404 func##_must_be_suffixed_with_W_or_A_in_this_context \
405 func##_must_be_suffixed_with_W_or_A_in_this_context
406 #else /* WINE_NO_UNICODE_MACROS */
407 # ifdef UNICODE
408 # define WINELIB_NAME_AW(func) func##W
409 # else
410 # define WINELIB_NAME_AW(func) func##A
411 # endif
412 #endif /* WINE_NO_UNICODE_MACROS */
413
414 #ifdef WINE_NO_UNICODE_MACROS
415 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
416 #else
417 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
418 #endif
419
420 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
421 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
422 #define DBG_UNREFERENCED_PARAMETER(P)
423 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
424
425 #ifndef __WATCOMC__
426 #ifndef _export
427 #define _export
428 #endif
429 #ifndef __export
430 #define __export
431 #endif
432 #endif
433
434 #if 0
435 #ifdef __GNUC__
436 #define PACKED __attribute__((packed))
437 //#ifndef _fastcall
438 //#define _fastcall __attribute__((fastcall))
439 //#endif
440 //#ifndef __fastcall
441 //#define __fastcall __attribute__((fastcall))
442 //#endif
443 //#ifndef _stdcall
444 //#define _stdcall __attribute__((stdcall))
445 //#endif
446 //#ifndef __stdcall
447 //#define __stdcall __attribute__((stdcall))
448 //#endif
449 //#ifndef _cdecl
450 //#define _cdecl __attribute__((cdecl))
451 //#endif
452 //#ifndef __cdecl
453 //#define __cdecl __attribute__((cdecl))
454 //#endif
455 #ifndef __declspec
456 #define __declspec(e) __attribute__((e))
457 #endif
458 #ifndef _declspec
459 #define _declspec(e) __attribute__((e))
460 #endif
461 #elif defined(__WATCOMC__)
462 #define PACKED
463 #else
464 #define PACKED
465 #define _cdecl
466 #define __cdecl
467 #endif
468 #endif
469
470 #if 1 // needed by shlwapi.h
471 #ifndef __ms_va_list
472 # if defined(__x86_64__) && defined (__GNUC__)
473 # define __ms_va_list __builtin_ms_va_list
474 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
475 # define __ms_va_end(list) __builtin_ms_va_end(list)
476 # else
477 # define __ms_va_list va_list
478 # define __ms_va_start(list,arg) va_start(list,arg)
479 # define __ms_va_end(list) va_end(list)
480 # endif
481 #endif
482 #endif
483
484 #ifdef _MSC_VER
485 #pragma warning(pop)
486 #endif
487
488 #ifdef __cplusplus
489 }
490 #endif
491
492 #endif /* _WINDEF_ */
493