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(HDWP);
71 DECLARE_OLD_HANDLE(HENHMETAFILE);
73 DECLARE_OLD_HANDLE(HFONT);
74 DECLARE_OLD_HANDLE(HICON);
75 DECLARE_OLD_HANDLE(HINSTANCE);
76 DECLARE_OLD_HANDLE(HKEY);
77 DECLARE_OLD_HANDLE(HMENU);
78 DECLARE_OLD_HANDLE(HMETAFILE);
79 DECLARE_OLD_HANDLE(HMIDI);
80 DECLARE_OLD_HANDLE(HMIDIIN);
81 DECLARE_OLD_HANDLE(HMIDIOUT);
82 DECLARE_OLD_HANDLE(HMIDISTRM);
83 DECLARE_OLD_HANDLE(HMIXER);
84 DECLARE_OLD_HANDLE(HMIXEROBJ);
85 DECLARE_OLD_HANDLE(HMMIO);
86 DECLARE_OLD_HANDLE(HPALETTE);
87 DECLARE_OLD_HANDLE(HPEN);
88 DECLARE_OLD_HANDLE(HRGN);
89 DECLARE_OLD_HANDLE(HRSRC);
90 DECLARE_OLD_HANDLE(HTASK);
91 DECLARE_OLD_HANDLE(HWAVE);
92 DECLARE_OLD_HANDLE(HWAVEIN);
93 DECLARE_OLD_HANDLE(HWAVEOUT);
94 DECLARE_OLD_HANDLE(HWINSTA);
95 DECLARE_HANDLE(HDESK);
96 DECLARE_OLD_HANDLE(HWND);
97 DECLARE_OLD_HANDLE(HKL);
99 /* Handle types that must remain interchangeable even with strict on */
101 typedef HINSTANCE HMODULE;
102 typedef HANDLE HGDIOBJ;
103 typedef HANDLE HGLOBAL;
104 typedef HANDLE HLOCAL;
105 typedef HANDLE GLOBALHANDLE;
106 typedef HANDLE LOCALHANDLE;
107 typedef HICON HCURSOR;
109 /* Callback function pointers types */
111 typedef INT CALLBACK (*FARPROC)();
112 typedef INT CALLBACK (*PROC)();
115 /* Macros to split words and longs. */
117 #define LOBYTE(w) ((BYTE)(WORD)(w))
118 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
120 #define LOWORD(l) ((WORD)(DWORD)(l))
121 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
123 #define SLOWORD(l) ((SHORT)(LONG)(l))
124 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
126 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
127 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
128 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
129 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
130 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
131 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
133 #define SELECTOROF(ptr) (HIWORD(ptr))
134 #define OFFSETOF(ptr) (LOWORD(ptr))
137 /* macros to set parts of a DWORD (not in the Windows API) */
138 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
139 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
140 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
141 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
145 /* min and max macros */
146 #define __max(a,b) (((a) > (b)) ? (a) : (b))
147 #define __min(a,b) (((a) < (b)) ? (a) : (b))
149 #define max(a,b) (((a) > (b)) ? (a) : (b))
152 #define min(a,b) (((a) < (b)) ? (a) : (b))
155 #define _MAX_PATH 260
159 #define _MAX_FNAME 255
162 #define HFILE_ERROR ((HFILE)-1)
164 /* The SIZE structure */
165 typedef struct tagSIZE
169 } SIZE, *PSIZE, *LPSIZE;
171 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
173 /* The POINT structure */
174 typedef struct tagPOINT
178 } POINT, *PPOINT, *LPPOINT;
180 typedef struct _POINTL
186 /* The POINTS structure */
188 typedef struct tagPOINTS
192 } POINTS, *PPOINTS, *LPPOINTS;
194 /* The RECT structure */
195 typedef struct tagRECT
201 } RECT, *PRECT, *LPRECT;
202 typedef const RECT *LPCRECT;
205 typedef struct tagRECTL
211 } RECTL, *PRECTL, *LPRECTL;
213 typedef const RECTL *LPCRECTL;
219 #endif /* __WINE_WINDEF_H */