2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
7 #ifndef __WINE_WINDEF_H
8 #define __WINE_WINDEF_H
24 /* Macros to map Winelib names to the correct implementation name */
25 /* depending on __WINE__ and UNICODE macros. */
26 /* Note that Winelib is purely Win32. */
29 # define WINELIB_NAME_AW(func) \
30 func##_must_be_suffixed_with_W_or_A_in_this_context \
31 func##_must_be_suffixed_with_W_or_A_in_this_context
34 # define WINELIB_NAME_AW(func) func##W
36 # define WINELIB_NAME_AW(func) func##A
41 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
43 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
47 /* Integer types. These are the same for emulator and library. */
52 typedef WORD CATCHBUF[9];
53 typedef WORD *LPCATCHBUF;
55 typedef HANDLE HMONITOR;
57 /* Handle types that exist both in Win16 and Win32. */
59 DECLARE_OLD_HANDLE(HACMDRIVERID);
60 DECLARE_OLD_HANDLE(HACMDRIVER);
61 DECLARE_OLD_HANDLE(HACMOBJ);
62 DECLARE_OLD_HANDLE(HACMSTREAM);
64 DECLARE_OLD_HANDLE(HACCEL);
65 DECLARE_OLD_HANDLE(HBITMAP);
66 DECLARE_OLD_HANDLE(HBRUSH);
67 DECLARE_HANDLE(HCOLORSPACE);
68 DECLARE_OLD_HANDLE(HDC);
69 DECLARE_OLD_HANDLE(HDRVR);
70 DECLARE_OLD_HANDLE(HENHMETAFILE);
72 DECLARE_OLD_HANDLE(HFONT);
73 DECLARE_OLD_HANDLE(HICON);
74 DECLARE_OLD_HANDLE(HINSTANCE);
75 DECLARE_OLD_HANDLE(HKEY);
76 DECLARE_OLD_HANDLE(HMENU);
77 DECLARE_OLD_HANDLE(HMETAFILE);
78 DECLARE_OLD_HANDLE(HMIDI);
79 DECLARE_OLD_HANDLE(HMIDIIN);
80 DECLARE_OLD_HANDLE(HMIDIOUT);
81 DECLARE_OLD_HANDLE(HMIDISTRM);
82 DECLARE_OLD_HANDLE(HMIXER);
83 DECLARE_OLD_HANDLE(HMIXEROBJ);
84 DECLARE_OLD_HANDLE(HMMIO);
85 DECLARE_OLD_HANDLE(HPALETTE);
86 DECLARE_OLD_HANDLE(HPEN);
87 DECLARE_OLD_HANDLE(HRGN);
88 DECLARE_OLD_HANDLE(HRSRC);
89 DECLARE_OLD_HANDLE(HTASK);
90 DECLARE_OLD_HANDLE(HWAVE);
91 DECLARE_OLD_HANDLE(HWAVEIN);
92 DECLARE_OLD_HANDLE(HWAVEOUT);
93 DECLARE_HANDLE(HWINSTA);
94 DECLARE_HANDLE(HDESK);
95 DECLARE_OLD_HANDLE(HWND);
96 DECLARE_OLD_HANDLE(HKL);
98 /* Handle types that must remain interchangeable even with strict on */
100 typedef HINSTANCE HMODULE;
101 typedef HANDLE HGDIOBJ;
102 typedef HANDLE HGLOBAL;
103 typedef HANDLE HLOCAL;
104 typedef HANDLE GLOBALHANDLE;
105 typedef HANDLE LOCALHANDLE;
106 typedef HICON HCURSOR;
108 /* Callback function pointers types */
110 typedef INT CALLBACK (*FARPROC)();
111 typedef INT CALLBACK (*PROC)();
114 /* Macros to split words and longs. */
116 #define LOBYTE(w) ((BYTE)(WORD)(w))
117 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
119 #define LOWORD(l) ((WORD)(DWORD)(l))
120 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
122 #define SLOWORD(l) ((SHORT)(LONG)(l))
123 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
125 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
126 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
127 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
128 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
129 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
130 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
132 #define SELECTOROF(ptr) (HIWORD(ptr))
133 #define OFFSETOF(ptr) (LOWORD(ptr))
136 /* macros to set parts of a DWORD (not in the Windows API) */
137 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
138 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
139 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
140 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
144 /* min and max macros */
145 #define __max(a,b) (((a) > (b)) ? (a) : (b))
146 #define __min(a,b) (((a) < (b)) ? (a) : (b))
148 #define max(a,b) (((a) > (b)) ? (a) : (b))
151 #define min(a,b) (((a) < (b)) ? (a) : (b))
154 #define _MAX_PATH 260
158 #define _MAX_FNAME 255
161 #define HFILE_ERROR ((HFILE)-1)
163 /* The SIZE structure */
164 typedef struct tagSIZE
168 } SIZE, *PSIZE, *LPSIZE;
170 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
172 /* The POINT structure */
173 typedef struct tagPOINT
177 } POINT, *PPOINT, *LPPOINT;
179 typedef struct _POINTL
185 /* The POINTS structure */
187 typedef struct tagPOINTS
191 } POINTS, *PPOINTS, *LPPOINTS;
193 /* The RECT structure */
194 typedef struct tagRECT
200 } RECT, *PRECT, *LPRECT;
201 typedef const RECT *LPCRECT;
204 typedef struct tagRECTL
210 } RECTL, *PRECTL, *LPRECTL;
212 typedef const RECTL *LPCRECTL;
218 #endif /* __WINE_WINDEF_H */