source: trunk/include/win/windef.h@ 21454

Last change on this file since 21454 was 21447, checked in by dmik, 15 years ago

Fixed ntdll build break by gcc4 by fixing DUMMYUNIONNAME/DUMMYSTRUCTNAME macros.

File size: 22.3 KB
Line 
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#if (defined(__WINE__)) && (!defined(__WIN32OS2__))
11# include "config.h"
12# undef UNICODE
13#endif /* __WINE__ */
14
15#define WINVER 0x0500
16
17#ifdef UNICODE
18#include <wchar.h>
19#endif
20
21#include <basetsd.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Misc. constants. */
28
29#ifdef FALSE
30#undef FALSE
31#endif
32#define FALSE 0
33
34#ifdef TRUE
35#undef TRUE
36#endif
37#define TRUE 1
38
39#ifdef NULL
40#undef NULL
41#endif
42#define NULL 0
43
44/* Macros to map Winelib names to the correct implementation name */
45/* depending on __WINE__ and UNICODE macros. */
46/* Note that Winelib is purely Win32. */
47
48#ifdef __WINE__
49#ifdef __WIN32OS2__
50# define WINELIB_NAME_AW(func) func
51#else
52# define WINELIB_NAME_AW(func) this_is_a_syntax_error this_is_a_syntax_error
53#endif
54#else /* __WINE__ */
55# ifdef UNICODE
56# define WINELIB_NAME_AW(func) func##W
57# else
58# define WINELIB_NAME_AW(func) func##A
59# endif /* UNICODE */
60#endif /* __WINE__ */
61
62#ifdef __WINE__
63# define DECL_WINELIB_TYPE_AW(type) /* nothing */
64#else /* __WINE__ */
65# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
66#endif /* __WINE__ */
67
68
69/* Calling conventions definitions */
70
71#ifndef __WIN32OS2__
72#ifdef __i386__
73# if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)
74# define __stdcall __attribute__((__stdcall__))
75# define __cdecl __attribute__((__cdecl__))
76# define __RESTORE_ES __asm__ __volatile__("pushl %ds\n\tpopl %es")
77# else
78# error You need gcc >= 2.7 to build Wine on a 386
79# endif /* __GNUC__ */
80#else /* __i386__ */
81# define __stdcall
82# define __cdecl
83# define __RESTORE_ES
84#endif /* __i386__ */
85#endif
86
87
88#include <odin.h>
89
90/* define needed macros as required */
91#ifndef CALLBACK
92 #define CALLBACK __stdcall
93#endif
94
95#ifndef WINAPI
96 #define WINAPI __stdcall
97#endif
98
99#ifndef APIPRIVATE
100 #define APIPRIVATE __stdcall
101#endif
102
103#ifndef PASCAL
104 #define PASCAL __stdcall
105#endif
106
107#ifndef pascal
108 #define pascal __stdcall
109#endif
110
111#ifndef _pascal
112 #define _pascal __stdcall
113#endif
114
115#ifndef _stdcall
116 #define _stdcall __stdcall
117#endif
118
119#ifndef _fastcall
120 #define _fastcall __stdcall
121#endif
122
123#ifndef __export
124 #define __export
125#endif
126
127#ifndef CDECL
128 #define CDECL __cdecl
129#endif
130
131#ifndef _CDECL
132 #define _CDECL __cdecl
133#endif
134
135#ifndef cdecl
136 #define cdecl __cdecl
137#endif
138
139#ifndef _cdecl
140 #define _cdecl __cdecl
141#endif
142
143#ifndef WINAPIV
144 #define WINAPIV __cdecl
145#endif
146
147#ifndef APIENTRY
148 #define APIENTRY WINAPI
149#endif
150
151#ifndef WIN32API
152 #define WIN32API WINAPI
153#endif
154
155#ifndef __EMX__
156#if (__IBMC__ < 400) && (__IBMCPP__ < 360)
157#ifndef __declspec
158 #define __declspec(x)
159#endif
160
161#ifndef dllimport
162 #define dllimport
163#endif
164
165#ifndef dllexport
166 #define dllexport
167#endif
168#endif // (__IBMC__ < 400) && (__IBMCPP__ < 360)
169#endif // __EMX__
170
171#ifndef CONST
172 #define CONST const
173#endif
174
175/* Anonymous union/struct handling */
176
177#ifndef NONAMELESSSTRUCT
178#define DUMMYSTRUCTNAME
179#define DUMMYSTRUCTNAME1
180#define DUMMYSTRUCTNAME2
181#define DUMMYSTRUCTNAME3
182#define DUMMYSTRUCTNAME4
183#define DUMMYSTRUCTNAME5
184#define DUMMYSTRUCTNAME_DOT
185#define DUMMYSTRUCTNAME1_DOT
186#define DUMMYSTRUCTNAME2_DOT
187#define DUMMYSTRUCTNAME3_DOT
188#define DUMMYSTRUCTNAME4_DOT
189#define DUMMYSTRUCTNAME5_DOT
190#else /* !defined(NONAMELESSSTRUCT) */
191#define DUMMYSTRUCTNAME s
192#define DUMMYSTRUCTNAME1 s1
193#define DUMMYSTRUCTNAME2 s2
194#define DUMMYSTRUCTNAME3 s3
195#define DUMMYSTRUCTNAME4 s4
196#define DUMMYSTRUCTNAME5 s5
197#define DUMMYSTRUCTNAME_DOT s.
198#define DUMMYSTRUCTNAME1_DOT s1.
199#define DUMMYSTRUCTNAME2_DOT s2.
200#define DUMMYSTRUCTNAME3_DOT s3.
201#define DUMMYSTRUCTNAME4_DOT s4.
202#define DUMMYSTRUCTNAME5_DOT s5.
203#endif /* !defined(NONAMELESSSTRUCT) */
204
205#ifndef NONAMELESSUNION
206#define DUMMYUNIONNAME
207#define DUMMYUNIONNAME1
208#define DUMMYUNIONNAME2
209#define DUMMYUNIONNAME3
210#define DUMMYUNIONNAME4
211#define DUMMYUNIONNAME5
212#define DUMMYUNIONNAME6
213#define DUMMYUNIONNAME7
214#define DUMMYUNIONNAME8
215#define DUMMYUNIONNAME_DOT
216#define DUMMYUNIONNAME1_DOT
217#define DUMMYUNIONNAME2_DOT
218#define DUMMYUNIONNAME3_DOT
219#define DUMMYUNIONNAME4_DOT
220#define DUMMYUNIONNAME5_DOT
221#define DUMMYUNIONNAME6_DOT
222#define DUMMYUNIONNAME7_DOT
223#define DUMMYUNIONNAME8_DOT
224#else /* !defined(NONAMELESSUNION) */
225#define DUMMYUNIONNAME u
226#define DUMMYUNIONNAME1 u1
227#define DUMMYUNIONNAME2 u2
228#define DUMMYUNIONNAME3 u3
229#define DUMMYUNIONNAME4 u4
230#define DUMMYUNIONNAME5 u5
231#define DUMMYUNIONNAME6 u6
232#define DUMMYUNIONNAME7 u7
233#define DUMMYUNIONNAME8 u8
234#define DUMMYUNIONNAME_DOT u.
235#define DUMMYUNIONNAME1_DOT u1.
236#define DUMMYUNIONNAME2_DOT u2.
237#define DUMMYUNIONNAME3_DOT u3.
238#define DUMMYUNIONNAME4_DOT u4.
239#define DUMMYUNIONNAME5_DOT u5.
240#define DUMMYUNIONNAME6_DOT u6.
241#define DUMMYUNIONNAME7_DOT u7.
242#define DUMMYUNIONNAME8_DOT u8.
243#endif /* !defined(NONAMELESSUNION) */
244
245
246/* Standard data types. These are the same for emulator and library. */
247
248#if defined(__GNUC__) && defined(__cplusplus)
249/* prototypes like foo(VOID) don't work with typedef */
250#define VOID void
251#else
252typedef void VOID;
253#endif
254typedef int INT;
255typedef unsigned int UINT;
256typedef unsigned short WORD;
257typedef unsigned long DWORD;
258typedef unsigned long ULONG;
259typedef unsigned char BYTE;
260typedef long LONG;
261typedef short SHORT;
262typedef unsigned short USHORT;
263typedef char CHAR;
264typedef unsigned char UCHAR;
265/* Some systems might have wchar_t, but we really need 16 bit characters */
266#ifdef UNICODE
267typedef wchar_t WCHAR;
268#else
269typedef unsigned short WCHAR;
270#endif
271typedef unsigned short BOOL16;
272#ifdef __FORCE_BOOL_AS_INT__
273typedef int BOOL;
274#else
275typedef unsigned long BOOL;
276#endif
277typedef double DATE;
278typedef double DOUBLE;
279#if (__IBMC__ < 360) && (__IBMCPP__ < 360) && !defined (__EMX__)
280typedef double LONGLONG;
281typedef double ULONGLONG;
282typedef double ULONGULONG;
283typedef double DWORDLONG;
284#elif defined (__EMX__)
285#ifndef _INT64_T_DECLARED
286typedef long long int64_t; /* LONGLONG */
287typedef unsigned long long u_int64_t; /* LONGLONG */
288#endif
289#ifndef _UINT64_T_DECLARED
290typedef unsigned long long uint64_t; /* LONGLONG */
291#endif
292typedef int64_t LONGLONG;
293typedef uint64_t ULONGLONG;
294typedef uint64_t ULONGULONG;
295typedef uint64_t DWORDLONG;
296#else
297#include <inttypes.h>
298typedef int64_t LONGLONG;
299typedef uint64_t ULONGLONG;
300typedef uint64_t ULONGULONG;
301typedef uint64_t DWORDLONG;
302#endif
303
304/* FIXME: Wine does not compile with strict on, therefore strict
305 * handles are presently only usable on machines where sizeof(UINT) ==
306 * sizeof(void*). HANDLEs are supposed to be void* but a large amount
307 * of WINE code operates on HANDLES as if they are UINTs. So to WINE
308 * they exist as UINTs but to the Winelib user who turns on strict,
309 * they exist as void*. If there is a size difference between UINT and
310 * void* then things get ugly. */
311#ifdef STRICT
312typedef UINT16 HANDLE16;
313typedef VOID* HANDLE;
314#else
315typedef UINT16 HANDLE16;
316typedef ULONG HANDLE;
317#endif
318
319typedef HANDLE16 *LPHANDLE16;
320typedef HANDLE *LPHANDLE;
321typedef HANDLE GLOBALHANDLE;
322typedef HANDLE LOCALHANDLE;
323
324/* Integer types. These are the same for emulator and library. */
325typedef UINT16 WPARAM16;
326typedef UINT WPARAM;
327typedef LONG LPARAM;
328typedef LONG HRESULT;
329typedef LONG LRESULT;
330typedef WORD ATOM;
331typedef WORD CATCHBUF[9];
332typedef WORD *LPCATCHBUF;
333typedef DWORD REGSAM;
334typedef HANDLE HHOOK;
335typedef HANDLE HKEY;
336typedef HANDLE HMONITOR;
337typedef DWORD LCID;
338typedef WORD LANGID;
339typedef DWORD LCTYPE;
340typedef float FLOAT;
341
342/* Pointers types. These are the same for emulator and library. */
343/* winnt types */
344typedef VOID *PVOID;
345typedef const void *PCVOID;
346typedef CHAR *PCHAR;
347typedef UCHAR *PUCHAR;
348typedef BYTE *PBYTE;
349typedef ULONG *PULONG;
350typedef LONG *PLONG;
351typedef DWORD *PDWORD;
352/* common win32 types */
353#ifdef __WINE__
354typedef CHAR *LPTSTR;
355typedef const CHAR *LPCTSTR;
356#endif
357typedef CHAR *LPSTR;
358typedef CHAR *PSTR;
359typedef const CHAR *LPCSTR;
360typedef const CHAR *PCSTR;
361typedef WCHAR *LPWSTR;
362typedef WCHAR *PWSTR;
363typedef const WCHAR *LPCWSTR;
364typedef const WCHAR *PCWSTR;
365typedef BYTE *LPBYTE;
366typedef WORD *LPWORD;
367typedef DWORD *LPDWORD;
368typedef LONG *LPLONG;
369typedef VOID *LPVOID;
370typedef const VOID *LPCVOID;
371typedef INT16 *LPINT16;
372typedef UINT16 *LPUINT16;
373typedef INT *PINT;
374typedef INT *LPINT;
375typedef UINT *PUINT;
376typedef UINT *LPUINT;
377typedef HKEY *LPHKEY;
378typedef HKEY *PHKEY;
379typedef FLOAT *PFLOAT;
380typedef FLOAT *LPFLOAT;
381typedef BOOL *PBOOL;
382typedef BOOL *LPBOOL;
383
384/* Special case: a segmented pointer is just a pointer in the user's code. */
385
386#ifdef __WINE__
387typedef DWORD SEGPTR;
388#else
389typedef void* SEGPTR;
390#endif /* __WINE__ */
391
392/* Handle types that exist both in Win16 and Win32. */
393
394#ifdef STRICT
395#define DECLARE_HANDLE(a) \
396 typedef HANDLE16 a##16; \
397 typedef a##16 *P##a##16; \
398 typedef a##16 *NP##a##16; \
399 typedef a##16 *LP##a##16; \
400 typedef struct a##__ { int unused; } *a; \
401 typedef a *P##a; \
402 typedef a *LP##a
403#else /*STRICT*/
404#define DECLARE_HANDLE(a) \
405 typedef HANDLE16 a##16; \
406 typedef a##16 *P##a##16; \
407 typedef a##16 *NP##a##16; \
408 typedef a##16 *LP##a##16; \
409 typedef HANDLE a; \
410 typedef a *P##a; \
411 typedef a *LP##a
412#endif /*STRICT*/
413
414DECLARE_HANDLE(HACMDRIVERID);
415DECLARE_HANDLE(HACMDRIVER);
416DECLARE_HANDLE(HACMOBJ);
417DECLARE_HANDLE(HACMSTREAM);
418DECLARE_HANDLE(HMETAFILEPICT);
419
420typedef int HFILE;
421typedef HANDLE16 HFILE16;
422
423DECLARE_HANDLE(HACCEL);
424DECLARE_HANDLE(HBITMAP);
425DECLARE_HANDLE(HBRUSH);
426DECLARE_HANDLE(HCOLORSPACE);
427DECLARE_HANDLE(HCURSOR);
428DECLARE_HANDLE(HDC);
429DECLARE_HANDLE(HGLRC); // OpenGL
430DECLARE_HANDLE(HDROP);
431DECLARE_HANDLE(HDRVR);
432DECLARE_HANDLE(HDWP);
433DECLARE_HANDLE(HENHMETAFILE);
434DECLARE_HANDLE(HFONT);
435DECLARE_HANDLE(HICON);
436DECLARE_HANDLE(HINSTANCE);
437DECLARE_HANDLE(HMENU);
438DECLARE_HANDLE(HMETAFILE);
439DECLARE_HANDLE(HMIDI);
440DECLARE_HANDLE(HMIDIIN);
441DECLARE_HANDLE(HMIDIOUT);
442DECLARE_HANDLE(HMIDISTRM);
443DECLARE_HANDLE(HMIXER);
444DECLARE_HANDLE(HMIXEROBJ);
445DECLARE_HANDLE(HMMIO);
446DECLARE_HANDLE(HPALETTE);
447DECLARE_HANDLE(HPEN);
448DECLARE_HANDLE(HQUEUE);
449DECLARE_HANDLE(HRGN);
450DECLARE_HANDLE(HRSRC);
451DECLARE_HANDLE(HTASK);
452DECLARE_HANDLE(HWAVE);
453DECLARE_HANDLE(HWAVEIN);
454DECLARE_HANDLE(HWAVEOUT);
455DECLARE_HANDLE(HWINSTA);
456DECLARE_HANDLE(HDESK);
457DECLARE_HANDLE(HWND);
458DECLARE_HANDLE(HKL);
459DECLARE_HANDLE(HIC);
460DECLARE_HANDLE(HRASCONN);
461DECLARE_HANDLE(HPRINTER);
462#undef DECLARE_HANDLE
463
464/* Handle types that must remain interchangeable even with strict on */
465
466typedef HINSTANCE16 HMODULE16;
467typedef HINSTANCE HMODULE;
468typedef HANDLE16 HGDIOBJ16;
469typedef HANDLE16 HGLOBAL16;
470typedef HANDLE16 HLOCAL16;
471typedef HANDLE HGDIOBJ;
472typedef HANDLE HGLOBAL;
473typedef HANDLE HLOCAL;
474
475/* Callback function pointers types */
476
477#ifdef __IBMC__
478typedef BOOL16 (* CALLBACK DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
479typedef BOOL (* CALLBACK DLGPROC)(HWND,UINT,WPARAM,LPARAM);
480typedef LRESULT (* CALLBACK DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
481typedef LRESULT (* CALLBACK DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
482typedef INT16 (* CALLBACK EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
483typedef INT (* CALLBACK EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
484typedef INT (* CALLBACK EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
485DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
486typedef LRESULT (* CALLBACK FARPROC16)();
487typedef LRESULT (* CALLBACK FARPROC)();
488typedef INT16 (* CALLBACK PROC16)();
489typedef INT (* CALLBACK PROC)();
490typedef INT16 (* CALLBACK GOBJENUMPROC16)(SEGPTR,LPARAM);
491typedef INT (* CALLBACK GOBJENUMPROC)(LPVOID,LPARAM);
492typedef BOOL16 (* CALLBACK GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
493typedef BOOL (* CALLBACK GRAYSTRINGPROC)(HDC,LPARAM,INT);
494typedef LRESULT (* CALLBACK HOOKPROC16)(INT16,WPARAM16,LPARAM);
495typedef LRESULT (* CALLBACK HOOKPROC)(INT,WPARAM,LPARAM);
496typedef VOID (* CALLBACK LINEDDAPROC16)(INT16,INT16,LPARAM);
497typedef VOID (* CALLBACK LINEDDAPROC)(INT,INT,LPARAM);
498typedef BOOL16 (* CALLBACK PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
499typedef BOOL (* CALLBACK PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
500typedef BOOL (* CALLBACK PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
501DECL_WINELIB_TYPE_AW(PROPENUMPROC)
502typedef BOOL (* CALLBACK PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
503typedef BOOL (* CALLBACK PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
504DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
505typedef VOID (* CALLBACK TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
506typedef VOID (* CALLBACK TIMERPROC)(HWND,UINT,UINT,DWORD);
507typedef LRESULT (* CALLBACK WNDENUMPROC16)(HWND16,LPARAM);
508//typedef LRESULT (* CALLBACK WNDENUMPROC)(HWND,LPARAM);
509typedef BOOL (* CALLBACK WNDENUMPROC)(HWND,LPARAM);
510typedef LRESULT (* CALLBACK WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
511typedef LRESULT (* CALLBACK WNDPROC)(HWND,UINT,WPARAM,LPARAM);
512#else
513typedef BOOL16 ( CALLBACK * DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
514typedef BOOL ( CALLBACK * DLGPROC)(HWND,UINT,WPARAM,LPARAM);
515typedef LRESULT ( CALLBACK * DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
516typedef LRESULT ( CALLBACK * DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
517typedef INT16 ( CALLBACK * EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
518typedef INT ( CALLBACK * EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
519typedef INT ( CALLBACK * EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
520DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
521typedef LRESULT ( CALLBACK * FARPROC16)();
522typedef LRESULT ( CALLBACK * FARPROC)();
523typedef INT16 ( CALLBACK * PROC16)();
524typedef INT ( CALLBACK * PROC)();
525typedef INT16 ( CALLBACK * GOBJENUMPROC16)(SEGPTR,LPARAM);
526typedef INT ( CALLBACK * GOBJENUMPROC)(LPVOID,LPARAM);
527typedef BOOL16 ( CALLBACK * GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
528typedef BOOL ( CALLBACK * GRAYSTRINGPROC)(HDC,LPARAM,INT);
529typedef LRESULT ( CALLBACK * HOOKPROC16)(INT16,WPARAM16,LPARAM);
530typedef LRESULT ( CALLBACK * HOOKPROC)(INT,WPARAM,LPARAM);
531typedef VOID ( CALLBACK * LINEDDAPROC16)(INT16,INT16,LPARAM);
532typedef VOID ( CALLBACK * LINEDDAPROC)(INT,INT,LPARAM);
533typedef BOOL16 ( CALLBACK * PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
534typedef BOOL ( CALLBACK * PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
535typedef BOOL ( CALLBACK * PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
536DECL_WINELIB_TYPE_AW(PROPENUMPROC)
537typedef BOOL ( CALLBACK * PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
538typedef BOOL ( CALLBACK * PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
539DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
540typedef VOID ( CALLBACK * TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
541typedef VOID ( CALLBACK * TIMERPROC)(HWND,UINT,UINT,DWORD);
542typedef LRESULT ( CALLBACK * WNDENUMPROC16)(HWND16,LPARAM);
543typedef BOOL ( CALLBACK * WNDENUMPROC)(HWND,LPARAM);
544typedef LRESULT ( CALLBACK * WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
545typedef LRESULT ( CALLBACK * WNDPROC)(HWND,UINT,WPARAM,LPARAM);
546#endif
547
548/* TCHAR data types definitions for Winelib. */
549/* These types are _not_ defined for the emulator, because they */
550/* depend on the UNICODE macro that only exists in user's code. */
551
552#ifndef __WINE__
553# ifdef UNICODE
554typedef WCHAR TCHAR;
555typedef LPWSTR LPTSTR;
556typedef LPCWSTR LPCTSTR;
557#define __TEXT(string) L##string /*probably wrong */
558# else /* UNICODE */
559typedef CHAR TCHAR, *PTCHAR;
560typedef LPSTR LPTSTR;
561typedef LPCSTR LPCTSTR;
562#define __TEXT(string) string
563# endif /* UNICODE */
564#endif /* __WINE__ */
565#define TEXT(quote) __TEXT(quote)
566
567/* Data types specific to the library. These do _not_ exist in the emulator. */
568
569
570
571/* Define some empty macros for compatibility with Windows code. */
572
573#ifndef __WINE__
574#define NEAR
575#define FAR
576#define near
577#define far
578#define _near
579#define _far
580#define IN
581#define OUT
582#define OPTIONAL
583#endif /* __WINE__ */
584
585/* Macro for structure packing. */
586
587#ifdef __GNUC__
588#define WINE_PACKED __attribute__ ((packed))
589#define WINE_UNUSED __attribute__ ((unused))
590#else
591#define WINE_PACKED /* nothing */
592#define WINE_UNUSED /* nothing */
593#endif
594
595/* Macros to split words and longs. */
596
597#define LOBYTE(w) ((BYTE)(WORD)(w))
598#define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
599
600#define LOWORD(l) ((WORD)(DWORD)(l))
601#define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
602
603#define SLOWORD(l) ((INT16)(LONG)(l))
604#define SHIWORD(l) ((INT16)((LONG)(l) >> 16))
605
606#define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
607#define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
608#define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
609#define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
610#define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
611#define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
612
613#define SELECTOROF(ptr) (HIWORD(ptr))
614#define OFFSETOF(ptr) (LOWORD(ptr))
615
616/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
617/* Note: These macros are semantically broken, at least for wrc. wrc
618 spits out data in the platform's current binary format, *not* in
619 little-endian format. These macros are used throughout the resource
620 code to load and store data to the resources. Since it is unlikely
621 that we'll ever be dealing with little-endian resource data, the
622 byte-swapping nature of these macros has been disabled. Rather than
623 remove the use of these macros from the resource loading code, the
624 macros have simply been disabled. In the future, someone may want
625 to reactivate these macros for other purposes. In that case, the
626 resource code will have to be modified to use different macros. */
627
628#if 1
629#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
630#define GET_WORD(ptr) (*(WORD *)(ptr))
631#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
632#define GET_DWORD(ptr) (*(DWORD *)(ptr))
633#else
634#define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
635 *((BYTE *)(ptr) + 1) = HIBYTE(w))
636#define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
637 (WORD)(*((BYTE *)(ptr)+1) << 8)))
638#define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
639 PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
640#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
641 ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
642#endif /* 1 */
643
644/* MIN and MAX macros */
645
646#ifdef MAX
647#undef MAX
648#endif
649#define MAX(a,b) (((a) > (b)) ? (a) : (b))
650
651#ifdef MIN
652#undef MIN
653#endif
654#define MIN(a,b) (((a) < (b)) ? (a) : (b))
655
656#ifdef __max /* watcom stdlib.h defines this */
657#undef __max
658#endif
659#define __max(a,b) MAX(a,b)
660
661#ifdef __min /* watcom stdlib.h defines this */
662#undef __min
663#endif
664#define __min(a,b) MIN(a,b)
665#ifndef RC_INVOKED
666#include <stdlib.h>
667#endif
668
669#if !defined(__WATCOMC__) || !defined(_MAX_PATH)
670#define _MAX_PATH 260
671#endif
672#define MAX_PATH 260
673#define _MAX_DRIVE 3
674#if !defined(__WATCOMC__) && !defined(_MAX_DIR)
675#define _MAX_DIR 256
676#endif
677#if !defined(__WIN32OS2__) && !defined(_MAX_FNAME)
678#define _MAX_FNAME 255
679#endif
680#if !defined(__WATCOMC__) && !defined(_MAX_EXT)
681#define _MAX_EXT 256
682#endif
683
684#define HFILE_ERROR16 ((HFILE16)-1)
685#define HFILE_ERROR ((HFILE)-1)
686
687/* Winelib run-time flag */
688
689#ifdef __WINE__
690extern int __winelib;
691#endif /* __WINE__ */
692
693/* The SIZE structure */
694
695typedef struct
696{
697 INT16 cx;
698 INT16 cy;
699} SIZE16, *PSIZE16, *LPSIZE16;
700
701typedef struct tagSIZE
702{
703 INT cx;
704 INT cy;
705} SIZE, *PSIZE, *LPSIZE;
706
707
708typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
709
710#define CONV_SIZE16TO32(s16,s32) \
711 ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy)
712#define CONV_SIZE32TO16(s32,s16) \
713 ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
714
715/* The POINT structure */
716
717typedef struct
718{
719 INT16 x;
720 INT16 y;
721} POINT16, *PPOINT16, *LPPOINT16;
722
723typedef struct tagPOINT
724{
725 LONG x;
726 LONG y;
727} POINT, *PPOINT, *LPPOINT;
728
729typedef struct _POINTL
730{
731 LONG x;
732 LONG y;
733} POINTL;
734
735#define CONV_POINT16TO32(p16,p32) \
736 ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y)
737#define CONV_POINT32TO16(p32,p16) \
738 ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
739
740#define MAKEPOINT(l) (*((POINT *)&(l)))
741
742#define MAKEPOINT16(l) (*((POINT16 *)&(l)))
743
744/* The POINTS structure */
745
746typedef struct tagPOINTS
747{
748 SHORT x;
749 SHORT y;
750} POINTS, *PPOINTS, *LPPOINTS;
751
752
753#define MAKEPOINTS(l) (*((POINTS *)&(l)))
754
755
756/* The RECT structure */
757
758typedef struct
759{
760 INT16 left;
761 INT16 top;
762 INT16 right;
763 INT16 bottom;
764} RECT16, *LPRECT16;
765
766typedef struct tagRECT
767{
768 INT left;
769 INT top;
770 INT right;
771 INT bottom;
772} RECT, *PRECT, *LPRECT;
773typedef const RECT *LPCRECT;
774
775
776typedef struct tagRECTL
777{
778 LONG left;
779 LONG top;
780 LONG right;
781 LONG bottom;
782} RECTL, *PRECTL, *LPRECTL;
783
784typedef const RECTL *LPCRECTL;
785
786/*
787 * 8.9.99 DJR DECIMAL support
788 */
789typedef struct tagDEC
790{
791 USHORT wReserved;
792 union
793 {
794 struct
795 {
796 BYTE scale;
797 BYTE sign;
798 } a;
799 USHORT signscale;
800 } b;
801 ULONG Hi32;
802 union
803 {
804 struct
805 {
806 ULONG Lo32;
807 ULONG Mid32;
808 } c;
809 ULONGLONG Lo64;
810 } d;
811} DECIMAL;
812typedef DECIMAL *LPDECIMAL;
813
814#include <winbase.h>
815
816#ifdef __cplusplus
817}
818#endif
819
820#endif /* __WINE_WINDEF_H */
Note: See TracBrowser for help on using the repository browser.