1 | /* $Id: windef.h,v 1.13 1999-09-22 09:46:19 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 unsigned long BOOL;
|
---|
181 | typedef double DATE;
|
---|
182 | typedef long LONG_PTR;
|
---|
183 | typedef unsigned long ULONG_PTR;
|
---|
184 | typedef double DOUBLE;
|
---|
185 | typedef double LONGLONG_W;
|
---|
186 | typedef double ULONGLONG_W;
|
---|
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 | #ifdef __WINE__
|
---|
244 | typedef CHAR *LPTSTR;
|
---|
245 | typedef const CHAR *LPCTSTR;
|
---|
246 | #endif
|
---|
247 | typedef CHAR *LPSTR;
|
---|
248 | typedef CHAR *PSTR;
|
---|
249 | typedef const CHAR *LPCSTR;
|
---|
250 | typedef const CHAR *PCSTR;
|
---|
251 | typedef WCHAR *LPWSTR;
|
---|
252 | typedef WCHAR *PWSTR;
|
---|
253 | typedef const WCHAR *LPCWSTR;
|
---|
254 | typedef const WCHAR *PCWSTR;
|
---|
255 | typedef BYTE *LPBYTE;
|
---|
256 | typedef WORD *LPWORD;
|
---|
257 | typedef DWORD *LPDWORD;
|
---|
258 | typedef LONG *LPLONG;
|
---|
259 | typedef VOID *LPVOID;
|
---|
260 | typedef const VOID *LPCVOID;
|
---|
261 | typedef INT16 *LPINT16;
|
---|
262 | typedef UINT16 *LPUINT16;
|
---|
263 | typedef INT *PINT;
|
---|
264 | typedef INT *LPINT;
|
---|
265 | typedef UINT *PUINT;
|
---|
266 | typedef UINT *LPUINT;
|
---|
267 | typedef HKEY *LPHKEY;
|
---|
268 | typedef HKEY *PHKEY;
|
---|
269 | typedef FLOAT *PFLOAT;
|
---|
270 | typedef FLOAT *LPFLOAT;
|
---|
271 | typedef BOOL *PBOOL;
|
---|
272 | typedef BOOL *LPBOOL;
|
---|
273 |
|
---|
274 | /* Special case: a segmented pointer is just a pointer in the user's code. */
|
---|
275 |
|
---|
276 | #ifdef __WINE__
|
---|
277 | typedef DWORD SEGPTR;
|
---|
278 | #else
|
---|
279 | typedef void* SEGPTR;
|
---|
280 | #endif /* __WINE__ */
|
---|
281 |
|
---|
282 | /* Handle types that exist both in Win16 and Win32. */
|
---|
283 |
|
---|
284 | #ifdef STRICT
|
---|
285 | #define DECLARE_HANDLE(a) \
|
---|
286 | typedef HANDLE16 a##16; \
|
---|
287 | typedef a##16 *P##a##16; \
|
---|
288 | typedef a##16 *NP##a##16; \
|
---|
289 | typedef a##16 *LP##a##16; \
|
---|
290 | typedef struct a##__ { int unused; } *a; \
|
---|
291 | typedef a *P##a; \
|
---|
292 | typedef a *LP##a
|
---|
293 | #else /*STRICT*/
|
---|
294 | #define DECLARE_HANDLE(a) \
|
---|
295 | typedef HANDLE16 a##16; \
|
---|
296 | typedef a##16 *P##a##16; \
|
---|
297 | typedef a##16 *NP##a##16; \
|
---|
298 | typedef a##16 *LP##a##16; \
|
---|
299 | typedef HANDLE a; \
|
---|
300 | typedef a *P##a; \
|
---|
301 | typedef a *LP##a
|
---|
302 | #endif /*STRICT*/
|
---|
303 |
|
---|
304 | DECLARE_HANDLE(HACMDRIVERID);
|
---|
305 | DECLARE_HANDLE(HACMDRIVER);
|
---|
306 | DECLARE_HANDLE(HACMOBJ);
|
---|
307 | DECLARE_HANDLE(HACMSTREAM);
|
---|
308 | DECLARE_HANDLE(HMETAFILEPICT);
|
---|
309 |
|
---|
310 | DECLARE_HANDLE(HACCEL);
|
---|
311 | DECLARE_HANDLE(HBITMAP);
|
---|
312 | DECLARE_HANDLE(HBRUSH);
|
---|
313 | DECLARE_HANDLE(HCOLORSPACE);
|
---|
314 | DECLARE_HANDLE(HCURSOR);
|
---|
315 | DECLARE_HANDLE(HDC);
|
---|
316 | DECLARE_HANDLE(HDROP);
|
---|
317 | DECLARE_HANDLE(HDRVR);
|
---|
318 | DECLARE_HANDLE(HDWP);
|
---|
319 | DECLARE_HANDLE(HENHMETAFILE);
|
---|
320 | DECLARE_HANDLE(HFILE);
|
---|
321 | DECLARE_HANDLE(HFONT);
|
---|
322 | DECLARE_HANDLE(HICON);
|
---|
323 | DECLARE_HANDLE(HINSTANCE);
|
---|
324 | DECLARE_HANDLE(HMENU);
|
---|
325 | DECLARE_HANDLE(HMETAFILE);
|
---|
326 | DECLARE_HANDLE(HMIDI);
|
---|
327 | DECLARE_HANDLE(HMIDIIN);
|
---|
328 | DECLARE_HANDLE(HMIDIOUT);
|
---|
329 | DECLARE_HANDLE(HMIDISTRM);
|
---|
330 | DECLARE_HANDLE(HMIXER);
|
---|
331 | DECLARE_HANDLE(HMIXEROBJ);
|
---|
332 | DECLARE_HANDLE(HMMIO);
|
---|
333 | DECLARE_HANDLE(HPALETTE);
|
---|
334 | DECLARE_HANDLE(HPEN);
|
---|
335 | DECLARE_HANDLE(HQUEUE);
|
---|
336 | DECLARE_HANDLE(HRGN);
|
---|
337 | DECLARE_HANDLE(HRSRC);
|
---|
338 | DECLARE_HANDLE(HTASK);
|
---|
339 | DECLARE_HANDLE(HWAVE);
|
---|
340 | DECLARE_HANDLE(HWAVEIN);
|
---|
341 | DECLARE_HANDLE(HWAVEOUT);
|
---|
342 | DECLARE_HANDLE(HWINSTA);
|
---|
343 | DECLARE_HANDLE(HDESK);
|
---|
344 | DECLARE_HANDLE(HWND);
|
---|
345 | DECLARE_HANDLE(HKL);
|
---|
346 | DECLARE_HANDLE(HIC);
|
---|
347 | DECLARE_HANDLE(HRASCONN);
|
---|
348 | DECLARE_HANDLE(HPRINTER);
|
---|
349 | #undef DECLARE_HANDLE
|
---|
350 |
|
---|
351 | /* Handle types that must remain interchangeable even with strict on */
|
---|
352 |
|
---|
353 | typedef HINSTANCE16 HMODULE16;
|
---|
354 | typedef HINSTANCE HMODULE;
|
---|
355 | typedef HANDLE16 HGDIOBJ16;
|
---|
356 | typedef HANDLE16 HGLOBAL16;
|
---|
357 | typedef HANDLE16 HLOCAL16;
|
---|
358 | typedef HANDLE HGDIOBJ;
|
---|
359 | typedef HANDLE HGLOBAL;
|
---|
360 | typedef HANDLE HLOCAL;
|
---|
361 |
|
---|
362 | /* Callback function pointers types */
|
---|
363 |
|
---|
364 | typedef BOOL (* CALLBACK DATEFMT_ENUMPROCA)(LPSTR);
|
---|
365 | typedef BOOL (* CALLBACK DATEFMT_ENUMPROCW)(LPWSTR);
|
---|
366 | DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC)
|
---|
367 | typedef BOOL16 (* CALLBACK DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
|
---|
368 | typedef BOOL (* CALLBACK DLGPROC)(HWND,UINT,WPARAM,LPARAM);
|
---|
369 | typedef LRESULT (* CALLBACK DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM);
|
---|
370 | typedef LRESULT (* CALLBACK DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM);
|
---|
371 | typedef INT16 (* CALLBACK EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16);
|
---|
372 | typedef INT (* CALLBACK EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT);
|
---|
373 | typedef INT (* CALLBACK EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT);
|
---|
374 | DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC)
|
---|
375 | typedef LRESULT (* CALLBACK FARPROC16)();
|
---|
376 | typedef LRESULT (* CALLBACK FARPROC)();
|
---|
377 | typedef INT16 (* CALLBACK PROC16)();
|
---|
378 | typedef INT (* CALLBACK PROC)();
|
---|
379 | typedef INT16 (* CALLBACK GOBJENUMPROC16)(SEGPTR,LPARAM);
|
---|
380 | typedef INT (* CALLBACK GOBJENUMPROC)(LPVOID,LPARAM);
|
---|
381 | typedef BOOL16 (* CALLBACK GRAYSTRINGPROC16)(HDC16,LPARAM,INT16);
|
---|
382 | typedef BOOL (* CALLBACK GRAYSTRINGPROC)(HDC,LPARAM,INT);
|
---|
383 | typedef LRESULT (* CALLBACK HOOKPROC16)(INT16,WPARAM16,LPARAM);
|
---|
384 | typedef LRESULT (* CALLBACK HOOKPROC)(INT,WPARAM,LPARAM);
|
---|
385 | typedef VOID (* CALLBACK LINEDDAPROC16)(INT16,INT16,LPARAM);
|
---|
386 | typedef VOID (* CALLBACK LINEDDAPROC)(INT,INT,LPARAM);
|
---|
387 | typedef BOOL16 (* CALLBACK PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16);
|
---|
388 | typedef BOOL (* CALLBACK PROPENUMPROCA)(HWND,LPCSTR,HANDLE);
|
---|
389 | typedef BOOL (* CALLBACK PROPENUMPROCW)(HWND,LPCWSTR,HANDLE);
|
---|
390 | DECL_WINELIB_TYPE_AW(PROPENUMPROC)
|
---|
391 | typedef BOOL (* CALLBACK PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM);
|
---|
392 | typedef BOOL (* CALLBACK PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM);
|
---|
393 | DECL_WINELIB_TYPE_AW(PROPENUMPROCEX)
|
---|
394 | typedef BOOL (* CALLBACK TIMEFMT_ENUMPROCA)(LPSTR);
|
---|
395 | typedef BOOL (* CALLBACK TIMEFMT_ENUMPROCW)(LPWSTR);
|
---|
396 | DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC)
|
---|
397 | typedef VOID (* CALLBACK TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
|
---|
398 | typedef VOID (* CALLBACK TIMERPROC)(HWND,UINT,UINT,DWORD);
|
---|
399 | typedef LRESULT (* CALLBACK WNDENUMPROC16)(HWND16,LPARAM);
|
---|
400 | typedef LRESULT (* CALLBACK WNDENUMPROC)(HWND,LPARAM);
|
---|
401 | typedef LRESULT (* CALLBACK WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
|
---|
402 | typedef LRESULT (* CALLBACK WNDPROC)(HWND,UINT,WPARAM,LPARAM);
|
---|
403 |
|
---|
404 | /* TCHAR data types definitions for Winelib. */
|
---|
405 | /* These types are _not_ defined for the emulator, because they */
|
---|
406 | /* depend on the UNICODE macro that only exists in user's code. */
|
---|
407 |
|
---|
408 | #ifndef __WINE__
|
---|
409 | # ifdef UNICODE
|
---|
410 | typedef WCHAR TCHAR;
|
---|
411 | typedef LPWSTR LPTSTR;
|
---|
412 | typedef LPCWSTR LPCTSTR;
|
---|
413 | #define __TEXT(string) L##string /*probably wrong */
|
---|
414 | # else /* UNICODE */
|
---|
415 | typedef CHAR TCHAR;
|
---|
416 | typedef LPSTR LPTSTR;
|
---|
417 | typedef LPCSTR LPCTSTR;
|
---|
418 | #define __TEXT(string) string
|
---|
419 | # endif /* UNICODE */
|
---|
420 | #endif /* __WINE__ */
|
---|
421 | #define TEXT(quote) __TEXT(quote)
|
---|
422 |
|
---|
423 | /* Data types specific to the library. These do _not_ exist in the emulator. */
|
---|
424 |
|
---|
425 |
|
---|
426 |
|
---|
427 | /* Define some empty macros for compatibility with Windows code. */
|
---|
428 |
|
---|
429 | #ifndef __WINE__
|
---|
430 | #define NEAR
|
---|
431 | #define FAR
|
---|
432 | #define near
|
---|
433 | #define far
|
---|
434 | #define _near
|
---|
435 | #define _far
|
---|
436 | #define IN
|
---|
437 | #define OUT
|
---|
438 | #define OPTIONAL
|
---|
439 | #endif /* __WINE__ */
|
---|
440 |
|
---|
441 | /* Macro for structure packing. */
|
---|
442 |
|
---|
443 | #ifdef __GNUC__
|
---|
444 | #define WINE_PACKED __attribute__ ((packed))
|
---|
445 | #define WINE_UNUSED __attribute__ ((unused))
|
---|
446 | #else
|
---|
447 | #define WINE_PACKED /* nothing */
|
---|
448 | #define WINE_UNUSED /* nothing */
|
---|
449 | #endif
|
---|
450 |
|
---|
451 | /* Macros to split words and longs. */
|
---|
452 |
|
---|
453 | #define LOBYTE(w) ((BYTE)(WORD)(w))
|
---|
454 | #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
|
---|
455 |
|
---|
456 | #define LOWORD(l) ((WORD)(DWORD)(l))
|
---|
457 | #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
|
---|
458 |
|
---|
459 | #define SLOWORD(l) ((INT16)(LONG)(l))
|
---|
460 | #define SHIWORD(l) ((INT16)((LONG)(l) >> 16))
|
---|
461 |
|
---|
462 | #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
|
---|
463 | #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
|
---|
464 | #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
|
---|
465 | #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
|
---|
466 | #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
|
---|
467 | #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0))
|
---|
468 |
|
---|
469 | #define SELECTOROF(ptr) (HIWORD(ptr))
|
---|
470 | #define OFFSETOF(ptr) (LOWORD(ptr))
|
---|
471 |
|
---|
472 | /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
|
---|
473 | /* Note: These macros are semantically broken, at least for wrc. wrc
|
---|
474 | spits out data in the platform's current binary format, *not* in
|
---|
475 | little-endian format. These macros are used throughout the resource
|
---|
476 | code to load and store data to the resources. Since it is unlikely
|
---|
477 | that we'll ever be dealing with little-endian resource data, the
|
---|
478 | byte-swapping nature of these macros has been disabled. Rather than
|
---|
479 | remove the use of these macros from the resource loading code, the
|
---|
480 | macros have simply been disabled. In the future, someone may want
|
---|
481 | to reactivate these macros for other purposes. In that case, the
|
---|
482 | resource code will have to be modified to use different macros. */
|
---|
483 |
|
---|
484 | #if 1
|
---|
485 | #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
|
---|
486 | #define GET_WORD(ptr) (*(WORD *)(ptr))
|
---|
487 | #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
|
---|
488 | #define GET_DWORD(ptr) (*(DWORD *)(ptr))
|
---|
489 | #else
|
---|
490 | #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
|
---|
491 | *((BYTE *)(ptr) + 1) = HIBYTE(w))
|
---|
492 | #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
|
---|
493 | (WORD)(*((BYTE *)(ptr)+1) << 8)))
|
---|
494 | #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
|
---|
495 | PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
|
---|
496 | #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
|
---|
497 | ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
|
---|
498 | #endif /* 1 */
|
---|
499 |
|
---|
500 | /* MIN and MAX macros */
|
---|
501 |
|
---|
502 | #ifdef MAX
|
---|
503 | #undef MAX
|
---|
504 | #endif
|
---|
505 | #define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
---|
506 |
|
---|
507 | #ifdef MIN
|
---|
508 | #undef MIN
|
---|
509 | #endif
|
---|
510 | #define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
---|
511 |
|
---|
512 | #define __max(a,b) MAX(a,b)
|
---|
513 | #define __min(a,b) MIN(a,b)
|
---|
514 | #include <stdlib.h>
|
---|
515 |
|
---|
516 | #define _MAX_PATH 260
|
---|
517 | #define MAX_PATH 260
|
---|
518 | #define _MAX_DRIVE 3
|
---|
519 | #define _MAX_DIR 256
|
---|
520 | #if !defined(__WIN32OS2__) && !defined(_MAX_FNAME)
|
---|
521 | #define _MAX_FNAME 255
|
---|
522 | #endif
|
---|
523 | #define _MAX_EXT 256
|
---|
524 |
|
---|
525 | #define HFILE_ERROR16 ((HFILE16)-1)
|
---|
526 | #define HFILE_ERROR ((HFILE)-1)
|
---|
527 |
|
---|
528 | /* Winelib run-time flag */
|
---|
529 |
|
---|
530 | #ifdef __WINE__
|
---|
531 | extern int __winelib;
|
---|
532 | #endif /* __WINE__ */
|
---|
533 |
|
---|
534 | /* The SIZE structure */
|
---|
535 |
|
---|
536 | typedef struct
|
---|
537 | {
|
---|
538 | INT16 cx;
|
---|
539 | INT16 cy;
|
---|
540 | } SIZE16, *PSIZE16, *LPSIZE16;
|
---|
541 |
|
---|
542 | typedef struct tagSIZE
|
---|
543 | {
|
---|
544 | INT cx;
|
---|
545 | INT cy;
|
---|
546 | } SIZE, *PSIZE, *LPSIZE;
|
---|
547 |
|
---|
548 |
|
---|
549 | typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
|
---|
550 |
|
---|
551 | #define CONV_SIZE16TO32(s16,s32) \
|
---|
552 | ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy)
|
---|
553 | #define CONV_SIZE32TO16(s32,s16) \
|
---|
554 | ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy)
|
---|
555 |
|
---|
556 | /* The POINT structure */
|
---|
557 |
|
---|
558 | typedef struct
|
---|
559 | {
|
---|
560 | INT16 x;
|
---|
561 | INT16 y;
|
---|
562 | } POINT16, *PPOINT16, *LPPOINT16;
|
---|
563 |
|
---|
564 | typedef struct tagPOINT
|
---|
565 | {
|
---|
566 | LONG x;
|
---|
567 | LONG y;
|
---|
568 | } POINT, *PPOINT, *LPPOINT;
|
---|
569 |
|
---|
570 | typedef struct _POINTL
|
---|
571 | {
|
---|
572 | LONG x;
|
---|
573 | LONG y;
|
---|
574 | } POINTL;
|
---|
575 |
|
---|
576 | #define CONV_POINT16TO32(p16,p32) \
|
---|
577 | ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y)
|
---|
578 | #define CONV_POINT32TO16(p32,p16) \
|
---|
579 | ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
|
---|
580 |
|
---|
581 | #define MAKEPOINT(l) (*((POINT *)&(l)))
|
---|
582 |
|
---|
583 | #define MAKEPOINT16(l) (*((POINT16 *)&(l)))
|
---|
584 |
|
---|
585 | /* The POINTS structure */
|
---|
586 |
|
---|
587 | typedef struct tagPOINTS
|
---|
588 | {
|
---|
589 | SHORT x;
|
---|
590 | SHORT y;
|
---|
591 | } POINTS, *PPOINTS, *LPPOINTS;
|
---|
592 |
|
---|
593 |
|
---|
594 | #define MAKEPOINTS(l) (*((POINTS *)&(l)))
|
---|
595 |
|
---|
596 |
|
---|
597 | /* The RECT structure */
|
---|
598 |
|
---|
599 | typedef struct
|
---|
600 | {
|
---|
601 | INT16 left;
|
---|
602 | INT16 top;
|
---|
603 | INT16 right;
|
---|
604 | INT16 bottom;
|
---|
605 | } RECT16, *LPRECT16;
|
---|
606 |
|
---|
607 | typedef struct tagRECT
|
---|
608 | {
|
---|
609 | INT left;
|
---|
610 | INT top;
|
---|
611 | INT right;
|
---|
612 | INT bottom;
|
---|
613 | } RECT, *PRECT, *LPRECT;
|
---|
614 | typedef const RECT *LPCRECT;
|
---|
615 |
|
---|
616 |
|
---|
617 | typedef struct tagRECTL
|
---|
618 | {
|
---|
619 | LONG left;
|
---|
620 | LONG top;
|
---|
621 | LONG right;
|
---|
622 | LONG bottom;
|
---|
623 | } RECTL, *PRECTL, *LPRECTL;
|
---|
624 |
|
---|
625 | typedef const RECTL *LPCRECTL;
|
---|
626 |
|
---|
627 | #define CONV_RECT16TO32(r16,r32) \
|
---|
628 | ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \
|
---|
629 | (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom)
|
---|
630 | #define CONV_RECT32TO16(r32,r16) \
|
---|
631 | ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \
|
---|
632 | (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom)
|
---|
633 |
|
---|
634 | /*
|
---|
635 | * 8.9.99 DJR DECIMAL support
|
---|
636 | */
|
---|
637 | typedef struct tagDEC
|
---|
638 | {
|
---|
639 | USHORT wReserved;
|
---|
640 | union
|
---|
641 | {
|
---|
642 | struct
|
---|
643 | {
|
---|
644 | BYTE scale;
|
---|
645 | BYTE sign;
|
---|
646 | } a;
|
---|
647 | USHORT signscale;
|
---|
648 | } b;
|
---|
649 | ULONG Hi32;
|
---|
650 | union
|
---|
651 | {
|
---|
652 | struct
|
---|
653 | {
|
---|
654 | ULONG Lo32;
|
---|
655 | ULONG Mid32;
|
---|
656 | } c;
|
---|
657 | ULONGLONG_W Lo64;
|
---|
658 | } d;
|
---|
659 | } DECIMAL;
|
---|
660 |
|
---|
661 | #ifdef __cplusplus
|
---|
662 | }
|
---|
663 | #endif
|
---|
664 |
|
---|
665 | #endif /* __WINE_WINDEF_H */
|
---|