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;
52 typedef WORD CATCHBUF[9];
53 typedef WORD *LPCATCHBUF;
54 typedef DWORD COLORREF, *LPCOLORREF;
57 /* Handle types that exist both in Win16 and Win32. */
60 DECLARE_OLD_HANDLE(HACCEL);
61 DECLARE_OLD_HANDLE(HBITMAP);
62 DECLARE_OLD_HANDLE(HBRUSH);
63 DECLARE_HANDLE(HCOLORSPACE);
64 DECLARE_OLD_HANDLE(HDC);
65 DECLARE_HANDLE(HDESK);
66 DECLARE_OLD_HANDLE(HENHMETAFILE);
67 DECLARE_OLD_HANDLE(HFONT);
68 DECLARE_OLD_HANDLE(HHOOK);
69 DECLARE_OLD_HANDLE(HICON);
70 DECLARE_OLD_HANDLE(HINSTANCE);
71 DECLARE_OLD_HANDLE(HKEY);
72 DECLARE_OLD_HANDLE(HKL);
73 DECLARE_OLD_HANDLE(HMENU);
74 DECLARE_OLD_HANDLE(HMETAFILE);
75 DECLARE_OLD_HANDLE(HMONITOR);
76 DECLARE_OLD_HANDLE(HPALETTE);
77 DECLARE_OLD_HANDLE(HPEN);
78 DECLARE_OLD_HANDLE(HRGN);
79 DECLARE_OLD_HANDLE(HRSRC);
80 DECLARE_OLD_HANDLE(HTASK);
81 DECLARE_HANDLE(HWINSTA);
82 DECLARE_OLD_HANDLE(HWND);
84 /* Handle types that must remain interchangeable even with strict on */
86 typedef HINSTANCE HMODULE;
87 typedef HANDLE HGDIOBJ;
88 typedef HANDLE HGLOBAL;
89 typedef HANDLE HLOCAL;
90 typedef HANDLE GLOBALHANDLE;
91 typedef HANDLE LOCALHANDLE;
92 typedef HICON HCURSOR;
94 /* Callback function pointers types */
96 typedef INT CALLBACK (*FARPROC)();
97 typedef INT CALLBACK (*PROC)();
100 /* Macros to split words and longs. */
102 #define LOBYTE(w) ((BYTE)(WORD)(w))
103 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
105 #define LOWORD(l) ((WORD)(DWORD)(l))
106 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
108 #define SLOWORD(l) ((SHORT)(LONG)(l))
109 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
111 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
112 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
113 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
114 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
115 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
117 #define SELECTOROF(ptr) (HIWORD(ptr))
118 #define OFFSETOF(ptr) (LOWORD(ptr))
121 /* macros to set parts of a DWORD (not in the Windows API) */
122 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
123 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
124 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
125 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
128 /* min and max macros */
131 #define max(a,b) (((a) > (b)) ? (a) : (b))
134 #define min(a,b) (((a) < (b)) ? (a) : (b))
136 #endif /* NOMINMAX */
139 /* FIXME: These are supposed to be in stdlib.h only */
141 #define _MAX_FNAME 256
142 #define _MAX_DIR _MAX_FNAME
143 #define _MAX_EXT _MAX_FNAME
144 #define _MAX_PATH 260
146 #define MAX_PATH _MAX_PATH
149 #define HFILE_ERROR ((HFILE)-1)
151 /* The SIZE structure */
152 typedef struct tagSIZE
156 } SIZE, *PSIZE, *LPSIZE;
158 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
160 /* The POINT structure */
161 typedef struct tagPOINT
165 } POINT, *PPOINT, *LPPOINT;
167 typedef struct _POINTL
173 /* The POINTS structure */
175 typedef struct tagPOINTS
179 } POINTS, *PPOINTS, *LPPOINTS;
181 /* The RECT structure */
182 typedef struct tagRECT
188 } RECT, *PRECT, *LPRECT;
189 typedef const RECT *LPCRECT;
192 typedef struct tagRECTL
198 } RECTL, *PRECTL, *LPRECTL;
200 typedef const RECTL *LPCRECTL;
206 #endif /* __WINE_WINDEF_H */