Build test programs as .so files. Added missing imports.
[wine/gsoc_dplay.git] / include / windef.h
blobf1e851718a8ad3c8d97e8936fdaee9001ea36f90
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_WINDEF_H
8 #define __WINE_WINDEF_H
10 #ifdef __WINE__
11 # undef UNICODE
12 #endif /* __WINE__ */
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
18 /* Misc. constants. */
20 #define WINVER 0x0500
22 #ifdef FALSE
23 #undef FALSE
24 #endif
25 #define FALSE 0
27 #ifdef TRUE
28 #undef TRUE
29 #endif
30 #define TRUE 1
32 #ifdef NULL
33 #undef NULL
34 #endif
35 #define NULL 0
37 /* Macros to map Winelib names to the correct implementation name */
38 /* depending on __WINE__ and UNICODE macros. */
39 /* Note that Winelib is purely Win32. */
41 #ifdef __WINE__
42 # define WINELIB_NAME_AW(func) \
43 func##_must_be_suffixed_with_W_or_A_in_this_context \
44 func##_must_be_suffixed_with_W_or_A_in_this_context
45 #else /* __WINE__ */
46 # ifdef UNICODE
47 # define WINELIB_NAME_AW(func) func##W
48 # else
49 # define WINELIB_NAME_AW(func) func##A
50 # endif /* UNICODE */
51 #endif /* __WINE__ */
53 #ifdef __WINE__
54 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
55 #else /* __WINE__ */
56 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
57 #endif /* __WINE__ */
59 #ifdef __WINE__
60 # define NONAMELESSSTRUCT
61 # define NONAMELESSUNION
62 #else
63 /* Anonymous struct support starts with gcc/g++ 2.96 */
64 # if !defined(NONAMELESSSTRUCT) && defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 96)))
65 # define NONAMELESSSTRUCT
66 # endif
67 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
68 # if !defined(NONAMELESSUNION) && defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus)))))
69 # define NONAMELESSUNION
70 # endif
71 #endif
73 #ifndef NONAMELESSSTRUCT
74 #define DUMMYSTRUCTNAME
75 #define DUMMYSTRUCTNAME1
76 #define DUMMYSTRUCTNAME2
77 #define DUMMYSTRUCTNAME3
78 #define DUMMYSTRUCTNAME4
79 #define DUMMYSTRUCTNAME5
80 #else /* !defined(NONAMELESSSTRUCT) */
81 #define DUMMYSTRUCTNAME s
82 #define DUMMYSTRUCTNAME1 s1
83 #define DUMMYSTRUCTNAME2 s2
84 #define DUMMYSTRUCTNAME3 s3
85 #define DUMMYSTRUCTNAME4 s4
86 #define DUMMYSTRUCTNAME5 s5
87 #endif /* !defined(NONAMELESSSTRUCT) */
89 #ifndef NONAMELESSUNION
90 #define DUMMYUNIONNAME
91 #define DUMMYUNIONNAME1
92 #define DUMMYUNIONNAME2
93 #define DUMMYUNIONNAME3
94 #define DUMMYUNIONNAME4
95 #define DUMMYUNIONNAME5
96 #define DUMMYUNIONNAME6
97 #define DUMMYUNIONNAME7
98 #define DUMMYUNIONNAME8
99 #else /* !defined(NONAMELESSUNION) */
100 #define DUMMYUNIONNAME u
101 #define DUMMYUNIONNAME1 u1
102 #define DUMMYUNIONNAME2 u2
103 #define DUMMYUNIONNAME3 u3
104 #define DUMMYUNIONNAME4 u4
105 #define DUMMYUNIONNAME5 u5
106 #define DUMMYUNIONNAME6 u6
107 #define DUMMYUNIONNAME7 u7
108 #define DUMMYUNIONNAME8 u8
109 #endif /* !defined(NONAMELESSUNION) */
111 /* Calling conventions definitions */
113 #ifdef __i386__
114 # ifndef _X86_
115 # define _X86_
116 # endif
117 # if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
118 # define __stdcall __attribute__((__stdcall__))
119 # define __cdecl __attribute__((__cdecl__))
120 # else
121 # error You need gcc >= 2.7 to build Wine on a 386
122 # endif /* __GNUC__ */
123 #else /* __i386__ */
124 # define __stdcall
125 # define __cdecl
126 #endif /* __i386__ */
128 #define CALLBACK __stdcall
129 #define WINAPI __stdcall
130 #define APIPRIVATE __stdcall
131 #define PASCAL __stdcall
132 #define pascal __stdcall
133 #define _pascal __stdcall
134 #define _stdcall __stdcall
135 #define _fastcall __stdcall
136 #define __fastcall __stdcall
137 #define __export __stdcall
138 #define CDECL __cdecl
139 #define _CDECL __cdecl
140 #define cdecl __cdecl
141 #define _cdecl __cdecl
142 #define WINAPIV __cdecl
143 #define APIENTRY WINAPI
145 #define _declspec(x)
146 #define __declspec(x)
148 #define CONST const
150 /* Standard data types. These are the same for emulator and library. */
152 typedef void VOID;
153 typedef int INT;
154 typedef unsigned int UINT;
155 typedef unsigned short WORD;
156 typedef unsigned long DWORD;
157 typedef unsigned long ULONG;
158 typedef unsigned char BYTE;
159 typedef long LONG;
160 typedef short SHORT;
161 typedef unsigned short USHORT;
162 typedef char CHAR;
163 typedef unsigned char UCHAR;
164 /* Some systems might have wchar_t, but we really need 16 bit characters */
165 typedef unsigned short WCHAR;
166 typedef int BOOL;
167 typedef double DATE;
168 typedef double DOUBLE;
170 /* FIXME: Wine does not compile with strict on, therefore strict
171 * handles are presently only usable on machines where sizeof(UINT) ==
172 * sizeof(void*). HANDLEs are supposed to be void* but a large amount
173 * of WINE code operates on HANDLES as if they are UINTs. So to WINE
174 * they exist as UINTs but to the Winelib user who turns on strict,
175 * they exist as void*. If there is a size difference between UINT and
176 * void* then things get ugly. */
177 #ifdef STRICT
178 typedef VOID* HANDLE;
179 #else
180 typedef UINT HANDLE;
181 #endif
184 typedef HANDLE *LPHANDLE;
186 /* Integer types. These are the same for emulator and library. */
187 typedef UINT WPARAM;
188 typedef LONG LPARAM;
189 typedef LONG HRESULT;
190 typedef LONG LRESULT;
191 typedef WORD ATOM;
192 typedef WORD CATCHBUF[9];
193 typedef WORD *LPCATCHBUF;
194 typedef HANDLE HHOOK;
195 typedef HANDLE HMONITOR;
196 typedef DWORD LCID;
197 typedef WORD LANGID;
198 typedef float FLOAT;
200 /* Pointers types. These are the same for emulator and library. */
201 /* winnt types */
202 typedef VOID *PVOID;
203 typedef const void *PCVOID;
204 typedef CHAR *PCHAR;
205 typedef UCHAR *PUCHAR;
206 typedef BYTE *PBYTE;
207 typedef WORD *PWORD;
208 typedef USHORT *PUSHORT;
209 typedef SHORT *PSHORT;
210 typedef ULONG *PULONG;
211 typedef LONG *PLONG;
212 typedef DWORD *PDWORD;
213 /* common win32 types */
214 typedef CHAR *LPSTR;
215 typedef CHAR *PSTR;
216 typedef const CHAR *LPCSTR;
217 typedef const CHAR *PCSTR;
218 typedef WCHAR *LPWSTR;
219 typedef WCHAR *PWSTR;
220 typedef const WCHAR *LPCWSTR;
221 typedef const WCHAR *PCWSTR;
222 typedef BYTE *LPBYTE;
223 typedef WORD *LPWORD;
224 typedef DWORD *LPDWORD;
225 typedef LONG *LPLONG;
226 typedef VOID *LPVOID;
227 typedef const VOID *LPCVOID;
228 typedef INT *PINT;
229 typedef INT *LPINT;
230 typedef UINT *PUINT;
231 typedef UINT *LPUINT;
232 typedef FLOAT *PFLOAT;
233 typedef FLOAT *LPFLOAT;
234 typedef BOOL *PBOOL;
235 typedef BOOL *LPBOOL;
237 /* Special case: a segmented pointer is just a pointer in the user's code. */
239 #ifdef __WINE__
240 typedef DWORD SEGPTR;
241 #else
242 typedef void* SEGPTR;
243 #endif /* __WINE__ */
245 /* Handle types that exist both in Win16 and Win32. */
247 #ifdef STRICT
248 #define DECLARE_HANDLE(a) \
249 typedef struct a##__ { int unused; } *a; \
250 typedef a *P##a; \
251 typedef a *LP##a
252 #else /*STRICT*/
253 #define DECLARE_HANDLE(a) \
254 typedef HANDLE a; \
255 typedef a *P##a; \
256 typedef a *LP##a
257 #endif /*STRICT*/
259 DECLARE_HANDLE(HACMDRIVERID);
260 DECLARE_HANDLE(HACMDRIVER);
261 DECLARE_HANDLE(HACMOBJ);
262 DECLARE_HANDLE(HACMSTREAM);
263 DECLARE_HANDLE(HMETAFILEPICT);
265 DECLARE_HANDLE(HACCEL);
266 DECLARE_HANDLE(HBITMAP);
267 DECLARE_HANDLE(HBRUSH);
268 DECLARE_HANDLE(HCOLORSPACE);
269 DECLARE_HANDLE(HCURSOR);
270 DECLARE_HANDLE(HDC);
271 DECLARE_HANDLE(HDROP);
272 DECLARE_HANDLE(HDRVR);
273 DECLARE_HANDLE(HDWP);
274 DECLARE_HANDLE(HENHMETAFILE);
275 typedef int HFILE;
276 DECLARE_HANDLE(HFONT);
277 DECLARE_HANDLE(HICON);
278 DECLARE_HANDLE(HINSTANCE);
279 DECLARE_HANDLE(HKEY);
280 DECLARE_HANDLE(HMENU);
281 DECLARE_HANDLE(HMETAFILE);
282 DECLARE_HANDLE(HMIDI);
283 DECLARE_HANDLE(HMIDIIN);
284 DECLARE_HANDLE(HMIDIOUT);
285 DECLARE_HANDLE(HMIDISTRM);
286 DECLARE_HANDLE(HMIXER);
287 DECLARE_HANDLE(HMIXEROBJ);
288 DECLARE_HANDLE(HMMIO);
289 DECLARE_HANDLE(HPALETTE);
290 DECLARE_HANDLE(HPEN);
291 DECLARE_HANDLE(HQUEUE);
292 DECLARE_HANDLE(HRGN);
293 DECLARE_HANDLE(HRSRC);
294 DECLARE_HANDLE(HTASK);
295 DECLARE_HANDLE(HWAVE);
296 DECLARE_HANDLE(HWAVEIN);
297 DECLARE_HANDLE(HWAVEOUT);
298 DECLARE_HANDLE(HWINSTA);
299 DECLARE_HANDLE(HDESK);
300 DECLARE_HANDLE(HWND);
301 DECLARE_HANDLE(HKL);
302 DECLARE_HANDLE(HRASCONN);
304 /* Handle types that must remain interchangeable even with strict on */
306 typedef HINSTANCE HMODULE;
307 typedef HANDLE HGDIOBJ;
308 typedef HANDLE HGLOBAL;
309 typedef HANDLE HLOCAL;
310 typedef HANDLE GLOBALHANDLE;
311 typedef HANDLE LOCALHANDLE;
313 /* Callback function pointers types */
315 typedef BOOL CALLBACK (*DATEFMT_ENUMPROCA)(LPSTR);
316 typedef BOOL CALLBACK (*DATEFMT_ENUMPROCW)(LPWSTR);
317 DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
318 typedef BOOL CALLBACK (*DLGPROC)(HWND,UINT,WPARAM,LPARAM);
319 typedef LRESULT CALLBACK (*DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
320 typedef INT CALLBACK (*EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
321 typedef INT CALLBACK (*EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
322 DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
323 typedef LRESULT CALLBACK (*FARPROC)();
324 typedef INT CALLBACK (*PROC)();
325 typedef BOOL CALLBACK (*GRAYSTRINGPROC)(HDC,LPARAM,INT);
326 typedef LRESULT CALLBACK (*HOOKPROC)(INT,WPARAM,LPARAM);
327 typedef BOOL CALLBACK (*PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
328 typedef BOOL CALLBACK (*PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
329 DECL_WINELIB_TYPE_AW(PROPENUMPROC)
330 typedef BOOL CALLBACK (*PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
331 typedef BOOL CALLBACK (*PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
332 DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
333 typedef BOOL CALLBACK (*TIMEFMT_ENUMPROCA)(LPSTR);
334 typedef BOOL CALLBACK (*TIMEFMT_ENUMPROCW)(LPWSTR);
335 DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
336 typedef VOID CALLBACK (*TIMERPROC)(HWND,UINT,UINT,DWORD);
337 typedef BOOL CALLBACK (*WNDENUMPROC)(HWND,LPARAM);
338 typedef LRESULT CALLBACK (*WNDPROC)(HWND,UINT,WPARAM,LPARAM);
340 /* Define some empty macros for compatibility with Windows code. */
342 #ifndef __WINE__
343 #define NEAR
344 #define FAR
345 #define near
346 #define far
347 #define _near
348 #define _far
349 #define IN
350 #define OUT
351 #define OPTIONAL
352 #endif /* __WINE__ */
354 #include "winnt.h"
356 /* Macro for structure packing. */
358 #ifdef __GNUC__
359 #define WINE_PACKED __attribute__((packed))
360 #define WINE_UNUSED __attribute__((unused))
361 #define WINE_NORETURN __attribute__((noreturn))
362 #else
363 #define WINE_PACKED /* nothing */
364 #define WINE_UNUSED /* nothing */
365 #define WINE_NORETURN /* nothing */
366 #endif
368 /* Macros to split words and longs. */
370 #define LOBYTE(w) ((BYTE)(WORD)(w))
371 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
373 #define LOWORD(l) ((WORD)(DWORD)(l))
374 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
376 #define SLOWORD(l) ((SHORT)(LONG)(l))
377 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
379 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
380 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
381 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
382 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
383 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
384 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
386 #define SELECTOROF(ptr) (HIWORD(ptr))
387 #define OFFSETOF(ptr) (LOWORD(ptr))
389 #ifdef __WINE__
390 /* macros to set parts of a DWORD (not in the Windows API) */
391 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
392 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
393 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
394 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
395 #endif
397 /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
398 /* Note: These macros are semantically broken, at least for wrc. wrc
399 spits out data in the platform's current binary format, *not* in
400 little-endian format. These macros are used throughout the resource
401 code to load and store data to the resources. Since it is unlikely
402 that we'll ever be dealing with little-endian resource data, the
403 byte-swapping nature of these macros has been disabled. Rather than
404 remove the use of these macros from the resource loading code, the
405 macros have simply been disabled. In the future, someone may want
406 to reactivate these macros for other purposes. In that case, the
407 resource code will have to be modified to use different macros. */
409 #if 1
410 #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
411 #define GET_WORD(ptr) (*(WORD *)(ptr))
412 #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
413 #define GET_DWORD(ptr) (*(DWORD *)(ptr))
414 #else
415 #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
416 *((BYTE *)(ptr) + 1) = HIBYTE(w))
417 #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
418 (WORD)(*((BYTE *)(ptr)+1) << 8)))
419 #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
420 PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
421 #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
422 ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
423 #endif /* 1 */
425 /* min and max macros */
426 #define __max(a,b) (((a) > (b)) ? (a) : (b))
427 #define __min(a,b) (((a) < (b)) ? (a) : (b))
428 #ifndef max
429 #define max(a,b) (((a) > (b)) ? (a) : (b))
430 #endif
431 #ifndef min
432 #define min(a,b) (((a) < (b)) ? (a) : (b))
433 #endif
435 #define _MAX_PATH 260
436 #define MAX_PATH 260
437 #define _MAX_DRIVE 3
438 #define _MAX_DIR 256
439 #define _MAX_FNAME 255
440 #define _MAX_EXT 256
442 #define HFILE_ERROR ((HFILE)-1)
444 /* The SIZE structure */
445 typedef struct tagSIZE
447 LONG cx;
448 LONG cy;
449 } SIZE, *PSIZE, *LPSIZE;
451 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
453 /* The POINT structure */
454 typedef struct tagPOINT
456 LONG x;
457 LONG y;
458 } POINT, *PPOINT, *LPPOINT;
460 typedef struct _POINTL
462 LONG x;
463 LONG y;
464 } POINTL;
466 /* The POINTS structure */
468 typedef struct tagPOINTS
470 SHORT x;
471 SHORT y;
472 } POINTS, *PPOINTS, *LPPOINTS;
474 /* The RECT structure */
475 typedef struct tagRECT
477 INT left;
478 INT top;
479 INT right;
480 INT bottom;
481 } RECT, *PRECT, *LPRECT;
482 typedef const RECT *LPCRECT;
485 typedef struct tagRECTL
487 LONG left;
488 LONG top;
489 LONG right;
490 LONG bottom;
491 } RECTL, *PRECTL, *LPRECTL;
493 typedef const RECTL *LPCRECTL;
495 #ifdef __cplusplus
497 #endif
499 #endif /* __WINE_WINDEF_H */