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
);
63 DECLARE_OLD_HANDLE(HMETAFILEPICT
);
65 DECLARE_OLD_HANDLE(HACCEL
);
66 DECLARE_OLD_HANDLE(HBITMAP
);
67 DECLARE_OLD_HANDLE(HBRUSH
);
68 DECLARE_OLD_HANDLE(HCOLORSPACE
);
69 DECLARE_OLD_HANDLE(HDC
);
70 DECLARE_OLD_HANDLE(HDROP
);
71 DECLARE_OLD_HANDLE(HDRVR
);
72 DECLARE_OLD_HANDLE(HDWP
);
73 DECLARE_OLD_HANDLE(HENHMETAFILE
);
75 DECLARE_OLD_HANDLE(HFONT
);
76 DECLARE_OLD_HANDLE(HICON
);
77 DECLARE_OLD_HANDLE(HINSTANCE
);
78 DECLARE_OLD_HANDLE(HKEY
);
79 DECLARE_OLD_HANDLE(HMENU
);
80 DECLARE_OLD_HANDLE(HMETAFILE
);
81 DECLARE_OLD_HANDLE(HMIDI
);
82 DECLARE_OLD_HANDLE(HMIDIIN
);
83 DECLARE_OLD_HANDLE(HMIDIOUT
);
84 DECLARE_OLD_HANDLE(HMIDISTRM
);
85 DECLARE_OLD_HANDLE(HMIXER
);
86 DECLARE_OLD_HANDLE(HMIXEROBJ
);
87 DECLARE_OLD_HANDLE(HMMIO
);
88 DECLARE_OLD_HANDLE(HPALETTE
);
89 DECLARE_OLD_HANDLE(HPEN
);
90 DECLARE_OLD_HANDLE(HQUEUE
);
91 DECLARE_OLD_HANDLE(HRGN
);
92 DECLARE_OLD_HANDLE(HRSRC
);
93 DECLARE_OLD_HANDLE(HTASK
);
94 DECLARE_OLD_HANDLE(HWAVE
);
95 DECLARE_OLD_HANDLE(HWAVEIN
);
96 DECLARE_OLD_HANDLE(HWAVEOUT
);
97 DECLARE_OLD_HANDLE(HWINSTA
);
98 DECLARE_OLD_HANDLE(HDESK
);
99 DECLARE_OLD_HANDLE(HWND
);
100 DECLARE_OLD_HANDLE(HKL
);
102 /* Handle types that must remain interchangeable even with strict on */
104 typedef HINSTANCE HMODULE
;
105 typedef HANDLE HGDIOBJ
;
106 typedef HANDLE HGLOBAL
;
107 typedef HANDLE HLOCAL
;
108 typedef HANDLE GLOBALHANDLE
;
109 typedef HANDLE LOCALHANDLE
;
110 typedef HICON HCURSOR
;
112 /* Callback function pointers types */
114 typedef BOOL
CALLBACK (*DATEFMT_ENUMPROCA
)(LPSTR
);
115 typedef BOOL
CALLBACK (*DATEFMT_ENUMPROCW
)(LPWSTR
);
116 DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC
)
117 typedef BOOL
CALLBACK (*DLGPROC
)(HWND
,UINT
,WPARAM
,LPARAM
);
118 typedef LRESULT
CALLBACK (*DRIVERPROC
)(DWORD
,HDRVR
,UINT
,LPARAM
,LPARAM
);
119 typedef INT
CALLBACK (*EDITWORDBREAKPROCA
)(LPSTR
,INT
,INT
,INT
);
120 typedef INT
CALLBACK (*EDITWORDBREAKPROCW
)(LPWSTR
,INT
,INT
,INT
);
121 DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC
)
122 typedef LRESULT
CALLBACK (*FARPROC
)();
123 typedef INT
CALLBACK (*PROC
)();
124 typedef BOOL
CALLBACK (*GRAYSTRINGPROC
)(HDC
,LPARAM
,INT
);
125 typedef LRESULT
CALLBACK (*HOOKPROC
)(INT
,WPARAM
,LPARAM
);
126 typedef BOOL
CALLBACK (*PROPENUMPROCA
)(HWND
,LPCSTR
,HANDLE
);
127 typedef BOOL
CALLBACK (*PROPENUMPROCW
)(HWND
,LPCWSTR
,HANDLE
);
128 DECL_WINELIB_TYPE_AW(PROPENUMPROC
)
129 typedef BOOL
CALLBACK (*PROPENUMPROCEXA
)(HWND
,LPCSTR
,HANDLE
,LPARAM
);
130 typedef BOOL
CALLBACK (*PROPENUMPROCEXW
)(HWND
,LPCWSTR
,HANDLE
,LPARAM
);
131 DECL_WINELIB_TYPE_AW(PROPENUMPROCEX
)
132 typedef BOOL
CALLBACK (*TIMEFMT_ENUMPROCA
)(LPSTR
);
133 typedef BOOL
CALLBACK (*TIMEFMT_ENUMPROCW
)(LPWSTR
);
134 DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC
)
135 typedef VOID
CALLBACK (*TIMERPROC
)(HWND
,UINT
,UINT
,DWORD
);
136 typedef BOOL
CALLBACK (*WNDENUMPROC
)(HWND
,LPARAM
);
137 typedef LRESULT
CALLBACK (*WNDPROC
)(HWND
,UINT
,WPARAM
,LPARAM
);
140 /* Macros to split words and longs. */
142 #define LOBYTE(w) ((BYTE)(WORD)(w))
143 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
145 #define LOWORD(l) ((WORD)(DWORD)(l))
146 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
148 #define SLOWORD(l) ((SHORT)(LONG)(l))
149 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
151 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
152 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
153 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
154 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
155 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
156 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
158 #define SELECTOROF(ptr) (HIWORD(ptr))
159 #define OFFSETOF(ptr) (LOWORD(ptr))
162 /* macros to set parts of a DWORD (not in the Windows API) */
163 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val))
164 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val))
165 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOBYTE(val) << 8))
166 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val)))
170 /* min and max macros */
171 #define __max(a,b) (((a) > (b)) ? (a) : (b))
172 #define __min(a,b) (((a) < (b)) ? (a) : (b))
174 #define max(a,b) (((a) > (b)) ? (a) : (b))
177 #define min(a,b) (((a) < (b)) ? (a) : (b))
180 #define _MAX_PATH 260
184 #define _MAX_FNAME 255
187 #define HFILE_ERROR ((HFILE)-1)
189 /* The SIZE structure */
190 typedef struct tagSIZE
194 } SIZE
, *PSIZE
, *LPSIZE
;
196 typedef SIZE SIZEL
, *PSIZEL
, *LPSIZEL
;
198 /* The POINT structure */
199 typedef struct tagPOINT
203 } POINT
, *PPOINT
, *LPPOINT
;
205 typedef struct _POINTL
211 /* The POINTS structure */
213 typedef struct tagPOINTS
217 } POINTS
, *PPOINTS
, *LPPOINTS
;
219 /* The RECT structure */
220 typedef struct tagRECT
226 } RECT
, *PRECT
, *LPRECT
;
227 typedef const RECT
*LPCRECT
;
230 typedef struct tagRECTL
236 } RECTL
, *PRECTL
, *LPRECTL
;
238 typedef const RECTL
*LPCRECTL
;
244 #endif /* __WINE_WINDEF_H */