OSDN Git Service

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