32-bit clipboard support.
[wine/multimedia.git] / include / wintypes.h
blob64e7d6c3c5971f5878b85020be7b3e120d69e52c
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_WINTYPES_H
8 #define __WINE_WINTYPES_H
10 #ifdef __WINE__
11 # include "config.h"
12 # undef UNICODE
13 #endif /* __WINE__ */
15 /* Macros to map Winelib names to the correct implementation name */
16 /* depending on __WINE__ and UNICODE macros. */
17 /* Note that Winelib is purely Win32. */
19 #ifdef __WINE__
20 # define WINELIB_NAME(func) this_is_a_syntax_error this_is_a_syntax_error
21 # define WINELIB_NAME_AW(func) this_is_a_syntax_error this_is_a_syntax_error
22 #else /* __WINE__ */
23 # define WINELIB_NAME(func) func##32
24 # ifdef UNICODE
25 # define WINELIB_NAME_AW(func) func##32W
26 # else
27 # define WINELIB_NAME_AW(func) func##32A
28 # endif /* UNICODE */
29 #endif /* __WINE__ */
31 #ifdef __WINE__
32 # define DECL_WINELIB_TYPE(type) /* nothing */
33 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
34 #else /* __WINE__ */
35 # define DECL_WINELIB_TYPE(type) typedef WINELIB_NAME(type) type;
36 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
37 #endif /* __WINE__ */
40 /* Calling conventions definitions */
42 #ifdef __i386__
43 # if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)
44 # define __stdcall __attribute__((__stdcall__))
45 # define __cdecl __attribute__((__cdecl__))
46 # define __RESTORE_ES __asm__ __volatile__("pushl %ds\n\tpopl %es")
47 # else
48 # error You need gcc >= 2.7 to build Wine on a 386
49 # endif /* __GNUC__ */
50 #else /* __i386__ */
51 # define __stdcall
52 # define __cdecl
53 # define __RESTORE_ES
54 #endif /* __i386__ */
56 #define CALLBACK __stdcall
57 #define WINAPI __stdcall
58 #define APIPRIVATE __stdcall
59 #define PASCAL __stdcall
60 #define _pascal __stdcall
61 #define __export __stdcall
62 #define WINAPIV __cdecl
63 #define APIENTRY WINAPI
66 /* Standard data types. These are the same for emulator and library. */
68 typedef void VOID;
69 typedef short INT16;
70 typedef unsigned short UINT16;
71 typedef int INT32;
72 typedef unsigned int UINT32;
73 typedef unsigned short WORD;
74 typedef unsigned long DWORD;
75 typedef unsigned long ULONG;
76 typedef unsigned char BYTE;
77 typedef long LONG;
78 typedef char CHAR;
79 /* Some systems might have wchar_t, but we really need 16 bit characters */
80 typedef unsigned short WCHAR;
81 typedef unsigned short BOOL16;
82 typedef int BOOL32;
84 /* Integer types. These are the same for emulator and library. */
86 typedef UINT16 HANDLE16;
87 typedef UINT32 HANDLE32;
88 typedef UINT16 WPARAM16;
89 typedef UINT32 WPARAM32;
90 typedef LONG LPARAM;
91 typedef LONG HRESULT;
92 typedef LONG LRESULT;
93 typedef WORD ATOM;
94 typedef WORD CATCHBUF[9];
95 typedef WORD *LPCATCHBUF;
96 typedef DWORD ACCESS_MASK;
97 typedef ACCESS_MASK REGSAM;
98 typedef HANDLE32 HHOOK;
99 typedef HANDLE32 HKEY;
100 typedef HANDLE32 HMONITOR;
101 typedef DWORD LCID;
102 typedef WORD LANGID;
103 typedef DWORD LCTYPE;
104 typedef float FLOAT;
106 /* Pointers types. These are the same for emulator and library. */
108 typedef CHAR *LPSTR;
109 typedef const CHAR *LPCSTR;
110 typedef WCHAR *LPWSTR;
111 typedef const WCHAR *LPCWSTR;
112 typedef BYTE *LPBYTE;
113 typedef WORD *LPWORD;
114 typedef DWORD *LPDWORD;
115 typedef LONG *LPLONG;
116 typedef VOID *LPVOID;
117 typedef const VOID *LPCVOID;
118 typedef INT16 *LPINT16;
119 typedef UINT16 *LPUINT16;
120 typedef INT32 *LPINT32;
121 typedef UINT32 *LPUINT32;
122 typedef HKEY *LPHKEY;
123 typedef FLOAT *LPFLOAT;
125 /* Special case: a segmented pointer is just a pointer in the user's code. */
127 #ifdef __WINE__
128 typedef DWORD SEGPTR;
129 #else
130 typedef void* SEGPTR;
131 #endif /* __WINE__ */
133 /* Handle types that exist both in Win16 and Win32. */
135 #define DECLARE_HANDLE(a) typedef HANDLE16 a##16; typedef HANDLE32 a##32
136 DECLARE_HANDLE(HACCEL);
137 DECLARE_HANDLE(HBITMAP);
138 DECLARE_HANDLE(HBRUSH);
139 DECLARE_HANDLE(HCOLORSPACE);
140 DECLARE_HANDLE(HCURSOR);
141 DECLARE_HANDLE(HDC);
142 DECLARE_HANDLE(HDROP);
143 DECLARE_HANDLE(HDRVR);
144 DECLARE_HANDLE(HDWP);
145 DECLARE_HANDLE(HENHMETAFILE);
146 DECLARE_HANDLE(HFILE);
147 DECLARE_HANDLE(HFONT);
148 DECLARE_HANDLE(HGDIOBJ);
149 DECLARE_HANDLE(HGLOBAL);
150 DECLARE_HANDLE(HICON);
151 DECLARE_HANDLE(HINSTANCE);
152 DECLARE_HANDLE(HLOCAL);
153 DECLARE_HANDLE(HMENU);
154 DECLARE_HANDLE(HMETAFILE);
155 DECLARE_HANDLE(HMIDI);
156 DECLARE_HANDLE(HMIDIIN);
157 DECLARE_HANDLE(HMIDIOUT);
158 DECLARE_HANDLE(HMIXER);
159 DECLARE_HANDLE(HMIXEROBJ);
160 DECLARE_HANDLE(HMMIO);
161 DECLARE_HANDLE(HMODULE);
162 DECLARE_HANDLE(HPALETTE);
163 DECLARE_HANDLE(HPEN);
164 DECLARE_HANDLE(HQUEUE);
165 DECLARE_HANDLE(HRGN);
166 DECLARE_HANDLE(HRSRC);
167 DECLARE_HANDLE(HTASK);
168 DECLARE_HANDLE(HWAVE);
169 DECLARE_HANDLE(HWAVEIN);
170 DECLARE_HANDLE(HWAVEOUT);
171 DECLARE_HANDLE(HWND);
172 DECLARE_HANDLE(HKL);
173 DECLARE_HANDLE(HIC);
174 #undef DECLARE_HANDLE
176 /* Callback function pointers types */
178 typedef BOOL32 (CALLBACK* DATEFMT_ENUMPROC32A)(LPSTR);
179 typedef BOOL32 (CALLBACK* DATEFMT_ENUMPROC32W)(LPWSTR);
180 DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
181 typedef LRESULT (CALLBACK *DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
182 typedef LRESULT (CALLBACK *DLGPROC32)(HWND32,UINT32,WPARAM32,LPARAM);
183 DECL_WINELIB_TYPE(DLGPROC)
184 typedef LRESULT (CALLBACK *DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
185 typedef LRESULT (CALLBACK *DRIVERPROC32)(DWORD,HDRVR32,UINT32,LPARAM,LPARAM);
186 DECL_WINELIB_TYPE(DRIVERPROC)
187 typedef INT16 (CALLBACK *EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
188 typedef INT32 (CALLBACK *EDITWORDBREAKPROC32A)(LPSTR,INT32,INT32,INT32);
189 typedef INT32 (CALLBACK *EDITWORDBREAKPROC32W)(LPWSTR,INT32,INT32,INT32);
190 DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
191 typedef LRESULT (CALLBACK *FARPROC16)();
192 typedef LRESULT (CALLBACK *FARPROC32)();
193 DECL_WINELIB_TYPE(FARPROC)
194 typedef INT16 (CALLBACK *GOBJENUMPROC16)(SEGPTR,LPARAM);
195 typedef INT32 (CALLBACK *GOBJENUMPROC32)(LPVOID,LPARAM);
196 DECL_WINELIB_TYPE(GOBJENUMPROC)
197 typedef BOOL16 (CALLBACK *GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
198 typedef BOOL32 (CALLBACK *GRAYSTRINGPROC32)(HDC32,LPARAM,INT32);
199 DECL_WINELIB_TYPE(GRAYSTRINGPROC)
200 typedef LRESULT (CALLBACK *HOOKPROC16)(INT16,WPARAM16,LPARAM);
201 typedef LRESULT (CALLBACK *HOOKPROC32)(INT32,WPARAM32,LPARAM);
202 DECL_WINELIB_TYPE(HOOKPROC)
203 typedef VOID (CALLBACK *LINEDDAPROC16)(INT16,INT16,LPARAM);
204 typedef VOID (CALLBACK *LINEDDAPROC32)(INT32,INT32,LPARAM);
205 DECL_WINELIB_TYPE(LINEDDAPROC)
206 typedef BOOL16 (CALLBACK *PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
207 typedef BOOL32 (CALLBACK *PROPENUMPROC32A)(HWND32,LPCSTR,HANDLE32);
208 typedef BOOL32 (CALLBACK *PROPENUMPROC32W)(HWND32,LPCWSTR,HANDLE32);
209 DECL_WINELIB_TYPE_AW(PROPENUMPROC)
210 typedef BOOL32 (CALLBACK *PROPENUMPROCEX32A)(HWND32,LPCSTR,HANDLE32,LPARAM);
211 typedef BOOL32 (CALLBACK *PROPENUMPROCEX32W)(HWND32,LPCWSTR,HANDLE32,LPARAM);
212 DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
213 typedef BOOL32 (CALLBACK* TIMEFMT_ENUMPROC32A)(LPSTR);
214 typedef BOOL32 (CALLBACK* TIMEFMT_ENUMPROC32W)(LPWSTR);
215 DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
216 typedef VOID (CALLBACK *TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
217 typedef VOID (CALLBACK *TIMERPROC32)(HWND32,UINT32,UINT32,DWORD);
218 DECL_WINELIB_TYPE(TIMERPROC)
219 typedef LRESULT (CALLBACK *WNDENUMPROC16)(HWND16,LPARAM);
220 typedef LRESULT (CALLBACK *WNDENUMPROC32)(HWND32,LPARAM);
221 DECL_WINELIB_TYPE(WNDENUMPROC)
222 typedef LRESULT (CALLBACK *WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
223 typedef LRESULT (CALLBACK *WNDPROC32)(HWND32,UINT32,WPARAM32,LPARAM);
224 DECL_WINELIB_TYPE(WNDPROC)
226 /* TCHAR data types definitions for Winelib. */
227 /* These types are _not_ defined for the emulator, because they */
228 /* depend on the UNICODE macro that only exists in user's code. */
230 #ifndef __WINE__
231 # ifdef UNICODE
232 typedef WCHAR TCHAR;
233 typedef LPWSTR LPTSTR;
234 typedef LPCWSTR LPCTSTR;
235 # else /* UNICODE */
236 typedef CHAR TCHAR;
237 typedef LPSTR LPTSTR;
238 typedef LPCSTR LPCTSTR;
239 # endif /* UNICODE */
240 #endif /* __WINE__ */
242 /* Data types specific to the library. These do _not_ exist in the emulator. */
244 DECL_WINELIB_TYPE(INT)
245 DECL_WINELIB_TYPE(LPINT)
246 DECL_WINELIB_TYPE(LPUINT)
247 DECL_WINELIB_TYPE(UINT)
248 DECL_WINELIB_TYPE(BOOL)
249 DECL_WINELIB_TYPE(WPARAM)
251 DECL_WINELIB_TYPE(HACCEL)
252 DECL_WINELIB_TYPE(HANDLE)
253 DECL_WINELIB_TYPE(HBITMAP)
254 DECL_WINELIB_TYPE(HBRUSH)
255 DECL_WINELIB_TYPE(HCOLORSPACE)
256 DECL_WINELIB_TYPE(HCURSOR)
257 DECL_WINELIB_TYPE(HDC)
258 DECL_WINELIB_TYPE(HDROP)
259 DECL_WINELIB_TYPE(HDRVR)
260 DECL_WINELIB_TYPE(HDWP)
261 DECL_WINELIB_TYPE(HENHMETAFILE)
262 DECL_WINELIB_TYPE(HFILE)
263 DECL_WINELIB_TYPE(HFONT)
264 DECL_WINELIB_TYPE(HGDIOBJ)
265 DECL_WINELIB_TYPE(HGLOBAL)
266 DECL_WINELIB_TYPE(HICON)
267 DECL_WINELIB_TYPE(HINSTANCE)
268 DECL_WINELIB_TYPE(HLOCAL)
269 DECL_WINELIB_TYPE(HMENU)
270 DECL_WINELIB_TYPE(HMETAFILE)
271 DECL_WINELIB_TYPE(HMIDI)
272 DECL_WINELIB_TYPE(HMIDIIN)
273 DECL_WINELIB_TYPE(HMIDIOUT)
274 DECL_WINELIB_TYPE(HMMIO)
275 DECL_WINELIB_TYPE(HMODULE)
276 DECL_WINELIB_TYPE(HPALETTE)
277 DECL_WINELIB_TYPE(HPEN)
278 DECL_WINELIB_TYPE(HQUEUE)
279 DECL_WINELIB_TYPE(HRGN)
280 DECL_WINELIB_TYPE(HRSRC)
281 DECL_WINELIB_TYPE(HTASK)
282 DECL_WINELIB_TYPE(HWAVE)
283 DECL_WINELIB_TYPE(HWAVEIN)
284 DECL_WINELIB_TYPE(HWAVEOUT)
285 DECL_WINELIB_TYPE(HWND)
287 /* Misc. constants. */
289 #ifdef FALSE
290 #undef FALSE
291 #endif
292 #define FALSE 0
294 #ifdef TRUE
295 #undef TRUE
296 #endif
297 #define TRUE 1
299 #ifdef NULL
300 #undef NULL
301 #endif
302 #define NULL 0
304 /* Define some empty macros for compatibility with Windows code. */
306 #ifndef __WINE__
307 #define NEAR
308 #define FAR
309 #define _far
310 #define _near
311 #endif /* __WINE__ */
313 /* Macro for structure packing. */
315 #ifdef __GNUC__
316 #define WINE_PACKED __attribute__ ((packed))
317 #else
318 #define WINE_PACKED /* nothing */
319 #endif
321 /* Macros to split words and longs. */
323 #define LOBYTE(w) ((BYTE)(WORD)(w))
324 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
326 #define LOWORD(l) ((WORD)(DWORD)(l))
327 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
329 #define SLOWORD(l) ((INT16)(LONG)(l))
330 #define SHIWORD(l) ((INT16)((LONG)(l) >> 16))
332 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | \
333 (((DWORD)((WORD)(high))) << 16)))
334 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
335 #define MAKEWPARAM(low,high) ((WPARAM32)MAKELONG(low,high))
336 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
338 #define SELECTOROF(ptr) (HIWORD(ptr))
339 #define OFFSETOF(ptr) (LOWORD(ptr))
341 /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
343 #ifdef __i386__
344 #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
345 #define GET_WORD(ptr) (*(WORD *)(ptr))
346 #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
347 #define GET_DWORD(ptr) (*(DWORD *)(ptr))
348 #else
349 #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
350 *((BYTE *)(ptr) + 1) = HIBYTE(w))
351 #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
352 (WORD)(*((BYTE *)(ptr)+1) << 8)))
353 #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
354 PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
355 #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
356 ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
357 #endif /* __i386__ */
359 /* MIN and MAX macros */
361 #ifdef MAX
362 #undef MAX
363 #endif
364 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
366 #ifdef MIN
367 #undef MIN
368 #endif
369 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
371 /* Winelib run-time flag */
373 #ifdef __WINE__
374 extern int __winelib;
375 #endif /* __WINE__ */
377 #endif /* __WINE_WINTYPES_H */