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

Last change on this file since 375 was 374, checked in by sandervl, 26 years ago

VAC 3.6.5 changes

File size: 16.4 KB
Line 
1/* $Id: windef.h,v 1.4 1999-07-23 17:51:39 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) this_is_a_syntax_error this_is_a_syntax_error
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__ != 430 && __IBMCPP__ != 360
226typedef double __int64;
227#endif
228#else
229#else
230typedef long long __int64;
231#endif
232
233/* Pointers types. These are the same for emulator and library. */
234/* winnt types */
235typedef VOID *PVOID;
236typedef const void *PCVOID;
237typedef CHAR *PCHAR;
238typedef UCHAR *PUCHAR;
239typedef BYTE *PBYTE;
240typedef ULONG *PULONG;
241typedef LONG *PLONG;
242typedef DWORD *PDWORD;
243/* common win32 types */
244typedef CHAR *LPSTR;
245typedef CHAR *LPTSTR;
246typedef CHAR *PSTR;
247typedef const CHAR *LPCSTR;
248typedef const CHAR *LPCTSTR;
249typedef const CHAR *PCSTR;
250typedef WCHAR *LPWSTR;
251typedef WCHAR *PWSTR;
252typedef const WCHAR *LPCWSTR;
253typedef const WCHAR *PCWSTR;
254typedef BYTE *LPBYTE;
255typedef WORD *LPWORD;
256typedef DWORD *LPDWORD;
257typedef LONG *LPLONG;
258typedef VOID *LPVOID;
259typedef const VOID *LPCVOID;
260typedef INT16 *LPINT16;
261typedef UINT16 *LPUINT16;
262typedef INT *PINT;
263typedef INT *LPINT;
264typedef UINT *PUINT;
265typedef UINT *LPUINT;
266typedef HKEY *LPHKEY;
267typedef HKEY *PHKEY;
268typedef FLOAT *PFLOAT;
269typedef FLOAT *LPFLOAT;
270typedef BOOL *PBOOL;
271typedef BOOL *LPBOOL;
272
273/* Special case: a segmented pointer is just a pointer in the user's code. */
274
275#ifdef __WINE__
276typedef DWORD SEGPTR;
277#else
278typedef void* SEGPTR;
279#endif /* __WINE__ */
280
281/* Handle types that exist both in Win16 and Win32. */
282
283#ifdef STRICT
284#define DECLARE_HANDLE(a) \
285 typedef HANDLE16 a##16; \
286 typedef a##16 *P##a##16; \
287 typedef a##16 *NP##a##16; \
288 typedef a##16 *LP##a##16; \
289 typedef struct a##__ { int unused; } *a; \
290 typedef a *P##a; \
291 typedef a *LP##a
292#else /*STRICT*/
293#define DECLARE_HANDLE(a) \
294 typedef HANDLE16 a##16; \
295 typedef a##16 *P##a##16; \
296 typedef a##16 *NP##a##16; \
297 typedef a##16 *LP##a##16; \
298 typedef HANDLE a; \
299 typedef a *P##a; \
300 typedef a *LP##a
301#endif /*STRICT*/
302
303DECLARE_HANDLE(HACMDRIVERID);
304DECLARE_HANDLE(HACMDRIVER);
305DECLARE_HANDLE(HACMOBJ);
306DECLARE_HANDLE(HACMSTREAM);
307DECLARE_HANDLE(HMETAFILEPICT);
308
309DECLARE_HANDLE(HACCEL);
310DECLARE_HANDLE(HBITMAP);
311DECLARE_HANDLE(HBRUSH);
312DECLARE_HANDLE(HCOLORSPACE);
313DECLARE_HANDLE(HCURSOR);
314DECLARE_HANDLE(HDC);
315DECLARE_HANDLE(HDROP);
316DECLARE_HANDLE(HDRVR);
317DECLARE_HANDLE(HDWP);
318DECLARE_HANDLE(HENHMETAFILE);
319DECLARE_HANDLE(HFILE);
320DECLARE_HANDLE(HFONT);
321DECLARE_HANDLE(HICON);
322DECLARE_HANDLE(HINSTANCE);
323DECLARE_HANDLE(HMENU);
324DECLARE_HANDLE(HMETAFILE);
325DECLARE_HANDLE(HMIDI);
326DECLARE_HANDLE(HMIDIIN);
327DECLARE_HANDLE(HMIDIOUT);
328DECLARE_HANDLE(HMIDISTRM);
329DECLARE_HANDLE(HMIXER);
330DECLARE_HANDLE(HMIXEROBJ);
331DECLARE_HANDLE(HMMIO);
332DECLARE_HANDLE(HPALETTE);
333DECLARE_HANDLE(HPEN);
334DECLARE_HANDLE(HQUEUE);
335DECLARE_HANDLE(HRGN);
336DECLARE_HANDLE(HRSRC);
337DECLARE_HANDLE(HTASK);
338DECLARE_HANDLE(HWAVE);
339DECLARE_HANDLE(HWAVEIN);
340DECLARE_HANDLE(HWAVEOUT);
341DECLARE_HANDLE(HWINSTA);
342DECLARE_HANDLE(HDESK);
343DECLARE_HANDLE(HWND);
344DECLARE_HANDLE(HKL);
345DECLARE_HANDLE(HIC);
346DECLARE_HANDLE(HRASCONN);
347DECLARE_HANDLE(HPRINTER);
348#undef DECLARE_HANDLE
349
350/* Handle types that must remain interchangeable even with strict on */
351
352typedef HINSTANCE16 HMODULE16;
353typedef HINSTANCE HMODULE;
354typedef HANDLE16 HGDIOBJ16;
355typedef HANDLE16 HGLOBAL16;
356typedef HANDLE16 HLOCAL16;
357typedef HANDLE HGDIOBJ;
358typedef HANDLE HGLOBAL;
359typedef HANDLE HLOCAL;
360
361/* Callback function pointers types */
362
363typedef BOOL (* CALLBACK DATEFMT_ENUMPROCA)(LPSTR);
364typedef BOOL (* CALLBACK DATEFMT_ENUMPROCW)(LPWSTR);
365DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
366typedef BOOL16 (* CALLBACK DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
367typedef BOOL (* CALLBACK DLGPROC)(HWND,UINT,WPARAM,LPARAM);
368typedef LRESULT (* CALLBACK DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
369typedef LRESULT (* CALLBACK DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
370typedef INT16 (* CALLBACK EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
371typedef INT (* CALLBACK EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
372typedef INT (* CALLBACK EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
373DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
374typedef LRESULT (* CALLBACK FARPROC16)();
375typedef LRESULT (* CALLBACK FARPROC)();
376typedef INT16 (* CALLBACK PROC16)();
377typedef INT (* CALLBACK PROC)();
378typedef INT16 (* CALLBACK GOBJENUMPROC16)(SEGPTR,LPARAM);
379typedef INT (* CALLBACK GOBJENUMPROC)(LPVOID,LPARAM);
380typedef BOOL16 (* CALLBACK GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
381typedef BOOL (* CALLBACK GRAYSTRINGPROC)(HDC,LPARAM,INT);
382typedef LRESULT (* CALLBACK HOOKPROC16)(INT16,WPARAM16,LPARAM);
383typedef LRESULT (* CALLBACK HOOKPROC)(INT,WPARAM,LPARAM);
384typedef VOID (* CALLBACK LINEDDAPROC16)(INT16,INT16,LPARAM);
385typedef VOID (* CALLBACK LINEDDAPROC)(INT,INT,LPARAM);
386typedef BOOL16 (* CALLBACK PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
387typedef BOOL (* CALLBACK PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
388typedef BOOL (* CALLBACK PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
389DECL_WINELIB_TYPE_AW(PROPENUMPROC)
390typedef BOOL (* CALLBACK PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
391typedef BOOL (* CALLBACK PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
392DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
393typedef BOOL (* CALLBACK TIMEFMT_ENUMPROCA)(LPSTR);
394typedef BOOL (* CALLBACK TIMEFMT_ENUMPROCW)(LPWSTR);
395DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
396typedef VOID (* CALLBACK TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
397typedef VOID (* CALLBACK TIMERPROC)(HWND,UINT,UINT,DWORD);
398typedef LRESULT (* CALLBACK WNDENUMPROC16)(HWND16,LPARAM);
399typedef LRESULT (* CALLBACK WNDENUMPROC)(HWND,LPARAM);
400typedef LRESULT (* CALLBACK WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
401typedef LRESULT (* CALLBACK WNDPROC)(HWND,UINT,WPARAM,LPARAM);
402
403/* TCHAR data types definitions for Winelib. */
404/* These types are _not_ defined for the emulator, because they */
405/* depend on the UNICODE macro that only exists in user's code. */
406
407#ifndef __WINE__
408# ifdef UNICODE
409typedef WCHAR TCHAR;
410typedef LPWSTR LPTSTR;
411typedef LPCWSTR LPCTSTR;
412#define __TEXT(string) L##string /*probably wrong */
413# else /* UNICODE */
414typedef CHAR TCHAR;
415typedef LPSTR LPTSTR;
416typedef LPCSTR LPCTSTR;
417#define __TEXT(string) string
418# endif /* UNICODE */
419#endif /* __WINE__ */
420#define TEXT(quote) __TEXT(quote)
421
422/* Data types specific to the library. These do _not_ exist in the emulator. */
423
424
425
426/* Define some empty macros for compatibility with Windows code. */
427
428#ifndef __WINE__
429#define NEAR
430#define FAR
431#define near
432#define far
433#define _near
434#define _far
435#define IN
436#define OUT
437#define OPTIONAL
438#endif /* __WINE__ */
439
440/* Macro for structure packing. */
441
442#ifdef __GNUC__
443#define WINE_PACKED __attribute__ ((packed))
444#define WINE_UNUSED __attribute__ ((unused))
445#else
446#define WINE_PACKED /* nothing */
447#define WINE_UNUSED /* nothing */
448#endif
449
450/* Macros to split words and longs. */
451
452#define LOBYTE(w) ((BYTE)(WORD)(w))
453#define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
454
455#define LOWORD(l) ((WORD)(DWORD)(l))
456#define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
457
458#define SLOWORD(l) ((INT16)(LONG)(l))
459#define SHIWORD(l) ((INT16)((LONG)(l) >> 16))
460
461#define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
462#define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
463#define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
464#define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
465#define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
466#define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
467
468#define SELECTOROF(ptr) (HIWORD(ptr))
469#define OFFSETOF(ptr) (LOWORD(ptr))
470
471/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
472/* Note: These macros are semantically broken, at least for wrc. wrc
473 spits out data in the platform's current binary format, *not* in
474 little-endian format. These macros are used throughout the resource
475 code to load and store data to the resources. Since it is unlikely
476 that we'll ever be dealing with little-endian resource data, the
477 byte-swapping nature of these macros has been disabled. Rather than
478 remove the use of these macros from the resource loading code, the
479 macros have simply been disabled. In the future, someone may want
480 to reactivate these macros for other purposes. In that case, the
481 resource code will have to be modified to use different macros. */
482
483#if 1
484#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
485#define GET_WORD(ptr) (*(WORD *)(ptr))
486#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
487#define GET_DWORD(ptr) (*(DWORD *)(ptr))
488#else
489#define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
490 *((BYTE *)(ptr) + 1) = HIBYTE(w))
491#define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
492 (WORD)(*((BYTE *)(ptr)+1) << 8)))
493#define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
494 PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
495#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
496 ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
497#endif /* 1 */
498
499/* MIN and MAX macros */
500
501#ifdef MAX
502#undef MAX
503#endif
504#define MAX(a,b) (((a) > (b)) ? (a) : (b))
505
506#ifdef MIN
507#undef MIN
508#endif
509#define MIN(a,b) (((a) < (b)) ? (a) : (b))
510
511#define __max(a,b) MAX(a,b)
512#define __min(a,b) MIN(a,b)
513#ifndef max
514#define max(a,b) MAX(a,b)
515#endif
516
517#ifndef min
518#define min(a,b) MIN(a,b)
519#endif
520
521#define _MAX_PATH 260
522#define MAX_PATH 260
523#define _MAX_DRIVE 3
524#define _MAX_DIR 256
525#ifndef __WIN32OS2__
526#define _MAX_FNAME 255
527#endif
528#define _MAX_EXT 256
529
530#define HFILE_ERROR16 ((HFILE16)-1)
531#define HFILE_ERROR ((HFILE)-1)
532
533/* Winelib run-time flag */
534
535#ifdef __WINE__
536extern int __winelib;
537#endif /* __WINE__ */
538
539/* The SIZE structure */
540
541typedef struct
542{
543 INT16 cx;
544 INT16 cy;
545} SIZE16, *PSIZE16, *LPSIZE16;
546
547typedef struct tagSIZE
548{
549 INT cx;
550 INT cy;
551} SIZE, *PSIZE, *LPSIZE;
552
553
554typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
555
556#define CONV_SIZE16TO32(s16,s32) \
557 ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy)
558#define CONV_SIZE32TO16(s32,s16) \
559 ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
560
561/* The POINT structure */
562
563typedef struct
564{
565 INT16 x;
566 INT16 y;
567} POINT16, *PPOINT16, *LPPOINT16;
568
569typedef struct tagPOINT
570{
571 LONG x;
572 LONG y;
573} POINT, *PPOINT, *LPPOINT;
574
575typedef struct _POINTL
576{
577 LONG x;
578 LONG y;
579} POINTL;
580
581#define CONV_POINT16TO32(p16,p32) \
582 ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y)
583#define CONV_POINT32TO16(p32,p16) \
584 ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
585
586#define MAKEPOINT16(l) (*((POINT16 *)&(l)))
587
588/* The POINTS structure */
589
590typedef struct tagPOINTS
591{
592 SHORT x;
593 SHORT y;
594} POINTS, *PPOINTS, *LPPOINTS;
595
596
597#define MAKEPOINTS(l) (*((POINTS *)&(l)))
598
599
600/* The RECT structure */
601
602typedef struct
603{
604 INT16 left;
605 INT16 top;
606 INT16 right;
607 INT16 bottom;
608} RECT16, *LPRECT16;
609
610typedef struct tagRECT
611{
612 INT left;
613 INT top;
614 INT right;
615 INT bottom;
616} RECT, *PRECT, *LPRECT;
617typedef const RECT *LPCRECT;
618
619
620typedef struct tagRECTL
621{
622 LONG left;
623 LONG top;
624 LONG right;
625 LONG bottom;
626} RECTL, *PRECTL, *LPRECTL;
627
628typedef const RECTL *LPCRECTL;
629
630#define CONV_RECT16TO32(r16,r32) \
631 ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \
632 (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom)
633#define CONV_RECT32TO16(r32,r16) \
634 ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \
635 (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom)
636
637#ifdef __cplusplus
638}
639#endif
640
641#endif /* __WINE_WINDEF_H */
Note: See TracBrowser for help on using the repository browser.