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

Last change on this file since 689 was 680, checked in by sandervl, 26 years ago

Makefile changes for VAC 3.6.5 & headers changes

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