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