OSDN Git Service

90d731483dc0c4e8e28e03b0a509a6bdf7a6ec55
[mingw/mingw-org-wsl.git] / include / windef.h
1 /**
2  * @file windef.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _WINDEF_H
25 #define _WINDEF_H
26 #pragma GCC system_header
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #ifndef WINVER
33 #define WINVER 0x0500
34 /*
35  * If you need Win32 API features newer the Win95 and WinNT then you must
36  * define WINVER before including windows.h or any other method of including
37  * the windef.h header.
38  */
39 #endif
40 #ifndef _WIN32_WINNT
41 #define _WIN32_WINNT WINVER
42 /*
43  * There may be the need to define _WIN32_WINNT to a value different from
44  * the value of WINVER.  I don't have any example of why you would do that.
45  * However, if you must then define _WIN32_WINNT to the value required before
46  * including windows.h or any other method of including the windef.h header.
47  */
48 #endif
49 #define FAR
50 #define far
51 #define NEAR
52 #define near
53 #ifndef CONST
54 #define CONST const
55 #endif
56 #undef MAX_PATH
57 #define MAX_PATH 260
58
59 #ifndef NULL
60 #ifdef __cplusplus
61 #define NULL 0
62 #else
63 #define NULL ((void*)0)
64 #endif
65 #endif
66 #ifndef FALSE
67 #define FALSE 0
68 #endif
69 #ifndef TRUE
70 #define TRUE 1
71 #endif
72
73 /* Pseudo modifiers for parameters
74    We don't use these unnecessary defines in the w32api headers. Define
75    them by default since that is what people expect, but allow users
76    to avoid the pollution.  */
77 #ifndef _NO_W32_PSEUDO_MODIFIERS
78 #define IN
79 #define OUT
80 #ifndef OPTIONAL
81 #define OPTIONAL
82 #endif
83 #endif
84
85 #ifndef _declspec
86 #define _declspec(e) __declspec(e)
87 #endif
88
89 #undef pascal
90 #undef _pascal
91 #undef __pascal
92 #define pascal __stdcall
93 #define _pascal __stdcall
94 #define __pascal __stdcall
95 #define PASCAL _pascal
96 #define CDECL _cdecl
97 #define STDCALL __stdcall
98 #define FASTCALL __fastcall
99 #define WINAPI __stdcall
100 #define WINAPIV __cdecl
101 #define APIENTRY __stdcall
102 #define CALLBACK __stdcall
103 #define APIPRIVATE __stdcall
104
105 #define DECLSPEC_IMPORT __declspec(dllimport)
106 #define DECLSPEC_EXPORT __declspec(dllexport)
107 #define DECLSPEC_NORETURN __declspec(noreturn)
108 #define DECLARE_STDCALL_P( type ) __stdcall type
109
110 #define MAKEWORD(a,b)   ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
111 #define MAKELONG(a,b)   ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
112 #define LOWORD(l)       ((WORD)((DWORD)(l)))
113 #define HIWORD(l)       ((WORD)(((DWORD)(l)>>16)&0xFFFF))
114 #define LOBYTE(w)       ((BYTE)(w))
115 #define HIBYTE(w)       ((BYTE)(((WORD)(w)>>8)&0xFF))
116
117 #ifndef _export
118 #define _export
119 #endif
120 #ifndef __export
121 #define __export
122 #endif
123
124 #ifndef NOMINMAX
125 #ifndef max
126 #define max(a,b) ((a)>(b)?(a):(b))
127 #endif
128 #ifndef min
129 #define min(a,b) ((a)<(b)?(a):(b))
130 #endif
131 #endif
132
133 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
134 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
135 #define DBG_UNREFERENCED_PARAMETER(P)
136 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
137
138 #ifndef NONAMELESSUNION
139 #define _ANONYMOUS_UNION __extension__
140 #define _ANONYMOUS_STRUCT __extension__
141 #endif /* NONAMELESSUNION */
142
143 #ifndef _ANONYMOUS_UNION
144 #define _ANONYMOUS_UNION
145 #define _UNION_NAME(x) x
146 #define DUMMYUNIONNAME  u
147 #define DUMMYUNIONNAME2 u2
148 #define DUMMYUNIONNAME3 u3
149 #define DUMMYUNIONNAME4 u4
150 #define DUMMYUNIONNAME5 u5
151 #define DUMMYUNIONNAME6 u6
152 #define DUMMYUNIONNAME7 u7
153 #define DUMMYUNIONNAME8 u8
154 #else
155 #define _UNION_NAME(x)
156 #define DUMMYUNIONNAME
157 #define DUMMYUNIONNAME2
158 #define DUMMYUNIONNAME3
159 #define DUMMYUNIONNAME4
160 #define DUMMYUNIONNAME5
161 #define DUMMYUNIONNAME6
162 #define DUMMYUNIONNAME7
163 #define DUMMYUNIONNAME8
164 #endif
165 #ifndef _ANONYMOUS_STRUCT
166 #define _ANONYMOUS_STRUCT
167 #define _STRUCT_NAME(x) x
168 #define DUMMYSTRUCTNAME s
169 #define DUMMYSTRUCTNAME2 s2
170 #define DUMMYSTRUCTNAME3 s3
171 #else
172 #define _STRUCT_NAME(x)
173 #define DUMMYSTRUCTNAME
174 #define DUMMYSTRUCTNAME2
175 #define DUMMYSTRUCTNAME3
176 #endif
177
178 #ifndef NO_STRICT
179 #ifndef STRICT
180 #define STRICT 1
181 #endif
182 #endif
183
184 /* FIXME: This will make some code compile. The programs will most
185    likely crash when an exception is raised, but at least they will
186    compile. */
187 #if defined (__SEH_NOOP)
188 #define __try
189 #define __except(x) if (0) /* don't execute handler */
190 #define __finally
191
192 #define _try __try
193 #define _except __except
194 #define _finally __finally
195 #endif
196
197 typedef unsigned long DWORD;
198 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
199 /* FIXME: Is there a good solution to this? */
200 #ifndef __OBJC__
201 typedef WINBOOL BOOL;
202 #else
203 #define BOOL WINBOOL
204 #endif
205 typedef unsigned char BYTE;
206 typedef BOOL *PBOOL,*LPBOOL;
207 typedef unsigned short WORD;
208 typedef float FLOAT;
209 typedef FLOAT *PFLOAT;
210 typedef BYTE *PBYTE,*LPBYTE;
211 typedef int *PINT,*LPINT;
212 typedef WORD *PWORD,*LPWORD;
213 typedef long *LPLONG;
214 typedef DWORD *PDWORD,*LPDWORD;
215 typedef CONST void *PCVOID,*LPCVOID;
216 typedef int INT;
217 typedef unsigned int UINT,*PUINT,*LPUINT;
218
219 #include <winnt.h>
220
221 typedef UINT_PTR WPARAM;
222 typedef LONG_PTR LPARAM;
223 typedef LONG_PTR LRESULT;
224 #ifndef _HRESULT_DEFINED
225 typedef LONG HRESULT;
226 #define _HRESULT_DEFINED
227 #endif
228 typedef WORD ATOM;
229 typedef HANDLE HHOOK;
230 typedef HANDLE HGLOBAL;
231 typedef HANDLE HLOCAL;
232 typedef HANDLE GLOBALHANDLE;
233 typedef HANDLE LOCALHANDLE;
234 typedef void *HGDIOBJ;
235 DECLARE_HANDLE(HACCEL);
236 DECLARE_HANDLE(HBITMAP);
237 DECLARE_HANDLE(HBRUSH);
238 DECLARE_HANDLE(HCOLORSPACE);
239 DECLARE_HANDLE(HDC);
240 DECLARE_HANDLE(HGLRC);
241 DECLARE_HANDLE(HDESK);
242 DECLARE_HANDLE(HENHMETAFILE);
243 DECLARE_HANDLE(HFONT);
244 DECLARE_HANDLE(HICON);
245 DECLARE_HANDLE(HKEY);
246 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
247 DECLARE_HANDLE(HMONITOR);
248 #define HMONITOR_DECLARED 1
249 DECLARE_HANDLE(HTERMINAL);
250 DECLARE_HANDLE(HWINEVENTHOOK);
251
252 typedef HKEY *PHKEY;
253 DECLARE_HANDLE(HMENU);
254 DECLARE_HANDLE(HMETAFILE);
255 DECLARE_HANDLE(HINSTANCE);
256 typedef HINSTANCE HMODULE;
257 DECLARE_HANDLE(HPALETTE);
258 DECLARE_HANDLE(HPEN);
259 DECLARE_HANDLE(HRGN);
260 DECLARE_HANDLE(HRSRC);
261 DECLARE_HANDLE(HSTR);
262 DECLARE_HANDLE(HTASK);
263 DECLARE_HANDLE(HWND);
264 DECLARE_HANDLE(HWINSTA);
265 DECLARE_HANDLE(HKL);
266 typedef int HFILE;
267 typedef HICON HCURSOR;
268 typedef DWORD COLORREF;
269 typedef int (WINAPI *FARPROC)();
270 typedef int (WINAPI *NEARPROC)();
271 typedef int (WINAPI *PROC)();
272 typedef struct tagRECT {
273         LONG left;
274         LONG top;
275         LONG right;
276         LONG bottom;
277 } RECT,*PRECT,*LPRECT;
278 typedef const RECT *LPCRECT;
279 typedef struct tagRECTL {
280         LONG left;
281         LONG top;
282         LONG right;
283         LONG bottom;
284 } RECTL,*PRECTL,*LPRECTL;
285 typedef const RECTL *LPCRECTL;
286 typedef struct tagPOINT {
287         LONG x;
288         LONG y;
289 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
290 typedef struct tagSIZE {
291         LONG cx;
292         LONG cy;
293 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
294 typedef struct tagPOINTS {
295         SHORT x;
296         SHORT y;
297 } POINTS,*PPOINTS,*LPPOINTS;
298
299 #ifdef __cplusplus
300 }
301 #endif
302 #endif