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
40 /* Macros to map Winelib names to the correct implementation name */
41 /* depending on __WINE__ and UNICODE macros. */
42 /* Note that Winelib is purely Win32. */
45 # define WINELIB_NAME_AW(func) \
46 func##_must_be_suffixed_with_W_or_A_in_this_context \
47 func##_must_be_suffixed_with_W_or_A_in_this_context
50 # define WINELIB_NAME_AW(func) func##W
52 # define WINELIB_NAME_AW(func) func##A
57 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
59 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
68 typedef WORD CATCHBUF
[9];
69 typedef WORD
*LPCATCHBUF
;
70 typedef DWORD COLORREF
, *LPCOLORREF
;
73 /* Handle types that exist both in Win16 and Win32. */
76 DECLARE_HANDLE(HACCEL
);
77 DECLARE_HANDLE(HBITMAP
);
78 DECLARE_HANDLE(HBRUSH
);
79 DECLARE_HANDLE(HCOLORSPACE
);
81 DECLARE_HANDLE(HDESK
);
82 DECLARE_HANDLE(HENHMETAFILE
);
83 DECLARE_HANDLE(HFONT
);
84 DECLARE_HANDLE(HHOOK
);
85 DECLARE_HANDLE(HICON
);
86 DECLARE_HANDLE(HINSTANCE
);
89 DECLARE_HANDLE(HMENU
);
90 DECLARE_HANDLE(HMETAFILE
);
91 DECLARE_HANDLE(HMONITOR
);
92 DECLARE_HANDLE(HPALETTE
);
95 DECLARE_HANDLE(HRSRC
);
96 DECLARE_HANDLE(HTASK
);
97 DECLARE_HANDLE(HWINEVENTHOOK
);
98 DECLARE_HANDLE(HWINSTA
);
101 /* Handle types that must remain interchangeable even with strict on */
103 typedef HINSTANCE HMODULE
;
104 typedef HANDLE HGDIOBJ
;
105 typedef HANDLE HGLOBAL
;
106 typedef HANDLE HLOCAL
;
107 typedef HANDLE GLOBALHANDLE
;
108 typedef HANDLE LOCALHANDLE
;
109 typedef HICON HCURSOR
;
111 /* Callback function pointers types */
113 typedef INT (CALLBACK
*FARPROC
)();
114 typedef INT (CALLBACK
*PROC
)();
117 /* Macros to split words and longs. */
119 #define LOBYTE(w) ((BYTE)(WORD)(w))
120 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
122 #define LOWORD(l) ((WORD)(DWORD)(l))
123 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
125 #define SLOWORD(l) ((SHORT)(LONG)(l))
126 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
128 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
129 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
130 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
131 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
132 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
134 #define SELECTOROF(ptr) (HIWORD(ptr))
135 #define OFFSETOF(ptr) (LOWORD(ptr))
138 /* macros to set parts of a DWORD (not in the Windows API) */
139 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
140 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
141 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
142 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
145 /* min and max macros */
148 #define max(a,b) (((a) > (b)) ? (a) : (b))
151 #define min(a,b) (((a) < (b)) ? (a) : (b))
153 #endif /* NOMINMAX */
155 #ifdef MAX_PATH /* Work-around for Mingw */
157 #endif /* MAX_PATH */
160 #define HFILE_ERROR ((HFILE)-1)
162 /* The SIZE structure */
163 typedef struct tagSIZE
167 } SIZE
, *PSIZE
, *LPSIZE
;
169 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
171 /* The POINT structure */
172 typedef struct tagPOINT
176 } POINT
, *PPOINT
, *LPPOINT
;
178 typedef struct _POINTL
184 /* The POINTS structure */
186 typedef struct tagPOINTS
190 } POINTS
, *PPOINTS
, *LPPOINTS
;
192 /* The RECT structure */
193 typedef struct tagRECT
199 } RECT
, *PRECT
, *LPRECT
;
200 typedef const RECT
*LPCRECT
;
203 typedef struct tagRECTL
209 } RECTL
, *PRECTL
, *LPRECTL
;
211 typedef const RECTL
*LPCRECTL
;
217 #endif /* __WINE_WINDEF_H */