Release 0.9.6.
[wine/multimedia.git] / include / windef.h
blob337649447a8bcfd02fa9e8d26ea10ae2a6e98ca0
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef _WINDEF_
22 #define _WINDEF_
24 #ifndef WINVER
25 #define WINVER 0x0500
26 #endif
28 #ifndef NO_STRICT
29 # ifndef STRICT
30 # define STRICT
31 # endif /* STRICT */
32 #endif /* NO_STRICT */
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 /* Calling conventions definitions */
40 #if defined(__i386__) && !defined(_X86_)
41 # define _X86_
42 #endif
44 #if defined(_X86_) && !defined(__i386__)
45 # define __i386__
46 #endif
48 #ifdef __x86_64__
49 #define _WIN64
50 #endif
52 #ifndef __stdcall
53 # ifdef __i386__
54 # ifdef __GNUC__
55 # define __stdcall __attribute__((__stdcall__))
56 # elif defined(_MSC_VER)
57 /* Nothing needs to be done. __stdcall already exists */
58 # else
59 # error You need to define __stdcall for your compiler
60 # endif
61 # else /* __i386__ */
62 # define __stdcall
63 # endif /* __i386__ */
64 #endif /* __stdcall */
66 #ifndef __cdecl
67 # if defined(__i386__) && defined(__GNUC__)
68 # define __cdecl __attribute__((__cdecl__))
69 # elif !defined(_MSC_VER)
70 # define __cdecl
71 # endif
72 #endif /* __cdecl */
74 #ifdef __WINESRC__
75 #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
76 #else
77 #define __ONLY_IN_WINELIB(x) x
78 #endif
80 #ifndef pascal
81 #define pascal __ONLY_IN_WINELIB(__stdcall)
82 #endif
83 #ifndef _pascal
84 #define _pascal __ONLY_IN_WINELIB(__stdcall)
85 #endif
86 #ifndef _stdcall
87 #define _stdcall __ONLY_IN_WINELIB(__stdcall)
88 #endif
89 #ifndef _fastcall
90 #define _fastcall __ONLY_IN_WINELIB(__stdcall)
91 #endif
92 #ifndef __fastcall
93 #define __fastcall __ONLY_IN_WINELIB(__stdcall)
94 #endif
95 #ifndef __export
96 #define __export __ONLY_IN_WINELIB(__stdcall)
97 #endif
98 #ifndef cdecl
99 #define cdecl __ONLY_IN_WINELIB(__cdecl)
100 #endif
101 #ifndef _cdecl
102 #define _cdecl __ONLY_IN_WINELIB(__cdecl)
103 #endif
105 #ifndef near
106 #define near __ONLY_IN_WINELIB(/* nothing */)
107 #endif
108 #ifndef far
109 #define far __ONLY_IN_WINELIB(/* nothing */)
110 #endif
111 #ifndef _near
112 #define _near __ONLY_IN_WINELIB(/* nothing */)
113 #endif
114 #ifndef _far
115 #define _far __ONLY_IN_WINELIB(/* nothing */)
116 #endif
117 #ifndef NEAR
118 #define NEAR __ONLY_IN_WINELIB(/* nothing */)
119 #endif
120 #ifndef FAR
121 #define FAR __ONLY_IN_WINELIB(/* nothing */)
122 #endif
124 #ifndef _MSC_VER
125 # ifndef _declspec
126 # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
127 # endif
128 # ifndef __declspec
129 # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
130 # endif
131 #endif
133 #ifdef _MSC_VER
134 # define inline __inline
135 #endif
137 #define CALLBACK __stdcall
138 #define WINAPI __stdcall
139 #define APIPRIVATE __stdcall
140 #define PASCAL __stdcall
141 #define CDECL __cdecl
142 #define _CDECL __cdecl
143 #define WINAPIV __cdecl
144 #define APIENTRY WINAPI
145 #define CONST const
147 /* Misc. constants. */
149 #undef NULL
150 #ifdef __cplusplus
151 #define NULL 0
152 #else
153 #define NULL ((void*)0)
154 #endif
156 #ifdef FALSE
157 #undef FALSE
158 #endif
159 #define FALSE 0
161 #ifdef TRUE
162 #undef TRUE
163 #endif
164 #define TRUE 1
166 #ifndef IN
167 #define IN
168 #endif
170 #ifndef OUT
171 #define OUT
172 #endif
174 #ifndef OPTIONAL
175 #define OPTIONAL
176 #endif
178 /* Standard data types */
180 typedef void *LPVOID;
181 typedef const void *LPCVOID;
182 typedef int BOOL, *PBOOL, *LPBOOL;
183 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
184 typedef unsigned char UCHAR, *PUCHAR;
185 typedef unsigned short WORD, *PWORD, *LPWORD;
186 typedef unsigned short USHORT, *PUSHORT;
187 typedef int INT, *PINT, *LPINT;
188 typedef unsigned int UINT, *PUINT;
189 typedef float FLOAT, *PFLOAT;
190 typedef char *PSZ;
191 #if defined(_WIN64) && !defined(_MSC_VER)
192 typedef int *LPLONG;
193 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
194 typedef unsigned int ULONG, *PULONG;
195 #else
196 typedef long *LPLONG;
197 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
198 typedef unsigned long ULONG, *PULONG;
199 #endif
201 /* Macros to map Winelib names to the correct implementation name */
202 /* Note that Winelib is purely Win32. */
204 #ifdef __WINESRC__
205 #define WINE_NO_UNICODE_MACROS
206 #endif
208 #ifdef WINE_NO_UNICODE_MACROS
209 # define WINELIB_NAME_AW(func) \
210 func##_must_be_suffixed_with_W_or_A_in_this_context \
211 func##_must_be_suffixed_with_W_or_A_in_this_context
212 #else /* WINE_NO_UNICODE_MACROS */
213 # ifdef UNICODE
214 # define WINELIB_NAME_AW(func) func##W
215 # else
216 # define WINELIB_NAME_AW(func) func##A
217 # endif
218 #endif /* WINE_NO_UNICODE_MACROS */
220 #ifdef WINE_NO_UNICODE_MACROS
221 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
222 #else
223 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
224 #endif
226 #include <winnt.h>
228 /* Polymorphic types */
230 typedef UINT_PTR WPARAM;
231 typedef LONG_PTR LPARAM;
232 typedef LONG_PTR LRESULT;
234 /* Integer types */
236 typedef WORD ATOM;
237 typedef DWORD COLORREF, *LPCOLORREF;
240 /* Handle types */
242 typedef int HFILE;
243 DECLARE_HANDLE(HACCEL);
244 DECLARE_HANDLE(HBITMAP);
245 DECLARE_HANDLE(HBRUSH);
246 DECLARE_HANDLE(HCOLORSPACE);
247 DECLARE_HANDLE(HDC);
248 DECLARE_HANDLE(HDESK);
249 DECLARE_HANDLE(HENHMETAFILE);
250 DECLARE_HANDLE(HFONT);
251 DECLARE_HANDLE(HGLRC);
252 DECLARE_HANDLE(HHOOK);
253 DECLARE_HANDLE(HICON);
254 DECLARE_HANDLE(HINSTANCE);
255 DECLARE_HANDLE(HKEY);
256 typedef HKEY *PHKEY;
257 DECLARE_HANDLE(HKL);
258 DECLARE_HANDLE(HMENU);
259 DECLARE_HANDLE(HMETAFILE);
260 DECLARE_HANDLE(HMONITOR);
261 DECLARE_HANDLE(HPALETTE);
262 DECLARE_HANDLE(HPEN);
263 DECLARE_HANDLE(HRGN);
264 DECLARE_HANDLE(HRSRC);
265 DECLARE_HANDLE(HTASK);
266 DECLARE_HANDLE(HWINEVENTHOOK);
267 DECLARE_HANDLE(HWINSTA);
268 DECLARE_HANDLE(HWND);
270 /* Handle types that must remain interchangeable even with strict on */
272 typedef HINSTANCE HMODULE;
273 typedef HANDLE HGDIOBJ;
274 typedef HANDLE HGLOBAL;
275 typedef HANDLE HLOCAL;
276 typedef HANDLE GLOBALHANDLE;
277 typedef HANDLE LOCALHANDLE;
278 typedef HICON HCURSOR;
280 /* Callback function pointers types */
282 typedef INT (CALLBACK *FARPROC)();
283 typedef INT (CALLBACK *PROC)();
286 /* Macros to split words and longs. */
288 #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
289 #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
291 #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
292 #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
294 #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
295 #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
297 /* min and max macros */
298 #ifndef NOMINMAX
299 #ifndef max
300 #define max(a,b) (((a) > (b)) ? (a) : (b))
301 #endif
302 #ifndef min
303 #define min(a,b) (((a) < (b)) ? (a) : (b))
304 #endif
305 #endif /* NOMINMAX */
307 #ifdef MAX_PATH /* Work-around for Mingw */
308 #undef MAX_PATH
309 #endif /* MAX_PATH */
311 #define MAX_PATH 260
312 #define HFILE_ERROR ((HFILE)-1)
314 /* The SIZE structure */
315 typedef struct tagSIZE
317 LONG cx;
318 LONG cy;
319 } SIZE, *PSIZE, *LPSIZE;
321 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
323 /* The POINT structure */
324 typedef struct tagPOINT
326 LONG x;
327 LONG y;
328 } POINT, *PPOINT, *LPPOINT;
330 typedef struct _POINTL
332 LONG x;
333 LONG y;
334 } POINTL, *PPOINTL;
336 /* The POINTS structure */
338 typedef struct tagPOINTS
340 #ifdef WORDS_BIGENDIAN
341 SHORT y;
342 SHORT x;
343 #else
344 SHORT x;
345 SHORT y;
346 #endif
347 } POINTS, *PPOINTS, *LPPOINTS;
349 /* The RECT structure */
350 typedef struct tagRECT
352 LONG left;
353 LONG top;
354 LONG right;
355 LONG bottom;
356 } RECT, *PRECT, *LPRECT;
357 typedef const RECT *LPCRECT;
359 typedef struct _RECTL
361 LONG left;
362 LONG top;
363 LONG right;
364 LONG bottom;
365 } RECTL, *PRECTL, *LPRECTL;
367 typedef const RECTL *LPCRECTL;
369 #ifdef __cplusplus
371 #endif
373 #endif /* _WINDEF_ */