2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __WINE_WINDEF_H
22 #define __WINE_WINDEF_H
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. */
43 # define WINELIB_NAME_AW(func) \
44 func##_must_be_suffixed_with_W_or_A_in_this_context \
45 func##_must_be_suffixed_with_W_or_A_in_this_context
48 # define WINELIB_NAME_AW(func) func##W
50 # define WINELIB_NAME_AW(func) func##A
55 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
57 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
66 typedef WORD CATCHBUF
[9];
67 typedef WORD
*LPCATCHBUF
;
68 typedef DWORD COLORREF
, *LPCOLORREF
;
71 /* Handle types that exist both in Win16 and Win32. */
74 DECLARE_OLD_HANDLE(HACCEL
);
75 DECLARE_OLD_HANDLE(HBITMAP
);
76 DECLARE_OLD_HANDLE(HBRUSH
);
77 DECLARE_HANDLE(HCOLORSPACE
);
78 DECLARE_OLD_HANDLE(HDC
);
79 DECLARE_HANDLE(HDESK
);
80 DECLARE_OLD_HANDLE(HENHMETAFILE
);
81 DECLARE_OLD_HANDLE(HFONT
);
82 DECLARE_OLD_HANDLE(HHOOK
);
83 DECLARE_OLD_HANDLE(HICON
);
84 DECLARE_OLD_HANDLE(HINSTANCE
);
85 DECLARE_OLD_HANDLE(HKEY
);
86 DECLARE_OLD_HANDLE(HKL
);
87 DECLARE_OLD_HANDLE(HMENU
);
88 DECLARE_OLD_HANDLE(HMETAFILE
);
89 DECLARE_HANDLE(HMONITOR
);
90 DECLARE_OLD_HANDLE(HPALETTE
);
91 DECLARE_OLD_HANDLE(HPEN
);
92 DECLARE_OLD_HANDLE(HRGN
);
93 DECLARE_OLD_HANDLE(HRSRC
);
94 DECLARE_OLD_HANDLE(HTASK
);
95 DECLARE_HANDLE(HWINEVENTHOOK
);
96 DECLARE_HANDLE(HWINSTA
);
97 DECLARE_OLD_HANDLE(HWND
);
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))
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)))
143 /* min and max macros */
146 #define max(a,b) (((a) > (b)) ? (a) : (b))
149 #define min(a,b) (((a) < (b)) ? (a) : (b))
151 #endif /* NOMINMAX */
154 #define HFILE_ERROR ((HFILE)-1)
156 /* The SIZE structure */
157 typedef struct tagSIZE
161 } SIZE
, *PSIZE
, *LPSIZE
;
163 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
165 /* The POINT structure */
166 typedef struct tagPOINT
170 } POINT
, *PPOINT
, *LPPOINT
;
172 typedef struct _POINTL
178 /* The POINTS structure */
180 typedef struct tagPOINTS
184 } POINTS
, *PPOINTS
, *LPPOINTS
;
186 /* The RECT structure */
187 typedef struct tagRECT
193 } RECT
, *PRECT
, *LPRECT
;
194 typedef const RECT
*LPCRECT
;
197 typedef struct tagRECTL
203 } RECTL
, *PRECTL
, *LPRECTL
;
205 typedef const RECTL
*LPCRECTL
;
211 #endif /* __WINE_WINDEF_H */