1 | /*
|
---|
2 | * Basic types definitions
|
---|
3 | *
|
---|
4 | * Copyright 1996 Alexandre Julliard
|
---|
5 | *
|
---|
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.
|
---|
10 | *
|
---|
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.
|
---|
15 | *
|
---|
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
19 | */
|
---|
20 |
|
---|
21 | /*
|
---|
22 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
23 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
24 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
25 | * a choice of LGPL license versions is made available with the language indicating
|
---|
26 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
27 | * of the LGPL is applied is otherwise unspecified.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef _WINDEF_
|
---|
31 | #define _WINDEF_
|
---|
32 |
|
---|
33 | #ifndef WINVER
|
---|
34 | #define WINVER 0x0500
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #ifndef NO_STRICT
|
---|
38 | # ifndef STRICT
|
---|
39 | # define STRICT
|
---|
40 | # endif /* STRICT */
|
---|
41 | #endif /* NO_STRICT */
|
---|
42 |
|
---|
43 | #ifdef __cplusplus
|
---|
44 | extern "C" {
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | /* Calling conventions definitions */
|
---|
48 |
|
---|
49 | #if defined(__x86_64__) && !defined(_WIN64)
|
---|
50 | #define _WIN64
|
---|
51 | #endif
|
---|
52 |
|
---|
53 | #ifndef _WIN64
|
---|
54 | # if defined(__i386__) && !defined(_X86_)
|
---|
55 | # define _X86_
|
---|
56 | # endif
|
---|
57 | # if defined(_X86_) && !defined(__i386__)
|
---|
58 | # define __i386__
|
---|
59 | # endif
|
---|
60 | #endif
|
---|
61 |
|
---|
62 | #ifndef __stdcall
|
---|
63 | # ifdef __i386__
|
---|
64 | # ifdef __GNUC__
|
---|
65 | # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
|
---|
66 | # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
|
---|
67 | # else
|
---|
68 | # define __stdcall __attribute__((__stdcall__))
|
---|
69 | # endif
|
---|
70 | # elif defined(_MSC_VER)
|
---|
71 | /* Nothing needs to be done. __stdcall already exists */
|
---|
72 | # else
|
---|
73 | # error You need to define __stdcall for your compiler
|
---|
74 | # endif
|
---|
75 | # elif defined(__x86_64__) && defined (__GNUC__)
|
---|
76 | # define __stdcall __attribute__((ms_abi))
|
---|
77 | # else /* __i386__ */
|
---|
78 | # define __stdcall
|
---|
79 | # endif /* __i386__ */
|
---|
80 | #endif /* __stdcall */
|
---|
81 |
|
---|
82 | #ifndef __cdecl
|
---|
83 | # if defined(__i386__) && defined(__GNUC__)
|
---|
84 | # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
|
---|
85 | # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
|
---|
86 | # else
|
---|
87 | # define __cdecl __attribute__((__cdecl__))
|
---|
88 | # endif
|
---|
89 | # elif defined(__x86_64__) && defined (__GNUC__)
|
---|
90 | # define __cdecl __attribute__((ms_abi))
|
---|
91 | # elif !defined(_MSC_VER)
|
---|
92 | # define __cdecl
|
---|
93 | # endif
|
---|
94 | #endif /* __cdecl */
|
---|
95 |
|
---|
96 | #ifndef __ms_va_list
|
---|
97 | # if defined(__x86_64__) && defined (__GNUC__)
|
---|
98 | # define __ms_va_list __builtin_ms_va_list
|
---|
99 | # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
|
---|
100 | # define __ms_va_end(list) __builtin_ms_va_end(list)
|
---|
101 | # else
|
---|
102 | # define __ms_va_list va_list
|
---|
103 | # define __ms_va_start(list,arg) va_start(list,arg)
|
---|
104 | # define __ms_va_end(list) va_end(list)
|
---|
105 | # endif
|
---|
106 | #endif
|
---|
107 |
|
---|
108 | #ifdef __WINESRC__
|
---|
109 | #define __ONLY_IN_WINELIB(x) do_not_use_this_in_wine
|
---|
110 | #else
|
---|
111 | #define __ONLY_IN_WINELIB(x) x
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | #ifndef pascal
|
---|
115 | #define pascal __ONLY_IN_WINELIB(__stdcall)
|
---|
116 | #endif
|
---|
117 | #ifndef _pascal
|
---|
118 | #define _pascal __ONLY_IN_WINELIB(__stdcall)
|
---|
119 | #endif
|
---|
120 | #ifndef _stdcall
|
---|
121 | #define _stdcall __ONLY_IN_WINELIB(__stdcall)
|
---|
122 | #endif
|
---|
123 | #ifndef _fastcall
|
---|
124 | #define _fastcall __ONLY_IN_WINELIB(__stdcall)
|
---|
125 | #endif
|
---|
126 | #ifndef __fastcall
|
---|
127 | #define __fastcall __ONLY_IN_WINELIB(__stdcall)
|
---|
128 | #endif
|
---|
129 | #ifndef __export
|
---|
130 | #define __export __ONLY_IN_WINELIB(__stdcall)
|
---|
131 | #endif
|
---|
132 | #ifndef cdecl
|
---|
133 | #define cdecl __ONLY_IN_WINELIB(__cdecl)
|
---|
134 | #endif
|
---|
135 | #ifndef _cdecl
|
---|
136 | #define _cdecl __ONLY_IN_WINELIB(__cdecl)
|
---|
137 | #endif
|
---|
138 |
|
---|
139 | #ifndef near
|
---|
140 | #define near __ONLY_IN_WINELIB(/* nothing */)
|
---|
141 | #endif
|
---|
142 | #ifndef far
|
---|
143 | #define far __ONLY_IN_WINELIB(/* nothing */)
|
---|
144 | #endif
|
---|
145 | #ifndef _near
|
---|
146 | #define _near __ONLY_IN_WINELIB(/* nothing */)
|
---|
147 | #endif
|
---|
148 | #ifndef _far
|
---|
149 | #define _far __ONLY_IN_WINELIB(/* nothing */)
|
---|
150 | #endif
|
---|
151 | #ifndef NEAR
|
---|
152 | #define NEAR __ONLY_IN_WINELIB(/* nothing */)
|
---|
153 | #endif
|
---|
154 | #ifndef FAR
|
---|
155 | #define FAR __ONLY_IN_WINELIB(/* nothing */)
|
---|
156 | #endif
|
---|
157 |
|
---|
158 | #ifndef _MSC_VER
|
---|
159 | # ifndef _declspec
|
---|
160 | # define _declspec(x) __ONLY_IN_WINELIB(/* nothing */)
|
---|
161 | # endif
|
---|
162 | # ifndef __declspec
|
---|
163 | # define __declspec(x) __ONLY_IN_WINELIB(/* nothing */)
|
---|
164 | # endif
|
---|
165 | #endif
|
---|
166 |
|
---|
167 | #ifdef _MSC_VER
|
---|
168 | # define inline __inline
|
---|
169 | #endif
|
---|
170 |
|
---|
171 | #define CALLBACK __stdcall
|
---|
172 | #define WINAPI __stdcall
|
---|
173 | #define APIPRIVATE __stdcall
|
---|
174 | #define PASCAL __stdcall
|
---|
175 | #define CDECL __cdecl
|
---|
176 | #define _CDECL __cdecl
|
---|
177 | #define WINAPIV __cdecl
|
---|
178 | #define APIENTRY WINAPI
|
---|
179 | #define CONST const
|
---|
180 |
|
---|
181 | /* Misc. constants. */
|
---|
182 |
|
---|
183 | #undef NULL
|
---|
184 | #ifdef __cplusplus
|
---|
185 | #define NULL 0
|
---|
186 | #else
|
---|
187 | #define NULL ((void*)0)
|
---|
188 | #endif
|
---|
189 |
|
---|
190 | #ifdef FALSE
|
---|
191 | #undef FALSE
|
---|
192 | #endif
|
---|
193 | #define FALSE 0
|
---|
194 |
|
---|
195 | #ifdef TRUE
|
---|
196 | #undef TRUE
|
---|
197 | #endif
|
---|
198 | #define TRUE 1
|
---|
199 |
|
---|
200 | #ifndef IN
|
---|
201 | #define IN
|
---|
202 | #endif
|
---|
203 |
|
---|
204 | #ifndef OUT
|
---|
205 | #define OUT
|
---|
206 | #endif
|
---|
207 |
|
---|
208 | #ifndef OPTIONAL
|
---|
209 | #define OPTIONAL
|
---|
210 | #endif
|
---|
211 |
|
---|
212 | /* Standard data types */
|
---|
213 |
|
---|
214 | typedef void *LPVOID;
|
---|
215 | typedef const void *LPCVOID;
|
---|
216 | typedef int BOOL, *PBOOL, *LPBOOL;
|
---|
217 | typedef unsigned char BYTE, *PBYTE, *LPBYTE;
|
---|
218 | typedef unsigned char UCHAR, *PUCHAR;
|
---|
219 | typedef unsigned short WORD, *PWORD, *LPWORD;
|
---|
220 | typedef unsigned short USHORT, *PUSHORT;
|
---|
221 | typedef int INT, *PINT, *LPINT;
|
---|
222 | typedef unsigned int UINT, *PUINT;
|
---|
223 | typedef float FLOAT, *PFLOAT;
|
---|
224 | typedef char *PSZ;
|
---|
225 | #ifdef _MSC_VER
|
---|
226 | typedef long *LPLONG;
|
---|
227 | typedef unsigned long DWORD, *PDWORD, *LPDWORD;
|
---|
228 | typedef unsigned long ULONG, *PULONG;
|
---|
229 | #else
|
---|
230 | typedef int *LPLONG;
|
---|
231 | typedef unsigned int DWORD, *PDWORD, *LPDWORD;
|
---|
232 | typedef unsigned int ULONG, *PULONG;
|
---|
233 | #endif
|
---|
234 |
|
---|
235 | /* Macros to map Winelib names to the correct implementation name */
|
---|
236 | /* Note that Winelib is purely Win32. */
|
---|
237 |
|
---|
238 | #ifdef __WINESRC__
|
---|
239 | #define WINE_NO_UNICODE_MACROS 1
|
---|
240 | #define WINE_STRICT_PROTOTYPES 1
|
---|
241 | #endif
|
---|
242 |
|
---|
243 | #ifdef WINE_NO_UNICODE_MACROS
|
---|
244 | # define WINELIB_NAME_AW(func) \
|
---|
245 | func##_must_be_suffixed_with_W_or_A_in_this_context \
|
---|
246 | func##_must_be_suffixed_with_W_or_A_in_this_context
|
---|
247 | #else /* WINE_NO_UNICODE_MACROS */
|
---|
248 | # ifdef UNICODE
|
---|
249 | # define WINELIB_NAME_AW(func) func##W
|
---|
250 | # else
|
---|
251 | # define WINELIB_NAME_AW(func) func##A
|
---|
252 | # endif
|
---|
253 | #endif /* WINE_NO_UNICODE_MACROS */
|
---|
254 |
|
---|
255 | #ifdef WINE_NO_UNICODE_MACROS
|
---|
256 | # define DECL_WINELIB_TYPE_AW(type) /* nothing */
|
---|
257 | #else
|
---|
258 | # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
|
---|
259 | #endif
|
---|
260 |
|
---|
261 | #include <winnt.h>
|
---|
262 |
|
---|
263 | /* Polymorphic types */
|
---|
264 |
|
---|
265 | typedef UINT_PTR WPARAM;
|
---|
266 | typedef LONG_PTR LPARAM;
|
---|
267 | typedef LONG_PTR LRESULT;
|
---|
268 |
|
---|
269 | /* Integer types */
|
---|
270 |
|
---|
271 | typedef WORD ATOM;
|
---|
272 | typedef DWORD COLORREF, *LPCOLORREF;
|
---|
273 |
|
---|
274 |
|
---|
275 | /* Handle types */
|
---|
276 |
|
---|
277 | typedef int HFILE;
|
---|
278 | DECLARE_HANDLE(HACCEL);
|
---|
279 | DECLARE_HANDLE(HBITMAP);
|
---|
280 | DECLARE_HANDLE(HBRUSH);
|
---|
281 | DECLARE_HANDLE(HCOLORSPACE);
|
---|
282 | DECLARE_HANDLE(HDC);
|
---|
283 | DECLARE_HANDLE(HDESK);
|
---|
284 | DECLARE_HANDLE(HENHMETAFILE);
|
---|
285 | DECLARE_HANDLE(HFONT);
|
---|
286 | DECLARE_HANDLE(HGLRC);
|
---|
287 | DECLARE_HANDLE(HHOOK);
|
---|
288 | DECLARE_HANDLE(HICON);
|
---|
289 | DECLARE_HANDLE(HINSTANCE);
|
---|
290 | DECLARE_HANDLE(HKEY);
|
---|
291 | typedef HKEY *PHKEY;
|
---|
292 | DECLARE_HANDLE(HKL);
|
---|
293 | DECLARE_HANDLE(HMENU);
|
---|
294 | DECLARE_HANDLE(HMETAFILE);
|
---|
295 | DECLARE_HANDLE(HMONITOR);
|
---|
296 | DECLARE_HANDLE(HPALETTE);
|
---|
297 | DECLARE_HANDLE(HPEN);
|
---|
298 | DECLARE_HANDLE(HRGN);
|
---|
299 | DECLARE_HANDLE(HRSRC);
|
---|
300 | DECLARE_HANDLE(HTASK);
|
---|
301 | DECLARE_HANDLE(HWINEVENTHOOK);
|
---|
302 | DECLARE_HANDLE(HWINSTA);
|
---|
303 | DECLARE_HANDLE(HWND);
|
---|
304 |
|
---|
305 | /* Handle types that must remain interchangeable even with strict on */
|
---|
306 |
|
---|
307 | typedef HINSTANCE HMODULE;
|
---|
308 | typedef HANDLE HGDIOBJ;
|
---|
309 | typedef HANDLE HGLOBAL;
|
---|
310 | typedef HANDLE HLOCAL;
|
---|
311 | typedef HANDLE GLOBALHANDLE;
|
---|
312 | typedef HANDLE LOCALHANDLE;
|
---|
313 | typedef HICON HCURSOR;
|
---|
314 |
|
---|
315 | /* Callback function pointers types */
|
---|
316 |
|
---|
317 | #ifdef WINE_STRICT_PROTOTYPES
|
---|
318 | typedef INT_PTR (CALLBACK *FARPROC)(void);
|
---|
319 | typedef INT_PTR (CALLBACK *NEARPROC)(void);
|
---|
320 | typedef INT_PTR (CALLBACK *PROC)(void);
|
---|
321 | #else
|
---|
322 | typedef INT_PTR (CALLBACK *FARPROC)();
|
---|
323 | typedef INT_PTR (CALLBACK *NEARPROC)();
|
---|
324 | typedef INT_PTR (CALLBACK *PROC)();
|
---|
325 | #endif
|
---|
326 |
|
---|
327 | /* Macros to split words and longs. */
|
---|
328 |
|
---|
329 | #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xFF))
|
---|
330 | #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
|
---|
331 |
|
---|
332 | #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xFFFF))
|
---|
333 | #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16))
|
---|
334 |
|
---|
335 | #define MAKEWORD(low,high) ((WORD)(((BYTE)((DWORD_PTR)(low) & 0xFF)) | ((WORD)((BYTE)((DWORD_PTR)(high) & 0xFF))) << 8))
|
---|
336 | #define MAKELONG(low,high) ((LONG)(((WORD)((DWORD_PTR)(low) & 0xFFFF)) | ((DWORD)((WORD)((DWORD_PTR)(high) & 0xFFFF))) << 16))
|
---|
337 |
|
---|
338 | /* min and max macros */
|
---|
339 | #ifndef NOMINMAX
|
---|
340 | #ifndef max
|
---|
341 | #define max(a,b) (((a) > (b)) ? (a) : (b))
|
---|
342 | #endif
|
---|
343 | #ifndef min
|
---|
344 | #define min(a,b) (((a) < (b)) ? (a) : (b))
|
---|
345 | #endif
|
---|
346 | #endif /* NOMINMAX */
|
---|
347 |
|
---|
348 | #ifdef MAX_PATH /* Work-around for Mingw */
|
---|
349 | #undef MAX_PATH
|
---|
350 | #endif /* MAX_PATH */
|
---|
351 |
|
---|
352 | #define MAX_PATH 260
|
---|
353 | #define HFILE_ERROR ((HFILE)-1)
|
---|
354 |
|
---|
355 | /* The SIZE structure */
|
---|
356 | typedef struct tagSIZE
|
---|
357 | {
|
---|
358 | LONG cx;
|
---|
359 | LONG cy;
|
---|
360 | } SIZE, *PSIZE, *LPSIZE;
|
---|
361 |
|
---|
362 | typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
|
---|
363 |
|
---|
364 | /* The POINT structure */
|
---|
365 | typedef struct tagPOINT
|
---|
366 | {
|
---|
367 | LONG x;
|
---|
368 | LONG y;
|
---|
369 | } POINT, *PPOINT, *LPPOINT;
|
---|
370 |
|
---|
371 | typedef struct _POINTL
|
---|
372 | {
|
---|
373 | LONG x;
|
---|
374 | LONG y;
|
---|
375 | } POINTL, *PPOINTL;
|
---|
376 |
|
---|
377 | /* The POINTS structure */
|
---|
378 |
|
---|
379 | typedef struct tagPOINTS
|
---|
380 | {
|
---|
381 | #ifdef WORDS_BIGENDIAN
|
---|
382 | SHORT y;
|
---|
383 | SHORT x;
|
---|
384 | #else
|
---|
385 | SHORT x;
|
---|
386 | SHORT y;
|
---|
387 | #endif
|
---|
388 | } POINTS, *PPOINTS, *LPPOINTS;
|
---|
389 |
|
---|
390 | typedef struct _FILETIME {
|
---|
391 | #ifdef WORDS_BIGENDIAN
|
---|
392 | DWORD dwHighDateTime;
|
---|
393 | DWORD dwLowDateTime;
|
---|
394 | #else
|
---|
395 | DWORD dwLowDateTime;
|
---|
396 | DWORD dwHighDateTime;
|
---|
397 | #endif
|
---|
398 | } FILETIME, *PFILETIME, *LPFILETIME;
|
---|
399 | #define _FILETIME_
|
---|
400 |
|
---|
401 | /* The RECT structure */
|
---|
402 | typedef struct tagRECT
|
---|
403 | {
|
---|
404 | LONG left;
|
---|
405 | LONG top;
|
---|
406 | LONG right;
|
---|
407 | LONG bottom;
|
---|
408 | } RECT, *PRECT, *LPRECT;
|
---|
409 | typedef const RECT *LPCRECT;
|
---|
410 |
|
---|
411 | typedef struct _RECTL
|
---|
412 | {
|
---|
413 | LONG left;
|
---|
414 | LONG top;
|
---|
415 | LONG right;
|
---|
416 | LONG bottom;
|
---|
417 | } RECTL, *PRECTL, *LPRECTL;
|
---|
418 |
|
---|
419 | typedef const RECTL *LPCRECTL;
|
---|
420 |
|
---|
421 | #ifdef __cplusplus
|
---|
422 | }
|
---|
423 | #endif
|
---|
424 |
|
---|
425 | #endif /* _WINDEF_ */
|
---|