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