source: Daodan/MinGW/include/windef.h@ 1141

Last change on this file since 1141 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

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