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