Fixed error recovery during thread creation.
[wine.git] / include / windef.h
blobab98867c76d2da2d11bc426222614de40becc0af
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_WINDEF_H
8 #define __WINE_WINDEF_H
10 #ifdef __WINE__
11 # undef UNICODE
12 #endif /* __WINE__ */
14 #define WINVER 0x0500
16 #include "winnt.h"
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
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. */
28 #ifdef __WINE__
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
32 #else /* __WINE__ */
33 # ifdef UNICODE
34 # define WINELIB_NAME_AW(func) func##W
35 # else
36 # define WINELIB_NAME_AW(func) func##A
37 # endif /* UNICODE */
38 #endif /* __WINE__ */
40 #ifdef __WINE__
41 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
42 #else /* __WINE__ */
43 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
44 #endif /* __WINE__ */
47 /* Integer types. These are the same for emulator and library. */
48 typedef UINT WPARAM;
49 typedef LONG LPARAM;
50 typedef LONG LRESULT;
51 typedef WORD ATOM;
52 typedef WORD CATCHBUF[9];
53 typedef WORD *LPCATCHBUF;
54 typedef HANDLE HHOOK;
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);
74 typedef int HFILE;
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))
161 #ifdef __WINE__
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)))
167 #endif
169 /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
170 /* Note: These macros are semantically broken, at least for wrc. wrc
171 spits out data in the platform's current binary format, *not* in
172 little-endian format. These macros are used throughout the resource
173 code to load and store data to the resources. Since it is unlikely
174 that we'll ever be dealing with little-endian resource data, the
175 byte-swapping nature of these macros has been disabled. Rather than
176 remove the use of these macros from the resource loading code, the
177 macros have simply been disabled. In the future, someone may want
178 to reactivate these macros for other purposes. In that case, the
179 resource code will have to be modified to use different macros. */
181 #if 1
182 #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
183 #define GET_WORD(ptr) (*(WORD *)(ptr))
184 #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
185 #define GET_DWORD(ptr) (*(DWORD *)(ptr))
186 #else
187 #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
188 *((BYTE *)(ptr) + 1) = HIBYTE(w))
189 #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
190 (WORD)(*((BYTE *)(ptr)+1) << 8)))
191 #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
192 PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
193 #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
194 ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
195 #endif /* 1 */
197 /* min and max macros */
198 #define __max(a,b) (((a) > (b)) ? (a) : (b))
199 #define __min(a,b) (((a) < (b)) ? (a) : (b))
200 #ifndef max
201 #define max(a,b) (((a) > (b)) ? (a) : (b))
202 #endif
203 #ifndef min
204 #define min(a,b) (((a) < (b)) ? (a) : (b))
205 #endif
207 #define _MAX_PATH 260
208 #define MAX_PATH 260
209 #define _MAX_DRIVE 3
210 #define _MAX_DIR 256
211 #define _MAX_FNAME 255
212 #define _MAX_EXT 256
214 #define HFILE_ERROR ((HFILE)-1)
216 /* The SIZE structure */
217 typedef struct tagSIZE
219 LONG cx;
220 LONG cy;
221 } SIZE, *PSIZE, *LPSIZE;
223 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
225 /* The POINT structure */
226 typedef struct tagPOINT
228 LONG x;
229 LONG y;
230 } POINT, *PPOINT, *LPPOINT;
232 typedef struct _POINTL
234 LONG x;
235 LONG y;
236 } POINTL;
238 /* The POINTS structure */
240 typedef struct tagPOINTS
242 SHORT x;
243 SHORT y;
244 } POINTS, *PPOINTS, *LPPOINTS;
246 /* The RECT structure */
247 typedef struct tagRECT
249 INT left;
250 INT top;
251 INT right;
252 INT bottom;
253 } RECT, *PRECT, *LPRECT;
254 typedef const RECT *LPCRECT;
257 typedef struct tagRECTL
259 LONG left;
260 LONG top;
261 LONG right;
262 LONG bottom;
263 } RECTL, *PRECTL, *LPRECTL;
265 typedef const RECTL *LPCRECTL;
267 #ifdef __cplusplus
269 #endif
271 #endif /* __WINE_WINDEF_H */