Added coded stubs for DdeQueryConvInfo (16 & 32 bit), DdeAddData (32
[wine] / include / wintypes.h
1 /*
2  * Basic types definitions
3  *
4  * Copyright 1996 Alexandre Julliard
5  */
6
7 /* Misc. constants. */
8
9 #ifdef FALSE
10 #undef FALSE
11 #endif
12 #define FALSE 0
13
14 #ifdef TRUE
15 #undef TRUE
16 #endif
17 #define TRUE  1
18
19 #ifdef NULL
20 #undef NULL
21 #endif
22 #define NULL  0
23
24 #ifndef __WINE_WINTYPES_H
25 #define __WINE_WINTYPES_H
26
27 #ifdef __WINE__
28 # include "config.h"
29 # undef UNICODE
30 #endif  /* __WINE__ */
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
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.                             */
39
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__ */
49
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__ */
55
56
57 /* Calling conventions definitions */
58
59 #ifdef __i386__
60 # if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)
61 #  define __stdcall __attribute__((__stdcall__))
62 #  define __cdecl   __attribute__((__cdecl__))
63 #  define __RESTORE_ES  __asm__ __volatile__("pushl %ds\n\tpopl %es")
64 # else
65 #  error You need gcc >= 2.7 to build Wine on a 386
66 # endif  /* __GNUC__ */
67 #else  /* __i386__ */
68 # define __stdcall
69 # define __cdecl
70 # define __RESTORE_ES
71 #endif  /* __i386__ */
72
73 #define CALLBACK    __stdcall
74 #define WINAPI      __stdcall
75 #define APIPRIVATE  __stdcall
76 #define PASCAL      __stdcall
77 #define _pascal     __stdcall
78 #define __export    __stdcall
79 #define WINAPIV     __cdecl
80 #define APIENTRY    WINAPI
81
82 #define CONST       const
83
84 /* Standard data types. These are the same for emulator and library. */
85
86 typedef void            VOID;
87 typedef short           INT16;
88 typedef unsigned short  UINT16;
89 typedef int             INT;
90 typedef unsigned int    UINT;
91 typedef unsigned short  WORD;
92 typedef unsigned long   DWORD;
93 typedef unsigned long   ULONG;
94 typedef unsigned char   BYTE;
95 typedef long            LONG;
96 typedef short           SHORT;
97 typedef unsigned short  USHORT;
98 typedef char            CHAR;
99 typedef unsigned char   UCHAR;
100 /* Some systems might have wchar_t, but we really need 16 bit characters */
101 typedef unsigned short  WCHAR;
102 typedef unsigned short  BOOL16;
103 typedef int             BOOL;
104 typedef double          DATE;
105 typedef long            LONG_PTR;
106 typedef unsigned long   ULONG_PTR;
107 typedef double          DOUBLE;
108 typedef double          LONGLONG;
109 typedef double          ULONGLONG;
110
111 /* Integer types. These are the same for emulator and library. */
112
113 typedef UINT16          HANDLE16;
114 typedef UINT            HANDLE;
115 typedef UINT16         *LPHANDLE16;
116 typedef UINT           *LPHANDLE;
117 typedef UINT16          WPARAM16;
118 typedef UINT            WPARAM;
119 typedef LONG            LPARAM;
120 typedef LONG            HRESULT;
121 typedef LONG            LRESULT;
122 typedef WORD            ATOM;
123 typedef WORD            CATCHBUF[9];
124 typedef WORD           *LPCATCHBUF;
125 typedef DWORD           ACCESS_MASK;
126 typedef ACCESS_MASK     REGSAM;
127 typedef HANDLE          HHOOK;
128 typedef HANDLE          HKEY;
129 typedef HANDLE          HMONITOR;
130 typedef DWORD           LCID;
131 typedef WORD            LANGID;
132 typedef DWORD           LCTYPE;
133 typedef float           FLOAT;
134 typedef long long       __int64;
135
136 /* Pointers types. These are the same for emulator and library. */
137 /* winnt types */
138 typedef VOID           *PVOID;
139 typedef const void     *PCVOID;
140 typedef CHAR           *PCHAR;
141 typedef UCHAR          *PUCHAR;
142 typedef BYTE           *PBYTE;
143 typedef ULONG          *PULONG;
144 typedef LONG           *PLONG;
145 typedef DWORD          *PDWORD;
146 /* common win32 types */
147 typedef CHAR           *LPSTR;
148 typedef CHAR           *PSTR;
149 typedef const CHAR     *LPCSTR;
150 typedef const CHAR     *PCSTR;
151 typedef WCHAR          *LPWSTR;
152 typedef WCHAR          *PWSTR;
153 typedef const WCHAR    *LPCWSTR;
154 typedef const WCHAR    *PCWSTR;
155 typedef BYTE           *LPBYTE;
156 typedef WORD           *LPWORD;
157 typedef DWORD          *LPDWORD;
158 typedef LONG           *LPLONG;
159 typedef VOID           *LPVOID;
160 typedef const VOID     *LPCVOID;
161 typedef INT16          *LPINT16;
162 typedef UINT16         *LPUINT16;
163 typedef INT            *PINT;
164 typedef INT            *LPINT;
165 typedef UINT           *PUINT;
166 typedef UINT           *LPUINT;
167 typedef HKEY           *LPHKEY;
168 typedef HKEY           *PHKEY;
169 typedef FLOAT          *PFLOAT;
170 typedef FLOAT          *LPFLOAT;
171 typedef BOOL           *PBOOL;
172 typedef BOOL           *LPBOOL;
173
174 /* Special case: a segmented pointer is just a pointer in the user's code. */
175
176 #ifdef __WINE__
177 typedef DWORD SEGPTR;
178 #else
179 typedef void* SEGPTR;
180 #endif /* __WINE__ */
181
182 /* Handle types that exist both in Win16 and Win32. */
183
184 #define DECLARE_HANDLE(a)  typedef HANDLE16 a##16; typedef HANDLE a
185 DECLARE_HANDLE(HACCEL);
186 DECLARE_HANDLE(HBITMAP);
187 DECLARE_HANDLE(HBRUSH);
188 DECLARE_HANDLE(HCOLORSPACE);
189 DECLARE_HANDLE(HCURSOR);
190 DECLARE_HANDLE(HDC);
191 DECLARE_HANDLE(HDROP);
192 DECLARE_HANDLE(HDRVR);
193 DECLARE_HANDLE(HDWP);
194 DECLARE_HANDLE(HENHMETAFILE);
195 DECLARE_HANDLE(HFILE);
196 DECLARE_HANDLE(HFONT);
197 DECLARE_HANDLE(HGDIOBJ);
198 DECLARE_HANDLE(HGLOBAL);
199 DECLARE_HANDLE(HICON);
200 DECLARE_HANDLE(HINSTANCE);
201 DECLARE_HANDLE(HLOCAL);
202 DECLARE_HANDLE(HMENU);
203 DECLARE_HANDLE(HMETAFILE);
204 DECLARE_HANDLE(HMIDI);
205 DECLARE_HANDLE(HMIDIIN);
206 DECLARE_HANDLE(HMIDIOUT);
207 DECLARE_HANDLE(HMIDISTRM);
208 DECLARE_HANDLE(HMIXER);
209 DECLARE_HANDLE(HMIXEROBJ);
210 DECLARE_HANDLE(HMMIO);
211 DECLARE_HANDLE(HMODULE);
212 DECLARE_HANDLE(HPALETTE);
213 DECLARE_HANDLE(HPEN);
214 DECLARE_HANDLE(HQUEUE);
215 DECLARE_HANDLE(HRGN);
216 DECLARE_HANDLE(HRSRC);
217 DECLARE_HANDLE(HTASK);
218 DECLARE_HANDLE(HWAVE);
219 DECLARE_HANDLE(HWAVEIN);
220 DECLARE_HANDLE(HWAVEOUT);
221 DECLARE_HANDLE(HWINSTA);
222 DECLARE_HANDLE(HDESK);
223 DECLARE_HANDLE(HWND);
224 DECLARE_HANDLE(HKL);
225 DECLARE_HANDLE(HIC);
226 DECLARE_HANDLE(HRASCONN);
227 #undef DECLARE_HANDLE
228
229 /* Callback function pointers types */
230
231 typedef BOOL    (CALLBACK* DATEFMT_ENUMPROCA)(LPSTR);
232 typedef BOOL    (CALLBACK* DATEFMT_ENUMPROCW)(LPWSTR);
233 DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
234 typedef BOOL16  (CALLBACK *DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
235 typedef BOOL    (CALLBACK *DLGPROC)(HWND,UINT,WPARAM,LPARAM);
236 typedef LRESULT (CALLBACK *DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
237 typedef LRESULT (CALLBACK *DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
238 typedef INT16   (CALLBACK *EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
239 typedef INT     (CALLBACK *EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
240 typedef INT     (CALLBACK *EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
241 DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
242 typedef LRESULT (CALLBACK *FARPROC16)();
243 typedef LRESULT (CALLBACK *FARPROC)();
244 typedef INT16   (CALLBACK *PROC16)();
245 typedef INT     (CALLBACK *PROC)();
246 typedef INT16   (CALLBACK *GOBJENUMPROC16)(SEGPTR,LPARAM);
247 typedef INT     (CALLBACK *GOBJENUMPROC)(LPVOID,LPARAM);
248 typedef BOOL16  (CALLBACK *GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
249 typedef BOOL    (CALLBACK *GRAYSTRINGPROC)(HDC,LPARAM,INT);
250 typedef LRESULT (CALLBACK *HOOKPROC16)(INT16,WPARAM16,LPARAM);
251 typedef LRESULT (CALLBACK *HOOKPROC)(INT,WPARAM,LPARAM);
252 typedef VOID    (CALLBACK *LINEDDAPROC16)(INT16,INT16,LPARAM);
253 typedef VOID    (CALLBACK *LINEDDAPROC)(INT,INT,LPARAM);
254 typedef BOOL16  (CALLBACK *PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
255 typedef BOOL    (CALLBACK *PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
256 typedef BOOL    (CALLBACK *PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
257 DECL_WINELIB_TYPE_AW(PROPENUMPROC)
258 typedef BOOL    (CALLBACK *PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
259 typedef BOOL    (CALLBACK *PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
260 DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
261 typedef BOOL    (CALLBACK* TIMEFMT_ENUMPROCA)(LPSTR);
262 typedef BOOL    (CALLBACK* TIMEFMT_ENUMPROCW)(LPWSTR);
263 DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
264 typedef VOID    (CALLBACK *TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
265 typedef VOID    (CALLBACK *TIMERPROC)(HWND,UINT,UINT,DWORD);
266 typedef LRESULT (CALLBACK *WNDENUMPROC16)(HWND16,LPARAM);
267 typedef LRESULT (CALLBACK *WNDENUMPROC)(HWND,LPARAM);
268 typedef LRESULT (CALLBACK *WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
269 typedef LRESULT (CALLBACK *WNDPROC)(HWND,UINT,WPARAM,LPARAM);
270
271 /* TCHAR data types definitions for Winelib. */
272 /* These types are _not_ defined for the emulator, because they */
273 /* depend on the UNICODE macro that only exists in user's code. */
274
275 #ifndef __WINE__
276 # ifdef UNICODE
277 typedef WCHAR TCHAR;
278 typedef LPWSTR LPTSTR;
279 typedef LPCWSTR LPCTSTR;
280 #define __TEXT(string) L##string /*probably wrong */
281 # else  /* UNICODE */
282 typedef CHAR TCHAR;
283 typedef LPSTR LPTSTR;
284 typedef LPCSTR LPCTSTR;
285 #define __TEXT(string) string
286 # endif /* UNICODE */
287 #endif   /* __WINE__ */
288 #define TEXT(quote) __TEXT(quote)
289
290 /* Data types specific to the library. These do _not_ exist in the emulator. */
291
292
293
294 /* Define some empty macros for compatibility with Windows code. */
295
296 #ifndef __WINE__
297 #define NEAR
298 #define FAR
299 #define _far
300 #define _near
301 #define IN
302 #define OUT
303 #define OPTIONAL
304 #endif  /* __WINE__ */
305
306 /* Macro for structure packing. */
307
308 #ifdef __GNUC__
309 #define WINE_PACKED __attribute__ ((packed))
310 #define WINE_UNUSED __attribute__ ((unused))
311 #else
312 #define WINE_PACKED  /* nothing */
313 #define WINE_UNUSED  /* nothing */
314 #endif
315
316 /* Macros to split words and longs. */
317
318 #define LOBYTE(w)              ((BYTE)(WORD)(w))
319 #define HIBYTE(w)              ((BYTE)((WORD)(w) >> 8))
320
321 #define LOWORD(l)              ((WORD)(DWORD)(l))
322 #define HIWORD(l)              ((WORD)((DWORD)(l) >> 16))
323
324 #define SLOWORD(l)             ((INT16)(LONG)(l))
325 #define SHIWORD(l)             ((INT16)((LONG)(l) >> 16))
326
327 #define MAKEWORD(low,high)     ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
328 #define MAKELONG(low,high)     ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
329 #define MAKELPARAM(low,high)   ((LPARAM)MAKELONG(low,high))
330 #define MAKEWPARAM(low,high)   ((WPARAM)MAKELONG(low,high))
331 #define MAKELRESULT(low,high)  ((LRESULT)MAKELONG(low,high))
332 #define MAKEINTATOM(atom)      ((LPCSTR)MAKELONG((atom),0))
333
334 #define SELECTOROF(ptr)     (HIWORD(ptr))
335 #define OFFSETOF(ptr)       (LOWORD(ptr))
336
337 /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
338 /* Note: These macros are semantically broken, at least for wrc.  wrc
339    spits out data in the platform's current binary format, *not* in 
340    little-endian format.  These macros are used throughout the resource
341    code to load and store data to the resources.  Since it is unlikely 
342    that we'll ever be dealing with little-endian resource data, the 
343    byte-swapping nature of these macros has been disabled.  Rather than 
344    remove the use of these macros from the resource loading code, the
345    macros have simply been disabled.  In the future, someone may want 
346    to reactivate these macros for other purposes.  In that case, the
347    resource code will have to be modified to use different macros. */ 
348
349 #if 1
350 #define PUT_WORD(ptr,w)   (*(WORD *)(ptr) = (w))
351 #define GET_WORD(ptr)     (*(WORD *)(ptr))
352 #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
353 #define GET_DWORD(ptr)    (*(DWORD *)(ptr))
354 #else
355 #define PUT_WORD(ptr,w)   (*(BYTE *)(ptr) = LOBYTE(w), \
356                            *((BYTE *)(ptr) + 1) = HIBYTE(w))
357 #define GET_WORD(ptr)     ((WORD)(*(BYTE *)(ptr) | \
358                                   (WORD)(*((BYTE *)(ptr)+1) << 8)))
359 #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
360                            PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
361 #define GET_DWORD(ptr)    ((DWORD)(GET_WORD(ptr) | \
362                                    ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
363 #endif  /* 1 */
364
365 /* MIN and MAX macros */
366
367 #ifdef MAX
368 #undef MAX
369 #endif
370 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
371
372 #ifdef MIN
373 #undef MIN
374 #endif
375 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
376
377 #define __max(a,b) MAX(a,b)
378 #define __min(a,b) MIN(a,b)
379 #define max(a,b)   MAX(a,b)
380 #define min(a,b)   MIN(a,b)
381
382 #define _MAX_PATH  260
383 #define _MAX_DRIVE 3
384 #define _MAX_DIR   256
385 #define _MAX_FNAME 255
386 #define _MAX_EXT   256
387
388 /* Winelib run-time flag */
389
390 #ifdef __WINE__
391 extern int __winelib;
392 #endif  /* __WINE__ */
393
394 /* The SIZE structure */
395
396 typedef struct
397 {
398     INT16  cx;
399     INT16  cy;
400 } SIZE16, *PSIZE16, *LPSIZE16;
401
402 typedef struct tagSIZE
403 {
404     INT  cx;
405     INT  cy;
406 } SIZE, *PSIZE, *LPSIZE;
407
408
409 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
410
411 #define CONV_SIZE16TO32(s16,s32) \
412             ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy)
413 #define CONV_SIZE32TO16(s32,s16) \
414             ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
415
416 /* The POINT structure */
417
418 typedef struct
419 {
420     INT16  x;
421     INT16  y;
422 } POINT16, *PPOINT16, *LPPOINT16;
423
424 typedef struct tagPOINT
425 {
426     LONG  x;
427     LONG  y;
428 } POINT, *PPOINT, *LPPOINT;
429
430
431 #define CONV_POINT16TO32(p16,p32) \
432             ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y)
433 #define CONV_POINT32TO16(p32,p16) \
434             ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
435
436 #define MAKEPOINT16(l) (*((POINT16 *)&(l)))
437
438 /* The POINTS structure */
439
440 typedef struct tagPOINTS
441 {
442         SHORT x;
443         SHORT y;
444 } POINTS, *PPOINTS, *LPPOINTS;
445
446
447 #define MAKEPOINTS(l)  (*((POINTS *)&(l)))
448
449
450 /* The RECT structure */
451
452 typedef struct
453 {
454     INT16  left;
455     INT16  top;
456     INT16  right;
457     INT16  bottom;
458 } RECT16, *LPRECT16;
459
460 typedef struct tagRECT
461 {
462     INT  left;
463     INT  top;
464     INT  right;
465     INT  bottom;
466 } RECT, *PRECT, *LPRECT;
467 typedef const RECT *LPCRECT;
468
469
470 typedef struct tagRECTL
471 {
472     LONG left;
473     LONG top;  
474     LONG right;
475     LONG bottom;
476 } RECTL, *PRECTL, *LPRECTL;
477
478 typedef const RECTL *LPCRECTL;
479
480 #define CONV_RECT16TO32(r16,r32) \
481     ((r32)->left  = (INT)(r16)->left,  (r32)->top    = (INT)(r16)->top, \
482      (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom)
483 #define CONV_RECT32TO16(r32,r16) \
484     ((r16)->left  = (INT16)(r32)->left,  (r16)->top    = (INT16)(r32)->top, \
485      (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom)
486
487 #ifdef __cplusplus
488 }
489 #endif
490
491 #endif /* __WINE_WINTYPES_H */