1 | /* $Id: windef.h,v 1.6 1999-08-25 11:24:08 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Basic types definitions
|
---|
5 | *
|
---|
6 | * Copyright 1996 Alexandre Julliard
|
---|
7 | */
|
---|
8 |
|
---|
9 | #ifndef __WINE_WINDEF_H
|
---|
10 | #define __WINE_WINDEF_H
|
---|
11 |
|
---|
12 | #ifdef __WINE__
|
---|
13 | # include "config.h"
|
---|
14 | # undef UNICODE
|
---|
15 | #endif /* __WINE__ */
|
---|
16 |
|
---|
17 | #ifdef __cplusplus
|
---|
18 | extern "C" {
|
---|
19 | #endif
|
---|
20 |
|
---|
21 | /* Misc. constants. */
|
---|
22 |
|
---|
23 | #ifdef FALSE
|
---|
24 | #undef FALSE
|
---|
25 | #endif
|
---|
26 | #define FALSE 0
|
---|
27 |
|
---|
28 | #ifdef TRUE
|
---|
29 | #undef TRUE
|
---|
30 | #endif
|
---|
31 | #define TRUE 1
|
---|
32 |
|
---|
33 | #ifdef NULL
|
---|
34 | #undef NULL
|
---|
35 | #endif
|
---|
36 | #define NULL 0
|
---|
37 |
|
---|
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. */
|
---|
41 |
|
---|
42 | #ifdef __WINE__
|
---|
43 | #ifdef __WIN32OS2__
|
---|
44 | # define WINELIB_NAME_AW(func) func
|
---|
45 | #else
|
---|
46 | # define WINELIB_NAME_AW(func) this_is_a_syntax_error this_is_a_syntax_error
|
---|
47 | #endif
|
---|
48 | #else /* __WINE__ */
|
---|
49 | # ifdef UNICODE
|
---|
50 | # define WINELIB_NAME_AW(func) func##W
|
---|
51 | # else
|
---|
52 | # define WINELIB_NAME_AW(func) func##A
|
---|
53 | # endif /* UNICODE */
|
---|
54 | #endif /* __WINE__ */
|
---|
55 |
|
---|
56 | #ifdef __WINE__
|
---|
57 | # define DECL_WINELIB_TYPE_AW(type) /* nothing */
|
---|
58 | #else /* __WINE__ */
|
---|
59 | # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
|
---|
60 | #endif /* __WINE__ */
|
---|
61 |
|
---|
62 |
|
---|
63 | /* Calling conventions definitions */
|
---|
64 |
|
---|
65 | #ifdef __i386__
|
---|
66 | # if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)
|
---|
67 | # define __stdcall __attribute__((__stdcall__))
|
---|
68 | # define __cdecl __attribute__((__cdecl__))
|
---|
69 | # define __RESTORE_ES __asm__ __volatile__("pushl %ds\n\tpopl %es")
|
---|
70 | # else
|
---|
71 | # error You need gcc >= 2.7 to build Wine on a 386
|
---|
72 | # endif /* __GNUC__ */
|
---|
73 | #else /* __i386__ */
|
---|
74 | #ifndef __WIN32OS2__
|
---|
75 | # define __stdcall
|
---|
76 | # define __cdecl
|
---|
77 | # define __RESTORE_ES
|
---|
78 | #endif
|
---|
79 | #endif /* __i386__ */
|
---|
80 |
|
---|
81 |
|
---|
82 | /* define needed macros as required */
|
---|
83 | #ifndef CALLBACK
|
---|
84 | #define CALLBACK __stdcall
|
---|
85 | #endif
|
---|
86 |
|
---|
87 | #ifndef WINAPI
|
---|
88 | #define WINAPI __stdcall
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #ifndef APIPRIVATE
|
---|
92 | #define APIPRIVATE __stdcall
|
---|
93 | #endif
|
---|
94 |
|
---|
95 | #ifndef PASCAL
|
---|
96 | #define PASCAL __stdcall
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | #ifndef pascal
|
---|
100 | #define pascal __stdcall
|
---|
101 | #endif
|
---|
102 |
|
---|
103 | #ifndef _pascal
|
---|
104 | #define _pascal __stdcall
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | #ifndef _stdcall
|
---|
108 | #define _stdcall __stdcall
|
---|
109 | #endif
|
---|
110 |
|
---|
111 | #ifndef _fastcall
|
---|
112 | #define _fastcall __stdcall
|
---|
113 | #endif
|
---|
114 |
|
---|
115 | #ifndef __export
|
---|
116 | #define __export __stdcall
|
---|
117 | #endif
|
---|
118 |
|
---|
119 | #ifndef CDECL
|
---|
120 | #define CDECL __cdecl
|
---|
121 | #endif
|
---|
122 |
|
---|
123 | #ifndef _CDECL
|
---|
124 | #define _CDECL __cdecl
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | #ifndef cdecl
|
---|
128 | #define cdecl __cdecl
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | #ifndef _cdecl
|
---|
132 | #define _cdecl __cdecl
|
---|
133 | #endif
|
---|
134 |
|
---|
135 | #ifndef WINAPIV
|
---|
136 | #define WINAPIV __cdecl
|
---|
137 | #endif
|
---|
138 |
|
---|
139 | #ifndef APIENTRY
|
---|
140 | #define APIENTRY WINAPI
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | #ifndef __declspec
|
---|
144 | #define __declspec(x)
|
---|
145 | #endif
|
---|
146 |
|
---|
147 | #ifndef dllimport
|
---|
148 | #define dllimport
|
---|
149 | #endif
|
---|
150 |
|
---|
151 | #ifndef dllexport
|
---|
152 | #define dllexport
|
---|
153 | #endif
|
---|
154 |
|
---|
155 | #ifndef CONST
|
---|
156 | #define CONST const
|
---|
157 | #endif
|
---|
158 |
|
---|
159 |
|
---|
160 |
|
---|
161 | /* Standard data types. These are the same for emulator and library. */
|
---|
162 |
|
---|
163 | typedef void VOID;
|
---|
164 | typedef short INT16;
|
---|
165 | typedef unsigned short UINT16;
|
---|
166 | typedef int INT;
|
---|
167 | typedef unsigned int UINT;
|
---|
168 | typedef unsigned short WORD;
|
---|
169 | typedef unsigned long DWORD;
|
---|
170 | typedef unsigned long ULONG;
|
---|
171 | typedef unsigned char BYTE;
|
---|
172 | typedef long LONG;
|
---|
173 | typedef short SHORT;
|
---|
174 | typedef unsigned short USHORT;
|
---|
175 | typedef char CHAR;
|
---|
176 | typedef unsigned char UCHAR;
|
---|
177 | /* Some systems might have wchar_t, but we really need 16 bit characters */
|
---|
178 | typedef unsigned short WCHAR;
|
---|
179 | typedef unsigned short BOOL16;
|
---|
180 | typedef int BOOL;
|
---|
181 | typedef double DATE;
|
---|
182 | typedef long LONG_PTR;
|
---|
183 | typedef unsigned long ULONG_PTR;
|
---|
184 | typedef double DOUBLE;
|
---|
185 | typedef double LONGLONG;
|
---|
186 | typedef double ULONGLONG;
|
---|
187 |
|
---|
188 | /* FIXME: Wine does not compile with strict on, therefore strict
|
---|
189 | * handles are presently only usable on machines where sizeof(UINT) ==
|
---|
190 | * sizeof(void*). HANDLEs are supposed to be void* but a large amount
|
---|
191 | * of WINE code operates on HANDLES as if they are UINTs. So to WINE
|
---|
192 | * they exist as UINTs but to the Winelib user who turns on strict,
|
---|
193 | * they exist as void*. If there is a size difference between UINT and
|
---|
194 | * void* then things get ugly. */
|
---|
195 | #ifdef STRICT
|
---|
196 | typedef UINT16 HANDLE16;
|
---|
197 | typedef VOID* HANDLE;
|
---|
198 | #else
|
---|
199 | typedef UINT16 HANDLE16;
|
---|
200 | typedef ULONG HANDLE;
|
---|
201 | #endif
|
---|
202 |
|
---|
203 | typedef HANDLE16 *LPHANDLE16;
|
---|
204 | typedef HANDLE *LPHANDLE;
|
---|
205 |
|
---|
206 | /* Integer types. These are the same for emulator and library. */
|
---|
207 | typedef UINT16 WPARAM16;
|
---|
208 | typedef UINT WPARAM;
|
---|
209 | typedef LONG LPARAM;
|
---|
210 | typedef LONG HRESULT;
|
---|
211 | typedef LONG LRESULT;
|
---|
212 | typedef WORD ATOM;
|
---|
213 | typedef WORD CATCHBUF[9];
|
---|
214 | typedef WORD *LPCATCHBUF;
|
---|
215 | typedef DWORD ACCESS_MASK;
|
---|
216 | typedef ACCESS_MASK REGSAM;
|
---|
217 | typedef HANDLE HHOOK;
|
---|
218 | typedef HANDLE HKEY;
|
---|
219 | typedef HANDLE HMONITOR;
|
---|
220 | typedef DWORD LCID;
|
---|
221 | typedef WORD LANGID;
|
---|
222 | typedef DWORD LCTYPE;
|
---|
223 | typedef float FLOAT;
|
---|
224 | #ifdef __WIN32OS2__
|
---|
225 | #if (__IBMC__ < 400) && (__IBMCPP__ < 360)
|
---|
226 | typedef double __int64;
|
---|
227 | #endif
|
---|
228 | #else
|
---|
229 | typedef long long __int64;
|
---|
230 | #endif
|
---|
231 |
|
---|
232 | /* Pointers types. These are the same for emulator and library. */
|
---|
233 | /* winnt types */
|
---|
234 | typedef VOID *PVOID;
|
---|
235 | typedef const void *PCVOID;
|
---|
236 | typedef CHAR *PCHAR;
|
---|
237 | typedef UCHAR *PUCHAR;
|
---|
238 | typedef BYTE *PBYTE;
|
---|
239 | typedef ULONG *PULONG;
|
---|
240 | typedef LONG *PLONG;
|
---|
241 | typedef DWORD *PDWORD;
|
---|
242 | /* common win32 types */
|
---|
243 | typedef CHAR *LPSTR;
|
---|
244 | typedef CHAR *LPTSTR;
|
---|
245 | typedef CHAR *PSTR;
|
---|
246 | typedef const CHAR *LPCSTR;
|
---|
247 | typedef const CHAR *LPCTSTR;
|
---|
248 | typedef const CHAR *PCSTR;
|
---|
249 | typedef WCHAR *LPWSTR;
|
---|
250 | typedef WCHAR *PWSTR;
|
---|
251 | typedef const WCHAR *LPCWSTR;
|
---|
252 | typedef const WCHAR *PCWSTR;
|
---|
253 | typedef BYTE *LPBYTE;
|
---|
254 | typedef WORD *LPWORD;
|
---|
255 | typedef DWORD *LPDWORD;
|
---|
256 | typedef LONG *LPLONG;
|
---|
257 | typedef VOID *LPVOID;
|
---|
258 | typedef const VOID *LPCVOID;
|
---|
259 | typedef INT16 *LPINT16;
|
---|
260 | typedef UINT16 *LPUINT16;
|
---|
261 | typedef INT *PINT;
|
---|
262 | typedef INT *LPINT;
|
---|
263 | typedef UINT *PUINT;
|
---|
264 | typedef UINT *LPUINT;
|
---|
265 | typedef HKEY *LPHKEY;
|
---|
266 | typedef HKEY *PHKEY;
|
---|
267 | typedef FLOAT *PFLOAT;
|
---|
268 | typedef FLOAT *LPFLOAT;
|
---|
269 | typedef BOOL *PBOOL;
|
---|
270 | typedef BOOL *LPBOOL;
|
---|
271 |
|
---|
272 | /* Special case: a segmented pointer is just a pointer in the user's code. */
|
---|
273 |
|
---|
274 | #ifdef __WINE__
|
---|
275 | typedef DWORD SEGPTR;
|
---|
276 | #else
|
---|
277 | typedef void* SEGPTR;
|
---|
278 | #endif /* __WINE__ */
|
---|
279 |
|
---|
280 | /* Handle types that exist both in Win16 and Win32. */
|
---|
281 |
|
---|
282 | #ifdef STRICT
|
---|
283 | #define DECLARE_HANDLE(a) \
|
---|
284 | typedef HANDLE16 a##16; \
|
---|
285 | typedef a##16 *P##a##16; \
|
---|
286 | typedef a##16 *NP##a##16; \
|
---|
287 | typedef a##16 *LP##a##16; \
|
---|
288 | typedef struct a##__ { int unused; } *a; \
|
---|
289 | typedef a *P##a; \
|
---|
290 | typedef a *LP##a
|
---|
291 | #else /*STRICT*/
|
---|
292 | #define DECLARE_HANDLE(a) \
|
---|
293 | typedef HANDLE16 a##16; \
|
---|
294 | typedef a##16 *P##a##16; \
|
---|
295 | typedef a##16 *NP##a##16; \
|
---|
296 | typedef a##16 *LP##a##16; \
|
---|
297 | typedef HANDLE a; \
|
---|
298 | typedef a *P##a; \
|
---|
299 | typedef a *LP##a
|
---|
300 | #endif /*STRICT*/
|
---|
301 |
|
---|
302 | DECLARE_HANDLE(HACMDRIVERID);
|
---|
303 | DECLARE_HANDLE(HACMDRIVER);
|
---|
304 | DECLARE_HANDLE(HACMOBJ);
|
---|
305 | DECLARE_HANDLE(HACMSTREAM);
|
---|
306 | DECLARE_HANDLE(HMETAFILEPICT);
|
---|
307 |
|
---|
308 | DECLARE_HANDLE(HACCEL);
|
---|
309 | DECLARE_HANDLE(HBITMAP);
|
---|
310 | DECLARE_HANDLE(HBRUSH);
|
---|
311 | DECLARE_HANDLE(HCOLORSPACE);
|
---|
312 | DECLARE_HANDLE(HCURSOR);
|
---|
313 | DECLARE_HANDLE(HDC);
|
---|
314 | DECLARE_HANDLE(HDROP);
|
---|
315 | DECLARE_HANDLE(HDRVR);
|
---|
316 | DECLARE_HANDLE(HDWP);
|
---|
317 | DECLARE_HANDLE(HENHMETAFILE);
|
---|
318 | DECLARE_HANDLE(HFILE);
|
---|
319 | DECLARE_HANDLE(HFONT);
|
---|
320 | DECLARE_HANDLE(HICON);
|
---|
321 | DECLARE_HANDLE(HINSTANCE);
|
---|
322 | DECLARE_HANDLE(HMENU);
|
---|
323 | DECLARE_HANDLE(HMETAFILE);
|
---|
324 | DECLARE_HANDLE(HMIDI);
|
---|
325 | DECLARE_HANDLE(HMIDIIN);
|
---|
326 | DECLARE_HANDLE(HMIDIOUT);
|
---|
327 | DECLARE_HANDLE(HMIDISTRM);
|
---|
328 | DECLARE_HANDLE(HMIXER);
|
---|
329 | DECLARE_HANDLE(HMIXEROBJ);
|
---|
330 | DECLARE_HANDLE(HMMIO);
|
---|
331 | DECLARE_HANDLE(HPALETTE);
|
---|
332 | DECLARE_HANDLE(HPEN);
|
---|
333 | DECLARE_HANDLE(HQUEUE);
|
---|
334 | DECLARE_HANDLE(HRGN);
|
---|
335 | DECLARE_HANDLE(HRSRC);
|
---|
336 | DECLARE_HANDLE(HTASK);
|
---|
337 | DECLARE_HANDLE(HWAVE);
|
---|
338 | DECLARE_HANDLE(HWAVEIN);
|
---|
339 | DECLARE_HANDLE(HWAVEOUT);
|
---|
340 | DECLARE_HANDLE(HWINSTA);
|
---|
341 | DECLARE_HANDLE(HDESK);
|
---|
342 | DECLARE_HANDLE(HWND);
|
---|
343 | DECLARE_HANDLE(HKL);
|
---|
344 | DECLARE_HANDLE(HIC);
|
---|
345 | DECLARE_HANDLE(HRASCONN);
|
---|
346 | DECLARE_HANDLE(HPRINTER);
|
---|
347 | #undef DECLARE_HANDLE
|
---|
348 |
|
---|
349 | /* Handle types that must remain interchangeable even with strict on */
|
---|
350 |
|
---|
351 | typedef HINSTANCE16 HMODULE16;
|
---|
352 | typedef HINSTANCE HMODULE;
|
---|
353 | typedef HANDLE16 HGDIOBJ16;
|
---|
354 | typedef HANDLE16 HGLOBAL16;
|
---|
355 | typedef HANDLE16 HLOCAL16;
|
---|
356 | typedef HANDLE HGDIOBJ;
|
---|
357 | typedef HANDLE HGLOBAL;
|
---|
358 | typedef HANDLE HLOCAL;
|
---|
359 |
|
---|
360 | /* Callback function pointers types */
|
---|
361 |
|
---|
362 | typedef BOOL (* CALLBACK DATEFMT_ENUMPROCA)(LPSTR);
|
---|
363 | typedef BOOL (* CALLBACK DATEFMT_ENUMPROCW)(LPWSTR);
|
---|
364 | DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
|
---|
365 | typedef BOOL16 (* CALLBACK DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
|
---|
366 | typedef BOOL (* CALLBACK DLGPROC)(HWND,UINT,WPARAM,LPARAM);
|
---|
367 | typedef LRESULT (* CALLBACK DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
|
---|
368 | typedef LRESULT (* CALLBACK DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
|
---|
369 | typedef INT16 (* CALLBACK EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
|
---|
370 | typedef INT (* CALLBACK EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
|
---|
371 | typedef INT (* CALLBACK EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
|
---|
372 | DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
|
---|
373 | typedef LRESULT (* CALLBACK FARPROC16)();
|
---|
374 | typedef LRESULT (* CALLBACK FARPROC)();
|
---|
375 | typedef INT16 (* CALLBACK PROC16)();
|
---|
376 | typedef INT (* CALLBACK PROC)();
|
---|
377 | typedef INT16 (* CALLBACK GOBJENUMPROC16)(SEGPTR,LPARAM);
|
---|
378 | typedef INT (* CALLBACK GOBJENUMPROC)(LPVOID,LPARAM);
|
---|
379 | typedef BOOL16 (* CALLBACK GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
|
---|
380 | typedef BOOL (* CALLBACK GRAYSTRINGPROC)(HDC,LPARAM,INT);
|
---|
381 | typedef LRESULT (* CALLBACK HOOKPROC16)(INT16,WPARAM16,LPARAM);
|
---|
382 | typedef LRESULT (* CALLBACK HOOKPROC)(INT,WPARAM,LPARAM);
|
---|
383 | typedef VOID (* CALLBACK LINEDDAPROC16)(INT16,INT16,LPARAM);
|
---|
384 | typedef VOID (* CALLBACK LINEDDAPROC)(INT,INT,LPARAM);
|
---|
385 | typedef BOOL16 (* CALLBACK PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
|
---|
386 | typedef BOOL (* CALLBACK PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
|
---|
387 | typedef BOOL (* CALLBACK PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
|
---|
388 | DECL_WINELIB_TYPE_AW(PROPENUMPROC)
|
---|
389 | typedef BOOL (* CALLBACK PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
|
---|
390 | typedef BOOL (* CALLBACK PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
|
---|
391 | DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
|
---|
392 | typedef BOOL (* CALLBACK TIMEFMT_ENUMPROCA)(LPSTR);
|
---|
393 | typedef BOOL (* CALLBACK TIMEFMT_ENUMPROCW)(LPWSTR);
|
---|
394 | DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
|
---|
395 | typedef VOID (* CALLBACK TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
|
---|
396 | typedef VOID (* CALLBACK TIMERPROC)(HWND,UINT,UINT,DWORD);
|
---|
397 | typedef LRESULT (* CALLBACK WNDENUMPROC16)(HWND16,LPARAM);
|
---|
398 | typedef LRESULT (* CALLBACK WNDENUMPROC)(HWND,LPARAM);
|
---|
399 | typedef LRESULT (* CALLBACK WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
|
---|
400 | typedef LRESULT (* CALLBACK WNDPROC)(HWND,UINT,WPARAM,LPARAM);
|
---|
401 |
|
---|
402 | /* TCHAR data types definitions for Winelib. */
|
---|
403 | /* These types are _not_ defined for the emulator, because they */
|
---|
404 | /* depend on the UNICODE macro that only exists in user's code. */
|
---|
405 |
|
---|
406 | #ifndef __WINE__
|
---|
407 | # ifdef UNICODE
|
---|
408 | typedef WCHAR TCHAR;
|
---|
409 | typedef LPWSTR LPTSTR;
|
---|
410 | typedef LPCWSTR LPCTSTR;
|
---|
411 | #define __TEXT(string) L##string /*probably wrong */
|
---|
412 | # else /* UNICODE */
|
---|
413 | typedef CHAR TCHAR;
|
---|
414 | typedef LPSTR LPTSTR;
|
---|
415 | typedef LPCSTR LPCTSTR;
|
---|
416 | #define __TEXT(string) string
|
---|
417 | # endif /* UNICODE */
|
---|
418 | #endif /* __WINE__ */
|
---|
419 | #define TEXT(quote) __TEXT(quote)
|
---|
420 |
|
---|
421 | /* Data types specific to the library. These do _not_ exist in the emulator. */
|
---|
422 |
|
---|
423 |
|
---|
424 |
|
---|
425 | /* Define some empty macros for compatibility with Windows code. */
|
---|
426 |
|
---|
427 | #ifndef __WINE__
|
---|
428 | #define NEAR
|
---|
429 | #define FAR
|
---|
430 | #define near
|
---|
431 | #define far
|
---|
432 | #define _near
|
---|
433 | #define _far
|
---|
434 | #define IN
|
---|
435 | #define OUT
|
---|
436 | #define OPTIONAL
|
---|
437 | #endif /* __WINE__ */
|
---|
438 |
|
---|
439 | /* Macro for structure packing. */
|
---|
440 |
|
---|
441 | #ifdef __GNUC__
|
---|
442 | #define WINE_PACKED __attribute__ ((packed))
|
---|
443 | #define WINE_UNUSED __attribute__ ((unused))
|
---|
444 | #else
|
---|
445 | #define WINE_PACKED /* nothing */
|
---|
446 | #define WINE_UNUSED /* nothing */
|
---|
447 | #endif
|
---|
448 |
|
---|
449 | /* Macros to split words and longs. */
|
---|
450 |
|
---|
451 | #define LOBYTE(w) ((BYTE)(WORD)(w))
|
---|
452 | #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
|
---|
453 |
|
---|
454 | #define LOWORD(l) ((WORD)(DWORD)(l))
|
---|
455 | #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
|
---|
456 |
|
---|
457 | #define SLOWORD(l) ((INT16)(LONG)(l))
|
---|
458 | #define SHIWORD(l) ((INT16)((LONG)(l) >> 16))
|
---|
459 |
|
---|
460 | #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
|
---|
461 | #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
|
---|
462 | #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
|
---|
463 | #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
|
---|
464 | #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
|
---|
465 | #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
|
---|
466 |
|
---|
467 | #define SELECTOROF(ptr) (HIWORD(ptr))
|
---|
468 | #define OFFSETOF(ptr) (LOWORD(ptr))
|
---|
469 |
|
---|
470 | /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
|
---|
471 | /* Note: These macros are semantically broken, at least for wrc. wrc
|
---|
472 | spits out data in the platform's current binary format, *not* in
|
---|
473 | little-endian format. These macros are used throughout the resource
|
---|
474 | code to load and store data to the resources. Since it is unlikely
|
---|
475 | that we'll ever be dealing with little-endian resource data, the
|
---|
476 | byte-swapping nature of these macros has been disabled. Rather than
|
---|
477 | remove the use of these macros from the resource loading code, the
|
---|
478 | macros have simply been disabled. In the future, someone may want
|
---|
479 | to reactivate these macros for other purposes. In that case, the
|
---|
480 | resource code will have to be modified to use different macros. */
|
---|
481 |
|
---|
482 | #if 1
|
---|
483 | #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
|
---|
484 | #define GET_WORD(ptr) (*(WORD *)(ptr))
|
---|
485 | #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
|
---|
486 | #define GET_DWORD(ptr) (*(DWORD *)(ptr))
|
---|
487 | #else
|
---|
488 | #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
|
---|
489 | *((BYTE *)(ptr) + 1) = HIBYTE(w))
|
---|
490 | #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
|
---|
491 | (WORD)(*((BYTE *)(ptr)+1) << 8)))
|
---|
492 | #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
|
---|
493 | PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
|
---|
494 | #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
|
---|
495 | ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
|
---|
496 | #endif /* 1 */
|
---|
497 |
|
---|
498 | /* MIN and MAX macros */
|
---|
499 |
|
---|
500 | #ifdef MAX
|
---|
501 | #undef MAX
|
---|
502 | #endif
|
---|
503 | #define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
---|
504 |
|
---|
505 | #ifdef MIN
|
---|
506 | #undef MIN
|
---|
507 | #endif
|
---|
508 | #define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
---|
509 |
|
---|
510 | #define __max(a,b) MAX(a,b)
|
---|
511 | #define __min(a,b) MIN(a,b)
|
---|
512 | #ifndef max
|
---|
513 | #define max(a,b) MAX(a,b)
|
---|
514 | #endif
|
---|
515 |
|
---|
516 | #ifndef min
|
---|
517 | #define min(a,b) MIN(a,b)
|
---|
518 | #endif
|
---|
519 |
|
---|
520 | #define _MAX_PATH 260
|
---|
521 | #define MAX_PATH 260
|
---|
522 | #define _MAX_DRIVE 3
|
---|
523 | #define _MAX_DIR 256
|
---|
524 | #ifndef __WIN32OS2__
|
---|
525 | #define _MAX_FNAME 255
|
---|
526 | #endif
|
---|
527 | #define _MAX_EXT 256
|
---|
528 |
|
---|
529 | #define HFILE_ERROR16 ((HFILE16)-1)
|
---|
530 | #define HFILE_ERROR ((HFILE)-1)
|
---|
531 |
|
---|
532 | /* Winelib run-time flag */
|
---|
533 |
|
---|
534 | #ifdef __WINE__
|
---|
535 | extern int __winelib;
|
---|
536 | #endif /* __WINE__ */
|
---|
537 |
|
---|
538 | /* The SIZE structure */
|
---|
539 |
|
---|
540 | typedef struct
|
---|
541 | {
|
---|
542 | INT16 cx;
|
---|
543 | INT16 cy;
|
---|
544 | } SIZE16, *PSIZE16, *LPSIZE16;
|
---|
545 |
|
---|
546 | typedef struct tagSIZE
|
---|
547 | {
|
---|
548 | INT cx;
|
---|
549 | INT cy;
|
---|
550 | } SIZE, *PSIZE, *LPSIZE;
|
---|
551 |
|
---|
552 |
|
---|
553 | typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
|
---|
554 |
|
---|
555 | #define CONV_SIZE16TO32(s16,s32) \
|
---|
556 | ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy)
|
---|
557 | #define CONV_SIZE32TO16(s32,s16) \
|
---|
558 | ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
|
---|
559 |
|
---|
560 | /* The POINT structure */
|
---|
561 |
|
---|
562 | typedef struct
|
---|
563 | {
|
---|
564 | INT16 x;
|
---|
565 | INT16 y;
|
---|
566 | } POINT16, *PPOINT16, *LPPOINT16;
|
---|
567 |
|
---|
568 | typedef struct tagPOINT
|
---|
569 | {
|
---|
570 | LONG x;
|
---|
571 | LONG y;
|
---|
572 | } POINT, *PPOINT, *LPPOINT;
|
---|
573 |
|
---|
574 | typedef struct _POINTL
|
---|
575 | {
|
---|
576 | LONG x;
|
---|
577 | LONG y;
|
---|
578 | } POINTL;
|
---|
579 |
|
---|
580 | #define CONV_POINT16TO32(p16,p32) \
|
---|
581 | ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y)
|
---|
582 | #define CONV_POINT32TO16(p32,p16) \
|
---|
583 | ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
|
---|
584 |
|
---|
585 | #define MAKEPOINT16(l) (*((POINT16 *)&(l)))
|
---|
586 |
|
---|
587 | /* The POINTS structure */
|
---|
588 |
|
---|
589 | typedef struct tagPOINTS
|
---|
590 | {
|
---|
591 | SHORT x;
|
---|
592 | SHORT y;
|
---|
593 | } POINTS, *PPOINTS, *LPPOINTS;
|
---|
594 |
|
---|
595 |
|
---|
596 | #define MAKEPOINTS(l) (*((POINTS *)&(l)))
|
---|
597 |
|
---|
598 |
|
---|
599 | /* The RECT structure */
|
---|
600 |
|
---|
601 | typedef struct
|
---|
602 | {
|
---|
603 | INT16 left;
|
---|
604 | INT16 top;
|
---|
605 | INT16 right;
|
---|
606 | INT16 bottom;
|
---|
607 | } RECT16, *LPRECT16;
|
---|
608 |
|
---|
609 | typedef struct tagRECT
|
---|
610 | {
|
---|
611 | INT left;
|
---|
612 | INT top;
|
---|
613 | INT right;
|
---|
614 | INT bottom;
|
---|
615 | } RECT, *PRECT, *LPRECT;
|
---|
616 | typedef const RECT *LPCRECT;
|
---|
617 |
|
---|
618 |
|
---|
619 | typedef struct tagRECTL
|
---|
620 | {
|
---|
621 | LONG left;
|
---|
622 | LONG top;
|
---|
623 | LONG right;
|
---|
624 | LONG bottom;
|
---|
625 | } RECTL, *PRECTL, *LPRECTL;
|
---|
626 |
|
---|
627 | typedef const RECTL *LPCRECTL;
|
---|
628 |
|
---|
629 | #define CONV_RECT16TO32(r16,r32) \
|
---|
630 | ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \
|
---|
631 | (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom)
|
---|
632 | #define CONV_RECT32TO16(r32,r16) \
|
---|
633 | ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \
|
---|
634 | (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom)
|
---|
635 |
|
---|
636 | #ifdef __cplusplus
|
---|
637 | }
|
---|
638 | #endif
|
---|
639 |
|
---|
640 | #endif /* __WINE_WINDEF_H */
|
---|