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