Note what to do with the winedefault.reg in the file.
[wine/multimedia.git] / include / windef.h
blob70873f013c2357c13641263bc16179f3b2536e49
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 # include "config.h"
12 # undef UNICODE
13 #endif /* __WINE__ */
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
19 /* Misc. constants. */
21 #ifdef FALSE
22 #undef FALSE
23 #endif
24 #define FALSE 0
26 #ifdef TRUE
27 #undef TRUE
28 #endif
29 #define TRUE 1
31 #ifdef NULL
32 #undef NULL
33 #endif
34 #define NULL 0
36 /* Macros to map Winelib names to the correct implementation name */
37 /* depending on __WINE__ and UNICODE macros. */
38 /* Note that Winelib is purely Win32. */
40 #ifdef __WINE__
41 # define WINELIB_NAME_AW(func) this_is_a_syntax_error this_is_a_syntax_error
42 #else /* __WINE__ */
43 # ifdef UNICODE
44 # define WINELIB_NAME_AW(func) func##W
45 # else
46 # define WINELIB_NAME_AW(func) func##A
47 # endif /* UNICODE */
48 #endif /* __WINE__ */
50 #ifdef __WINE__
51 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
52 #else /* __WINE__ */
53 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
54 #endif /* __WINE__ */
56 #ifndef NONAMELESSSTRUCT
57 # if defined(__WINE__) || !defined(_FORCENAMELESSSTRUCT)
58 # define NONAMELESSSTRUCT
59 # endif
60 #endif /* !defined(NONAMELESSSTRUCT) */
62 #ifndef NONAMELESSUNION
63 # if defined(__WINE__) || !defined(_FORCENAMELESSUNION) || !defined(__cplusplus)
64 # define NONAMELESSUNION
65 # endif
66 #endif /* !defined(NONAMELESSUNION) */
68 #ifndef NONAMELESSSTRUCT
69 #define DUMMYSTRUCTNAME
70 #define DUMMYSTRUCTNAME1
71 #define DUMMYSTRUCTNAME2
72 #define DUMMYSTRUCTNAME3
73 #define DUMMYSTRUCTNAME4
74 #define DUMMYSTRUCTNAME5
75 #else /* !defined(NONAMELESSSTRUCT) */
76 #define DUMMYSTRUCTNAME s
77 #define DUMMYSTRUCTNAME1 s1
78 #define DUMMYSTRUCTNAME2 s2
79 #define DUMMYSTRUCTNAME3 s3
80 #define DUMMYSTRUCTNAME4 s4
81 #define DUMMYSTRUCTNAME5 s5
82 #endif /* !defined(NONAMELESSSTRUCT) */
84 #ifndef NONAMELESSUNION
85 #define DUMMYUNIONNAME
86 #define DUMMYUNIONNAME1
87 #define DUMMYUNIONNAME2
88 #define DUMMYUNIONNAME3
89 #define DUMMYUNIONNAME4
90 #define DUMMYUNIONNAME5
91 #else /* !defined(NONAMELESSUNION) */
92 #define DUMMYUNIONNAME u
93 #define DUMMYUNIONNAME1 u1
94 #define DUMMYUNIONNAME2 u2
95 #define DUMMYUNIONNAME3 u3
96 #define DUMMYUNIONNAME4 u4
97 #define DUMMYUNIONNAME5 u5
98 #endif /* !defined(NONAMELESSUNION) */
100 /* Calling conventions definitions */
102 #ifdef __i386__
103 # if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
104 # define __stdcall __attribute__((__stdcall__))
105 # define __cdecl __attribute__((__cdecl__))
106 # define __RESTORE_ES __asm__ __volatile__("pushl %ds\n\tpopl %es")
107 # else
108 # error You need gcc >= 2.7 to build Wine on a 386
109 # endif /* __GNUC__ */
110 #else /* __i386__ */
111 # define __stdcall
112 # define __cdecl
113 # define __RESTORE_ES
114 #endif /* __i386__ */
116 #define CALLBACK __stdcall
117 #define WINAPI __stdcall
118 #define APIPRIVATE __stdcall
119 #define PASCAL __stdcall
120 #define pascal __stdcall
121 #define _pascal __stdcall
122 #define _stdcall __stdcall
123 #define _fastcall __stdcall
124 #define __export __stdcall
125 #define CDECL __cdecl
126 #define _CDECL __cdecl
127 #define cdecl __cdecl
128 #define _cdecl __cdecl
129 #define WINAPIV __cdecl
130 #define APIENTRY WINAPI
132 #define __declspec(x)
133 #define dllimport
134 #define dllexport
136 #define CONST const
138 /* Standard data types. These are the same for emulator and library. */
140 typedef void VOID;
141 typedef short INT16;
142 typedef unsigned short UINT16;
143 typedef int INT;
144 typedef unsigned int UINT;
145 typedef unsigned short WORD;
146 typedef unsigned long DWORD;
147 typedef unsigned long ULONG;
148 typedef unsigned char BYTE;
149 typedef long LONG;
150 typedef short SHORT;
151 typedef unsigned short USHORT;
152 typedef char CHAR;
153 typedef unsigned char UCHAR;
154 /* Some systems might have wchar_t, but we really need 16 bit characters */
155 typedef unsigned short WCHAR;
156 typedef unsigned short BOOL16;
157 typedef int BOOL;
158 typedef double DATE;
159 typedef double DOUBLE;
160 typedef double LONGLONG;
161 typedef double ULONGLONG;
163 /* FIXME: Wine does not compile with strict on, therefore strict
164 * handles are presently only usable on machines where sizeof(UINT) ==
165 * sizeof(void*). HANDLEs are supposed to be void* but a large amount
166 * of WINE code operates on HANDLES as if they are UINTs. So to WINE
167 * they exist as UINTs but to the Winelib user who turns on strict,
168 * they exist as void*. If there is a size difference between UINT and
169 * void* then things get ugly. */
170 #ifdef STRICT
171 typedef UINT16 HANDLE16;
172 typedef VOID* HANDLE;
173 #else
174 typedef UINT16 HANDLE16;
175 typedef UINT HANDLE;
176 #endif
178 typedef HANDLE16 *LPHANDLE16;
179 typedef HANDLE *LPHANDLE;
181 /* Integer types. These are the same for emulator and library. */
182 typedef UINT16 WPARAM16;
183 typedef UINT WPARAM;
184 typedef LONG LPARAM;
185 typedef LONG HRESULT;
186 typedef LONG LRESULT;
187 typedef WORD ATOM;
188 typedef WORD CATCHBUF[9];
189 typedef WORD *LPCATCHBUF;
190 typedef HANDLE HHOOK;
191 typedef HANDLE HMONITOR;
192 typedef DWORD LCID;
193 typedef WORD LANGID;
194 typedef DWORD LCTYPE;
195 typedef float FLOAT;
197 /* Pointers types. These are the same for emulator and library. */
198 /* winnt types */
199 typedef VOID *PVOID;
200 typedef const void *PCVOID;
201 typedef CHAR *PCHAR;
202 typedef UCHAR *PUCHAR;
203 typedef BYTE *PBYTE;
204 typedef WORD *PWORD;
205 typedef ULONG *PULONG;
206 typedef LONG *PLONG;
207 typedef DWORD *PDWORD;
208 /* common win32 types */
209 typedef CHAR *LPSTR;
210 typedef CHAR *PSTR;
211 typedef const CHAR *LPCSTR;
212 typedef const CHAR *PCSTR;
213 typedef WCHAR *LPWSTR;
214 typedef WCHAR *PWSTR;
215 typedef const WCHAR *LPCWSTR;
216 typedef const WCHAR *PCWSTR;
217 typedef BYTE *LPBYTE;
218 typedef WORD *LPWORD;
219 typedef DWORD *LPDWORD;
220 typedef LONG *LPLONG;
221 typedef VOID *LPVOID;
222 typedef const VOID *LPCVOID;
223 typedef INT16 *LPINT16;
224 typedef UINT16 *LPUINT16;
225 typedef INT *PINT;
226 typedef INT *LPINT;
227 typedef UINT *PUINT;
228 typedef UINT *LPUINT;
229 typedef FLOAT *PFLOAT;
230 typedef FLOAT *LPFLOAT;
231 typedef BOOL *PBOOL;
232 typedef BOOL *LPBOOL;
234 /* Special case: a segmented pointer is just a pointer in the user's code. */
236 #ifdef __WINE__
237 typedef DWORD SEGPTR;
238 #else
239 typedef void* SEGPTR;
240 #endif /* __WINE__ */
242 /* Handle types that exist both in Win16 and Win32. */
244 #ifdef STRICT
245 #define DECLARE_HANDLE(a) \
246 typedef HANDLE16 a##16; \
247 typedef a##16 *P##a##16; \
248 typedef a##16 *NP##a##16; \
249 typedef a##16 *LP##a##16; \
250 typedef struct a##__ { int unused; } *a; \
251 typedef a *P##a; \
252 typedef a *LP##a
253 #else /*STRICT*/
254 #define DECLARE_HANDLE(a) \
255 typedef HANDLE16 a##16; \
256 typedef a##16 *P##a##16; \
257 typedef a##16 *NP##a##16; \
258 typedef a##16 *LP##a##16; \
259 typedef HANDLE a; \
260 typedef a *P##a; \
261 typedef a *LP##a
262 #endif /*STRICT*/
264 DECLARE_HANDLE(HACMDRIVERID);
265 DECLARE_HANDLE(HACMDRIVER);
266 DECLARE_HANDLE(HACMOBJ);
267 DECLARE_HANDLE(HACMSTREAM);
268 DECLARE_HANDLE(HMETAFILEPICT);
270 DECLARE_HANDLE(HACCEL);
271 DECLARE_HANDLE(HBITMAP);
272 DECLARE_HANDLE(HBRUSH);
273 DECLARE_HANDLE(HCOLORSPACE);
274 DECLARE_HANDLE(HCURSOR);
275 DECLARE_HANDLE(HDC);
276 DECLARE_HANDLE(HDROP);
277 DECLARE_HANDLE(HDRVR);
278 DECLARE_HANDLE(HDWP);
279 DECLARE_HANDLE(HENHMETAFILE);
280 DECLARE_HANDLE(HFILE);
281 DECLARE_HANDLE(HFONT);
282 DECLARE_HANDLE(HICON);
283 DECLARE_HANDLE(HINSTANCE);
284 DECLARE_HANDLE(HKEY);
285 DECLARE_HANDLE(HMENU);
286 DECLARE_HANDLE(HMETAFILE);
287 DECLARE_HANDLE(HMIDI);
288 DECLARE_HANDLE(HMIDIIN);
289 DECLARE_HANDLE(HMIDIOUT);
290 DECLARE_HANDLE(HMIDISTRM);
291 DECLARE_HANDLE(HMIXER);
292 DECLARE_HANDLE(HMIXEROBJ);
293 DECLARE_HANDLE(HMMIO);
294 DECLARE_HANDLE(HPALETTE);
295 DECLARE_HANDLE(HPEN);
296 DECLARE_HANDLE(HQUEUE);
297 DECLARE_HANDLE(HRGN);
298 DECLARE_HANDLE(HRSRC);
299 DECLARE_HANDLE(HTASK);
300 DECLARE_HANDLE(HWAVE);
301 DECLARE_HANDLE(HWAVEIN);
302 DECLARE_HANDLE(HWAVEOUT);
303 DECLARE_HANDLE(HWINSTA);
304 DECLARE_HANDLE(HDESK);
305 DECLARE_HANDLE(HWND);
306 DECLARE_HANDLE(HKL);
307 DECLARE_HANDLE(HIC);
308 DECLARE_HANDLE(HRASCONN);
309 #undef DECLARE_HANDLE
311 /* Handle types that must remain interchangeable even with strict on */
313 typedef HINSTANCE16 HMODULE16;
314 typedef HINSTANCE HMODULE;
315 typedef HANDLE16 HGDIOBJ16;
316 typedef HANDLE16 HGLOBAL16;
317 typedef HANDLE16 HLOCAL16;
318 typedef HANDLE HGDIOBJ;
319 typedef HANDLE HGLOBAL;
320 typedef HANDLE HLOCAL;
322 /* Callback function pointers types */
324 typedef BOOL (CALLBACK* DATEFMT_ENUMPROCA)(LPSTR);
325 typedef BOOL (CALLBACK* DATEFMT_ENUMPROCW)(LPWSTR);
326 DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
327 typedef BOOL16 (CALLBACK *DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
328 typedef BOOL (CALLBACK *DLGPROC)(HWND,UINT,WPARAM,LPARAM);
329 typedef LRESULT (CALLBACK *DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
330 typedef LRESULT (CALLBACK *DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
331 typedef INT16 (CALLBACK *EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
332 typedef INT (CALLBACK *EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
333 typedef INT (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
334 DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
335 typedef LRESULT (CALLBACK *FARPROC16)();
336 typedef LRESULT (CALLBACK *FARPROC)();
337 typedef INT16 (CALLBACK *PROC16)();
338 typedef INT (CALLBACK *PROC)();
339 typedef BOOL16 (CALLBACK *GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
340 typedef BOOL (CALLBACK *GRAYSTRINGPROC)(HDC,LPARAM,INT);
341 typedef LRESULT (CALLBACK *HOOKPROC16)(INT16,WPARAM16,LPARAM);
342 typedef LRESULT (CALLBACK *HOOKPROC)(INT,WPARAM,LPARAM);
343 typedef BOOL16 (CALLBACK *PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
344 typedef BOOL (CALLBACK *PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
345 typedef BOOL (CALLBACK *PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
346 DECL_WINELIB_TYPE_AW(PROPENUMPROC)
347 typedef BOOL (CALLBACK *PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
348 typedef BOOL (CALLBACK *PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
349 DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
350 typedef BOOL (CALLBACK* TIMEFMT_ENUMPROCA)(LPSTR);
351 typedef BOOL (CALLBACK* TIMEFMT_ENUMPROCW)(LPWSTR);
352 DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
353 typedef VOID (CALLBACK *TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
354 typedef VOID (CALLBACK *TIMERPROC)(HWND,UINT,UINT,DWORD);
355 typedef LRESULT (CALLBACK *WNDENUMPROC16)(HWND16,LPARAM);
356 typedef LRESULT (CALLBACK *WNDENUMPROC)(HWND,LPARAM);
357 typedef LRESULT (CALLBACK *WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
358 typedef LRESULT (CALLBACK *WNDPROC)(HWND,UINT,WPARAM,LPARAM);
360 /* Define some empty macros for compatibility with Windows code. */
362 #ifndef __WINE__
363 #define NEAR
364 #define FAR
365 #define near
366 #define far
367 #define _near
368 #define _far
369 #define IN
370 #define OUT
371 #define OPTIONAL
372 #endif /* __WINE__ */
374 /* Macro for structure packing. */
376 #ifdef __GNUC__
377 #define WINE_PACKED __attribute__ ((packed))
378 #define WINE_UNUSED __attribute__ ((unused))
379 #else
380 #define WINE_PACKED /* nothing */
381 #define WINE_UNUSED /* nothing */
382 #endif
384 /* Macros to split words and longs. */
386 #define LOBYTE(w) ((BYTE)(WORD)(w))
387 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
389 #define LOWORD(l) ((WORD)(DWORD)(l))
390 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
392 #define SLOWORD(l) ((INT16)(LONG)(l))
393 #define SHIWORD(l) ((INT16)((LONG)(l) >> 16))
395 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
396 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
397 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
398 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
399 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
400 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
402 #define SELECTOROF(ptr) (HIWORD(ptr))
403 #define OFFSETOF(ptr) (LOWORD(ptr))
405 #ifdef __WINE__
406 /* macros to set parts of a DWORD (not in the Windows API) */
407 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
408 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
409 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOWORD(val) & 0xff00))
410 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
411 #endif
413 /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
414 /* Note: These macros are semantically broken, at least for wrc. wrc
415 spits out data in the platform's current binary format, *not* in
416 little-endian format. These macros are used throughout the resource
417 code to load and store data to the resources. Since it is unlikely
418 that we'll ever be dealing with little-endian resource data, the
419 byte-swapping nature of these macros has been disabled. Rather than
420 remove the use of these macros from the resource loading code, the
421 macros have simply been disabled. In the future, someone may want
422 to reactivate these macros for other purposes. In that case, the
423 resource code will have to be modified to use different macros. */
425 #if 1
426 #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
427 #define GET_WORD(ptr) (*(WORD *)(ptr))
428 #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
429 #define GET_DWORD(ptr) (*(DWORD *)(ptr))
430 #else
431 #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
432 *((BYTE *)(ptr) + 1) = HIBYTE(w))
433 #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
434 (WORD)(*((BYTE *)(ptr)+1) << 8)))
435 #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
436 PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
437 #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
438 ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
439 #endif /* 1 */
441 /* MIN and MAX macros */
443 #ifdef MAX
444 #undef MAX
445 #endif
446 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
448 #ifdef MIN
449 #undef MIN
450 #endif
451 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
453 #define __max(a,b) MAX(a,b)
454 #define __min(a,b) MIN(a,b)
455 #ifndef max
456 #define max(a,b) MAX(a,b)
457 #endif
458 #ifndef min
459 #define min(a,b) MIN(a,b)
460 #endif
462 #define _MAX_PATH 260
463 #define MAX_PATH 260
464 #define _MAX_DRIVE 3
465 #define _MAX_DIR 256
466 #define _MAX_FNAME 255
467 #define _MAX_EXT 256
469 #define HFILE_ERROR16 ((HFILE16)-1)
470 #define HFILE_ERROR ((HFILE)-1)
472 /* The SIZE structure */
474 typedef struct
476 INT16 cx;
477 INT16 cy;
478 } SIZE16, *PSIZE16, *LPSIZE16;
480 typedef struct tagSIZE
482 INT cx;
483 INT cy;
484 } SIZE, *PSIZE, *LPSIZE;
487 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
489 #define CONV_SIZE16TO32(s16,s32) \
490 ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy)
491 #define CONV_SIZE32TO16(s32,s16) \
492 ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
494 /* The POINT structure */
496 typedef struct
498 INT16 x;
499 INT16 y;
500 } POINT16, *PPOINT16, *LPPOINT16;
502 typedef struct tagPOINT
504 LONG x;
505 LONG y;
506 } POINT, *PPOINT, *LPPOINT;
508 typedef struct _POINTL
510 LONG x;
511 LONG y;
512 } POINTL;
514 #define CONV_POINT16TO32(p16,p32) \
515 ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y)
516 #define CONV_POINT32TO16(p32,p16) \
517 ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
519 #define MAKEPOINT16(l) (*((POINT16 *)&(l)))
521 /* The POINTS structure */
523 typedef struct tagPOINTS
525 SHORT x;
526 SHORT y;
527 } POINTS, *PPOINTS, *LPPOINTS;
530 #define MAKEPOINTS(l) (*((POINTS *)&(l)))
533 /* The RECT structure */
535 typedef struct
537 INT16 left;
538 INT16 top;
539 INT16 right;
540 INT16 bottom;
541 } RECT16, *LPRECT16;
543 typedef struct tagRECT
545 INT left;
546 INT top;
547 INT right;
548 INT bottom;
549 } RECT, *PRECT, *LPRECT;
550 typedef const RECT *LPCRECT;
553 typedef struct tagRECTL
555 LONG left;
556 LONG top;
557 LONG right;
558 LONG bottom;
559 } RECTL, *PRECTL, *LPRECTL;
561 typedef const RECTL *LPCRECTL;
563 #define CONV_RECT16TO32(r16,r32) \
564 ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \
565 (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom)
566 #define CONV_RECT32TO16(r32,r16) \
567 ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \
568 (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom)
570 #ifdef __cplusplus
572 #endif
574 #endif /* __WINE_WINDEF_H */