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