Вы находитесь на странице: 1из 6

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
58 /* Pseudo modifiers for parameters
59 We don't use these unnecessary defines in the w32api headers. Define
60 them by default since that is what people expect, but allow users
61 to avoid the pollution. */
62 #ifndef _NO_W32_PSEUDO_MODIFIERS
63 #define IN
64 #define OUT
65 #ifndef OPTIONAL
66 #define OPTIONAL
67 #endif
68 #endif
69
70 #ifdef __GNUC__
71 #define PACKED __attribute__((packed))
72 #ifndef _fastcall
73 #define _fastcall __attribute__((fastcall))
74 #endif
75 #ifndef __fastcall
76 #define __fastcall __attribute__((fastcall))
77 #endif
78 #ifndef _stdcall
79 #define _stdcall __attribute__((stdcall))
80 #endif
81 #ifndef __stdcall
82 #define __stdcall __attribute__((stdcall))
83 #endif
84 #ifndef _cdecl
85 #define _cdecl __attribute__((cdecl))
86 #endif
87 #ifndef __cdecl
88 #define __cdecl __attribute__((cdecl))
89 #endif
90 #ifndef __declspec
91 #define __declspec(e) __attribute__((e))
92 #endif
93 #ifndef _declspec
94 #define _declspec(e) __attribute__((e))
95 #endif
96 #elif defined(__WATCOMC__)
97 #define PACKED
98 #else
99 #define PACKED
100 #define _cdecl
101 #define __cdecl
102 #endif
103
104 #undef pascal
105 #undef _pascal
106 #undef __pascal
107 #define pascal __stdcall
108 #define _pascal __stdcall
109 #define __pascal __stdcall
110 #define PASCAL _pascal
111 #define CDECL _cdecl
112 #define STDCALL __stdcall
113 #define FASTCALL __fastcall
114 #define WINAPI __stdcall
115 #define WINAPIV __cdecl
116 #define APIENTRY __stdcall
117 #define CALLBACK __stdcall
118 #define APIPRIVATE __stdcall
119
120 #define DECLSPEC_IMPORT __declspec(dllimport)
121 #define DECLSPEC_EXPORT __declspec(dllexport)
122 #ifdef __GNUC__
123 #define DECLSPEC_NORETURN __declspec(noreturn)
124 #define DECLARE_STDCALL_P( type ) __stdcall type
125 #elif defined(__WATCOMC__)
126 #define DECLSPEC_NORETURN
127 #define DECLARE_STDCALL_P( type ) type __stdcall
128 #endif /* __GNUC__/__WATCOMC__ */
129 #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
130 #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
131 #define LOWORD(l) ((WORD)((DWORD)(l)))
132 #define HIWORD(l) ((WORD)(((DWORD)(l)>>16)&0xFFFF))
133 #define LOBYTE(w) ((BYTE)(w))
134 #define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF))
135
136 #ifndef __WATCOMC__
137 #ifndef _export
138 #define _export
139 #endif
140 #ifndef __export
141 #define __export
142 #endif
143 #endif
144
145 #ifndef NOMINMAX
146 #ifndef max
147 #define max(a,b) ((a)>(b)?(a):(b))
148 #endif
149 #ifndef min
150 #define min(a,b) ((a)<(b)?(a):(b))
151 #endif
152 #endif
153
154 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
155 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
156 #define DBG_UNREFERENCED_PARAMETER(P)
157 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
158
159 #ifndef NONAMELESSUNION
160 #ifdef __GNUC__
161 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
162 #define _ANONYMOUS_UNION __extension__
163 #define _ANONYMOUS_STRUCT __extension__
164 #else
165 #if defined(__cplusplus)
166 #define _ANONYMOUS_UNION __extension__
167 #endif /* __cplusplus */
168 #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
169 #elif defined(__WATCOMC__)
170 #define _ANONYMOUS_UNION
171 #define _ANONYMOUS_STRUCT
172 #endif /* __GNUC__/__WATCOMC__ */
173 #endif /* NONAMELESSUNION */
174
175 #ifndef _ANONYMOUS_UNION
176 #define _ANONYMOUS_UNION
177 #define _UNION_NAME(x) x
178 #define DUMMYUNIONNAME u
179 #define DUMMYUNIONNAME2 u2
180 #define DUMMYUNIONNAME3 u3
181 #define DUMMYUNIONNAME4 u4
182 #define DUMMYUNIONNAME5 u5
183 #define DUMMYUNIONNAME6 u6
184 #define DUMMYUNIONNAME7 u7
185 #define DUMMYUNIONNAME8 u8
186 #else
187 #define _UNION_NAME(x)
188 #define DUMMYUNIONNAME
189 #define DUMMYUNIONNAME2
190 #define DUMMYUNIONNAME3
191 #define DUMMYUNIONNAME4
192 #define DUMMYUNIONNAME5
193 #define DUMMYUNIONNAME6
194 #define DUMMYUNIONNAME7
195 #define DUMMYUNIONNAME8
196 #endif
197 #ifndef _ANONYMOUS_STRUCT
198 #define _ANONYMOUS_STRUCT
199 #define _STRUCT_NAME(x) x
200 #define DUMMYSTRUCTNAME s
201 #define DUMMYSTRUCTNAME2 s2
202 #define DUMMYSTRUCTNAME3 s3
203 #else
204 #define _STRUCT_NAME(x)
205 #define DUMMYSTRUCTNAME
206 #define DUMMYSTRUCTNAME2
207 #define DUMMYSTRUCTNAME3
208 #endif
209
210 #ifndef NO_STRICT
211 #ifndef STRICT
212 #define STRICT 1
213 #endif
214 #endif
215
216 /* FIXME: This will make some code compile. The programs will most
217 likely crash when an exception is raised, but at least they will
218 compile. */
219 #if defined (__GNUC__) && defined (__SEH_NOOP)
220 #define __try
221 #define __except(x) if (0) /* don't execute handler */
222 #define __finally
223
224 #define _try __try
225 #define _except __except
226 #define _finally __finally
227 #endif
228
229 typedef unsigned long DWORD;
230 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
231 /* FIXME: Is there a good solution to this? */
232
233 #ifndef XFree86Server
234 #ifndef __OBJC__
235 typedef WINBOOL BOOL;
236 #else
237 #define BOOL WINBOOL
238 #endif
239 typedef unsigned char BYTE;
240 #endif /* ndef XFree86Server */
241 typedef BOOL *PBOOL,*LPBOOL;
242 typedef unsigned short WORD;
243 typedef float FLOAT;
244 typedef FLOAT *PFLOAT;
245 typedef BYTE *PBYTE,*LPBYTE;
246 typedef int *PINT,*LPINT;
247 typedef WORD *PWORD,*LPWORD;
248 typedef long *LPLONG;
249 typedef DWORD *PDWORD,*LPDWORD;
250 typedef CONST void *PCVOID,*LPCVOID;
251 typedef int INT;
252 typedef unsigned int UINT,*PUINT,*LPUINT;
253
254 #include <winnt.h>
255
256 typedef UINT_PTR WPARAM;
257 typedef LONG_PTR LPARAM;
258 typedef LONG_PTR LRESULT;
259 #ifndef _HRESULT_DEFINED
260 typedef LONG HRESULT;
261 #define _HRESULT_DEFINED
262 #endif
263 #ifndef XFree86Server
264 typedef WORD ATOM;
265 #endif /* XFree86Server */
266 typedef HANDLE HGLOBAL;
267 typedef HANDLE HLOCAL;
268 typedef HANDLE GLOBALHANDLE;
269 typedef HANDLE LOCALHANDLE;
270 typedef void *HGDIOBJ;
271
272
273 DECLARE_HANDLE(HACCEL);
274 DECLARE_HANDLE(HBITMAP);
275 DECLARE_HANDLE(HBRUSH);
276 DECLARE_HANDLE(HCOLORSPACE);
277 DECLARE_HANDLE(HDC);
278 DECLARE_HANDLE(HGLRC);
279 DECLARE_HANDLE(HDESK);
280 DECLARE_HANDLE(HENHMETAFILE);
281 DECLARE_HANDLE(HFONT);
282 DECLARE_HANDLE(HICON);
283 DECLARE_HANDLE(HKEY);
284 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
285 DECLARE_HANDLE(HMONITOR);
286 #define HMONITOR_DECLARED 1
287 DECLARE_HANDLE(HTERMINAL);
288 DECLARE_HANDLE(HWINEVENTHOOK);
289
290 typedef HKEY *PHKEY;
291 DECLARE_HANDLE(HMENU);
292 DECLARE_HANDLE(HMETAFILE);
293 DECLARE_HANDLE(HINSTANCE);
294 typedef HINSTANCE HMODULE;
295 DECLARE_HANDLE(HPALETTE);
296 DECLARE_HANDLE(HPEN);
297 DECLARE_HANDLE(HRGN);
298 DECLARE_HANDLE(HRSRC);
299 DECLARE_HANDLE(HSTR);
300 DECLARE_HANDLE(HTASK);
301 DECLARE_HANDLE(HWND);
302 DECLARE_HANDLE(HWINSTA);
303 DECLARE_HANDLE(HKL);
304 typedef int HFILE;
305 typedef HICON HCURSOR;
306 typedef DWORD COLORREF;
307 typedef int (WINAPI *FARPROC)();
308 typedef int (WINAPI *NEARPROC)();
309 typedef int (WINAPI *PROC)();
310 typedef struct tagRECT {
311 LONG left;
312 LONG top;
313 LONG right;
314 LONG bottom;
315 } RECT,*PRECT,*LPRECT;
316 typedef const RECT *LPCRECT;
317 typedef struct tagRECTL {
318 LONG left;
319 LONG top;
320 LONG right;
321 LONG bottom;
322 } RECTL,*PRECTL,*LPRECTL;
323 typedef const RECTL *LPCRECTL;
324 typedef struct tagPOINT {
325 LONG x;
326 LONG y;
327 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
328 typedef struct tagSIZE {
329 LONG cx;
330 LONG cy;
331 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
332 typedef struct tagPOINTS {
333 SHORT x;
334 SHORT y;
335 } POINTS,*PPOINTS,*LPPOINTS;
336
337 #ifdef __cplusplus
338 }
339 #endif
340 #endif

Вам также может понравиться