1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | /*++ |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | --*/ |
12 | |
13 | //////////////////////////////////////////////////////////////////////// |
14 | // Extensions to the usual posix header files |
15 | //////////////////////////////////////////////////////////////////////// |
16 | |
17 | #ifndef __PAL_MSTYPES_H__ |
18 | #define __PAL_MSTYPES_H__ |
19 | |
20 | #ifdef __cplusplus |
21 | extern "C" { |
22 | #endif |
23 | |
24 | //////////////////////////////////////////////////////////////////////// |
25 | // calling convention stuff |
26 | //////////////////////////////////////////////////////////////////////// |
27 | |
28 | |
29 | #ifdef __cplusplus |
30 | #define EXTERN_C extern "C" |
31 | #else |
32 | #define EXTERN_C |
33 | #endif // __cplusplus |
34 | |
35 | #ifndef _MSC_VER |
36 | |
37 | // Note: Win32-hosted GCC predefines __stdcall and __cdecl, but Unix- |
38 | // hosted GCC does not. |
39 | |
40 | #ifdef __i386__ |
41 | |
42 | #if !defined(__stdcall) |
43 | #define __stdcall __attribute__((stdcall)) |
44 | #endif |
45 | #if !defined(_stdcall) |
46 | #define _stdcall __stdcall |
47 | #endif |
48 | |
49 | #if !defined(__cdecl) |
50 | #define __cdecl __attribute__((cdecl)) |
51 | #endif |
52 | #if !defined(_cdecl) |
53 | #define _cdecl __cdecl |
54 | #endif |
55 | #if !defined(CDECL) |
56 | #define CDECL __cdecl |
57 | #endif |
58 | |
59 | |
60 | #else // !defined(__i386__) |
61 | |
62 | #define __stdcall |
63 | #define _stdcall |
64 | #define __cdecl |
65 | #define _cdecl |
66 | #define CDECL |
67 | |
68 | // On ARM __fastcall is ignored and causes a compile error |
69 | #if !defined(PAL_STDCPP_COMPAT) || defined(__arm__) |
70 | # undef __fastcall |
71 | # undef _fastcall |
72 | # define __fastcall |
73 | # define _fastcall |
74 | #endif // !defined(PAL_STDCPP_COMPAT) || defined(__arm__) |
75 | |
76 | #endif // !defined(__i386__) |
77 | |
78 | #define CALLBACK __cdecl |
79 | |
80 | #if !defined(_declspec) |
81 | #define _declspec(e) __declspec(e) |
82 | #endif |
83 | |
84 | #if defined(_VAC_) && defined(__cplusplus) |
85 | #define __inline inline |
86 | #endif |
87 | |
88 | #define __forceinline inline |
89 | |
90 | #endif // !_MSC_VER |
91 | |
92 | #ifdef _MSC_VER |
93 | |
94 | #if defined(PAL_IMPLEMENTATION) |
95 | #define PALIMPORT |
96 | #else |
97 | #define PALIMPORT __declspec(dllimport) |
98 | #endif |
99 | #define PAL_NORETURN __declspec(noreturn) |
100 | |
101 | #else |
102 | |
103 | #define PALIMPORT |
104 | #define PAL_NORETURN __attribute__((noreturn)) |
105 | |
106 | #endif |
107 | |
108 | #define PALAPI __cdecl |
109 | #define PALAPIV __cdecl |
110 | |
111 | //////////////////////////////////////////////////////////////////////// |
112 | // Type attribute stuff |
113 | //////////////////////////////////////////////////////////////////////// |
114 | |
115 | #define CONST const |
116 | #define IN |
117 | #define OUT |
118 | #define OPTIONAL |
119 | #define FAR |
120 | |
121 | #ifdef UNICODE |
122 | #define __TEXT(x) L##x |
123 | #else |
124 | #define __TEXT(x) x |
125 | #endif |
126 | #define TEXT(x) __TEXT(x) |
127 | |
128 | //////////////////////////////////////////////////////////////////////// |
129 | // Some special values |
130 | //////////////////////////////////////////////////////////////////////// |
131 | |
132 | #ifndef TRUE |
133 | #define TRUE 1 |
134 | #endif |
135 | |
136 | #ifndef FALSE |
137 | #define FALSE 0 |
138 | #endif |
139 | |
140 | //////////////////////////////////////////////////////////////////////// |
141 | // Misc. type helpers |
142 | //////////////////////////////////////////////////////////////////////// |
143 | |
144 | #ifdef _MSC_VER |
145 | |
146 | // MSVC's way of declaring large integer constants |
147 | // If you define these in one step, without the _HELPER macros, you |
148 | // get extra whitespace when composing these with other concatenating macros. |
149 | #define I64_HELPER(x) x ## i64 |
150 | #define I64(x) I64_HELPER(x) |
151 | |
152 | #define UI64_HELPER(x) x ## ui64 |
153 | #define UI64(x) UI64_HELPER(x) |
154 | |
155 | #else // _MSC_VER |
156 | |
157 | // GCC's way of declaring large integer constants |
158 | // If you define these in one step, without the _HELPER macros, you |
159 | // get extra whitespace when composing these with other concatenating macros. |
160 | #define I64_HELPER(x) x ## LL |
161 | #define I64(x) I64_HELPER(x) |
162 | |
163 | #define UI64_HELPER(x) x ## ULL |
164 | #define UI64(x) UI64_HELPER(x) |
165 | |
166 | #endif // _MSC_VER |
167 | |
168 | //////////////////////////////////////////////////////////////////////// |
169 | // Misc. types |
170 | //////////////////////////////////////////////////////////////////////// |
171 | |
172 | #ifndef _MSC_VER |
173 | |
174 | // A bunch of source files (e.g. most of the ndp tree) include pal.h |
175 | // but are written to be LLP64, not LP64. (LP64 => long = 64 bits |
176 | // LLP64 => longs = 32 bits, long long = 64 bits) |
177 | // |
178 | // To handle this difference, we #define long to be int (and thus 32 bits) when |
179 | // compiling those files. (See the bottom of this file or search for |
180 | // #define long to see where we do this.) |
181 | // |
182 | // But this fix is more complicated than it seems, because we also use the |
183 | // preprocessor to #define __int64 to long for LP64 architectures (__int64 |
184 | // isn't a builtin in gcc). We don't want __int64 to be an int (by cascading |
185 | // macro rules). So we play this little trick below where we add |
186 | // __cppmungestrip before "long", which is what we're really #defining __int64 |
187 | // to. The preprocessor sees __cppmungestriplong as something different than |
188 | // long, so it doesn't replace it with int. The during the cppmunge phase, we |
189 | // remove the __cppmungestrip part, leaving long for the compiler to see. |
190 | // |
191 | // Note that we can't just use a typedef to define __int64 as long before |
192 | // #defining long because typedefed types can't be signedness-agnostic (i.e. |
193 | // they must be either signed or unsigned) and we want to be able to use |
194 | // __int64 as though it were intrinsic |
195 | |
196 | #ifdef BIT64 |
197 | #define __int64 long |
198 | #else // BIT64 |
199 | #define __int64 long long |
200 | #endif // BIT64 |
201 | |
202 | #define __int32 int |
203 | #define __int16 short int |
204 | #define __int8 char // assumes char is signed |
205 | |
206 | #endif // _MSC_VER |
207 | |
208 | #ifndef PAL_STDCPP_COMPAT |
209 | // Defined in gnu's types.h. For non PAL_IMPLEMENTATION system |
210 | // includes are not included, so we need to define them. |
211 | #ifndef PAL_IMPLEMENTATION |
212 | |
213 | // OS X already defines these types in 64 bit |
214 | #if !defined(_TARGET_MAC64) |
215 | typedef __int64 int64_t; |
216 | typedef unsigned __int64 uint64_t; |
217 | typedef __int32 int32_t; |
218 | typedef unsigned __int32 uint32_t; |
219 | typedef __int16 int16_t; |
220 | typedef unsigned __int16 uint16_t; |
221 | typedef __int8 int8_t; |
222 | typedef unsigned __int8 uint8_t; |
223 | #endif |
224 | |
225 | #endif // PAL_IMPLEMENTATION |
226 | |
227 | #ifndef _MSC_VER |
228 | |
229 | #if _WIN64 |
230 | typedef long double LONG_DOUBLE; |
231 | #endif |
232 | |
233 | #endif // _MSC_VER |
234 | #endif // !PAL_STDCPP_COMPAT |
235 | |
236 | typedef void VOID; |
237 | |
238 | typedef int LONG; // NOTE: diff from windows.h, for LP64 compat |
239 | typedef unsigned int ULONG; // NOTE: diff from windows.h, for LP64 compat |
240 | |
241 | typedef __int64 LONGLONG; |
242 | typedef unsigned __int64 ULONGLONG; |
243 | typedef ULONGLONG DWORD64; |
244 | typedef DWORD64 *PDWORD64; |
245 | typedef LONGLONG *PLONG64; |
246 | typedef ULONGLONG *PULONG64; |
247 | typedef ULONGLONG *PULONGLONG; |
248 | typedef ULONG *PULONG; |
249 | typedef short SHORT; |
250 | typedef SHORT *PSHORT; |
251 | typedef unsigned short USHORT; |
252 | typedef USHORT *PUSHORT; |
253 | typedef unsigned char UCHAR; |
254 | typedef UCHAR *PUCHAR; |
255 | typedef char *PSZ; |
256 | typedef ULONGLONG DWORDLONG; |
257 | |
258 | typedef unsigned int DWORD; // NOTE: diff from windows.h, for LP64 compat |
259 | typedef unsigned int DWORD32, *PDWORD32; |
260 | |
261 | typedef int BOOL; |
262 | typedef unsigned char BYTE; |
263 | typedef unsigned short WORD; |
264 | typedef float FLOAT; |
265 | typedef double DOUBLE; |
266 | typedef BOOL *PBOOL; |
267 | typedef BOOL *LPBOOL; |
268 | typedef BYTE *PBYTE; |
269 | typedef BYTE *LPBYTE; |
270 | typedef const BYTE *LPCBYTE; |
271 | typedef int *PINT; |
272 | typedef int *LPINT; |
273 | typedef WORD *PWORD; |
274 | typedef WORD *LPWORD; |
275 | typedef LONG *LPLONG; |
276 | typedef LPLONG PLONG; |
277 | typedef DWORD *PDWORD; |
278 | typedef DWORD *LPDWORD; |
279 | typedef void *PVOID; |
280 | typedef void *LPVOID; |
281 | typedef CONST void *LPCVOID; |
282 | typedef int INT; |
283 | typedef unsigned int UINT; |
284 | typedef unsigned int *PUINT; |
285 | typedef BYTE BOOLEAN; |
286 | typedef BOOLEAN *PBOOLEAN; |
287 | |
288 | typedef unsigned __int8 UINT8; |
289 | typedef signed __int8 INT8; |
290 | typedef unsigned __int16 UINT16; |
291 | typedef signed __int16 INT16; |
292 | typedef unsigned __int32 UINT32, *PUINT32; |
293 | typedef signed __int32 INT32, *PINT32; |
294 | typedef unsigned __int64 UINT64, *PUINT64; |
295 | typedef signed __int64 INT64, *PINT64; |
296 | |
297 | typedef unsigned __int32 ULONG32, *PULONG32; |
298 | typedef signed __int32 LONG32, *PLONG32; |
299 | typedef unsigned __int64 ULONG64; |
300 | typedef signed __int64 LONG64; |
301 | |
302 | #if defined(_X86_) && _MSC_VER >= 1300 |
303 | #define _W64 __w64 |
304 | #else |
305 | #define _W64 |
306 | #endif |
307 | |
308 | #ifdef BIT64 |
309 | |
310 | #define _atoi64 (__int64)atoll |
311 | |
312 | typedef __int64 INT_PTR, *PINT_PTR; |
313 | typedef unsigned __int64 UINT_PTR, *PUINT_PTR; |
314 | typedef __int64 LONG_PTR, *PLONG_PTR; |
315 | typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; |
316 | typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR; |
317 | |
318 | /* maximum signed 64 bit value */ |
319 | #define LONG_PTR_MAX I64(9223372036854775807) |
320 | /* maximum unsigned 64 bit value */ |
321 | #define ULONG_PTR_MAX UI64(0xffffffffffffffff) |
322 | |
323 | #ifndef SIZE_MAX |
324 | #define SIZE_MAX _UI64_MAX |
325 | #endif |
326 | |
327 | #define __int3264 __int64 |
328 | |
329 | #if !defined(BIT64) |
330 | __inline |
331 | unsigned long |
332 | HandleToULong( |
333 | const void *h |
334 | ) |
335 | { |
336 | return((unsigned long) (ULONG_PTR) h ); |
337 | } |
338 | |
339 | __inline |
340 | long |
341 | HandleToLong( |
342 | const void *h |
343 | ) |
344 | { |
345 | return((long) (LONG_PTR) h ); |
346 | } |
347 | |
348 | __inline |
349 | void * |
350 | ULongToHandle( |
351 | const unsigned long h |
352 | ) |
353 | { |
354 | return((void *) (UINT_PTR) h ); |
355 | } |
356 | |
357 | |
358 | __inline |
359 | void * |
360 | LongToHandle( |
361 | const long h |
362 | ) |
363 | { |
364 | return((void *) (INT_PTR) h ); |
365 | } |
366 | |
367 | |
368 | __inline |
369 | unsigned long |
370 | PtrToUlong( |
371 | const void *p |
372 | ) |
373 | { |
374 | return((unsigned long) (ULONG_PTR) p ); |
375 | } |
376 | |
377 | __inline |
378 | unsigned int |
379 | PtrToUint( |
380 | const void *p |
381 | ) |
382 | { |
383 | return((unsigned int) (UINT_PTR) p ); |
384 | } |
385 | |
386 | __inline |
387 | unsigned short |
388 | PtrToUshort( |
389 | const void *p |
390 | ) |
391 | { |
392 | return((unsigned short) (unsigned long) (ULONG_PTR) p ); |
393 | } |
394 | |
395 | __inline |
396 | long |
397 | PtrToLong( |
398 | const void *p |
399 | ) |
400 | { |
401 | return((long) (LONG_PTR) p ); |
402 | } |
403 | |
404 | __inline |
405 | int |
406 | PtrToInt( |
407 | const void *p |
408 | ) |
409 | { |
410 | return((int) (INT_PTR) p ); |
411 | } |
412 | |
413 | __inline |
414 | short |
415 | PtrToShort( |
416 | const void *p |
417 | ) |
418 | { |
419 | return((short) (long) (LONG_PTR) p ); |
420 | } |
421 | |
422 | __inline |
423 | void * |
424 | IntToPtr( |
425 | const int i |
426 | ) |
427 | // Caution: IntToPtr() sign-extends the int value. |
428 | { |
429 | return( (void *)(INT_PTR)i ); |
430 | } |
431 | |
432 | __inline |
433 | void * |
434 | UIntToPtr( |
435 | const unsigned int ui |
436 | ) |
437 | // Caution: UIntToPtr() zero-extends the unsigned int value. |
438 | { |
439 | return( (void *)(UINT_PTR)ui ); |
440 | } |
441 | |
442 | __inline |
443 | void * |
444 | LongToPtr( |
445 | const long l |
446 | ) |
447 | // Caution: LongToPtr() sign-extends the long value. |
448 | { |
449 | return( (void *)(LONG_PTR)l ); |
450 | } |
451 | |
452 | __inline |
453 | void * |
454 | ULongToPtr( |
455 | const unsigned long ul |
456 | ) |
457 | // Caution: ULongToPtr() zero-extends the unsigned long value. |
458 | { |
459 | return( (void *)(ULONG_PTR)ul ); |
460 | } |
461 | |
462 | __inline |
463 | void * |
464 | ShortToPtr( |
465 | const short s |
466 | ) |
467 | // Caution: ShortToPtr() sign-extends the short value. |
468 | { |
469 | return( (void *)(INT_PTR)s ); |
470 | } |
471 | |
472 | __inline |
473 | void * |
474 | UShortToPtr( |
475 | const unsigned short us |
476 | ) |
477 | // Caution: UShortToPtr() zero-extends the unsigned short value. |
478 | { |
479 | return( (void *)(UINT_PTR)us ); |
480 | } |
481 | |
482 | #else // !defined(BIT64) |
483 | #define HandleToULong( h ) ((ULONG)(ULONG_PTR)(h) ) |
484 | #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) ) |
485 | #define ULongToHandle( ul ) ((HANDLE)(ULONG_PTR) (ul) ) |
486 | #define LongToHandle( h ) ((HANDLE)(LONG_PTR) (h) ) |
487 | #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) ) |
488 | #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) ) |
489 | #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) ) |
490 | #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) |
491 | #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) ) |
492 | #define PtrToShort( p ) ((short)(LONG_PTR)(p) ) |
493 | #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)(i))) |
494 | #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)(ui))) |
495 | #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)(l))) |
496 | #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)(ul))) |
497 | #define ShortToPtr( s ) ((VOID *)(INT_PTR)((short)(s))) |
498 | #define UShortToPtr( us ) ((VOID *)(UINT_PTR)((unsigned short)(s))) |
499 | #endif // !defined(BIT64) |
500 | |
501 | |
502 | |
503 | #else |
504 | |
505 | typedef _W64 __int32 INT_PTR; |
506 | typedef _W64 unsigned __int32 UINT_PTR; |
507 | |
508 | typedef _W64 __int32 LONG_PTR; |
509 | typedef _W64 unsigned __int32 ULONG_PTR, *PULONG_PTR; |
510 | typedef _W64 unsigned __int32 DWORD_PTR, *PDWORD_PTR; |
511 | |
512 | /* maximum signed 32 bit value */ |
513 | #define LONG_PTR_MAX 2147483647L |
514 | /* maximum unsigned 32 bit value */ |
515 | #define ULONG_PTR_MAX 0xffffffffUL |
516 | |
517 | #ifndef SIZE_MAX |
518 | #define SIZE_MAX UINT_MAX |
519 | #endif |
520 | |
521 | #define __int3264 __int32 |
522 | |
523 | #define HandleToULong( h ) ((ULONG)(ULONG_PTR)(h) ) |
524 | #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) ) |
525 | #define ULongToHandle( ul ) ((HANDLE)(ULONG_PTR) (ul) ) |
526 | #define LongToHandle( h ) ((HANDLE)(LONG_PTR) (h) ) |
527 | #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) ) |
528 | #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) ) |
529 | #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) ) |
530 | #define PtrToInt( p ) ((INT)(INT_PTR) (p) ) |
531 | #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) ) |
532 | #define PtrToShort( p ) ((short)(LONG_PTR)(p) ) |
533 | #define IntToPtr( i ) ((VOID *)(INT_PTR)((int)i)) |
534 | #define UIntToPtr( ui ) ((VOID *)(UINT_PTR)((unsigned int)ui)) |
535 | #define LongToPtr( l ) ((VOID *)(LONG_PTR)((long)l)) |
536 | #define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)ul)) |
537 | #define ShortToPtr( s ) ((VOID *)(INT_PTR)((short)s)) |
538 | #define UShortToPtr( us ) ((VOID *)(UINT_PTR)((unsigned short)s)) |
539 | |
540 | #endif |
541 | |
542 | #define HandleToUlong(h) HandleToULong(h) |
543 | #define UlongToHandle(ul) ULongToHandle(ul) |
544 | #define UlongToPtr(ul) ULongToPtr(ul) |
545 | #define UintToPtr(ui) UIntToPtr(ui) |
546 | |
547 | typedef ULONG_PTR SIZE_T, *PSIZE_T; |
548 | typedef LONG_PTR SSIZE_T, *PSSIZE_T; |
549 | |
550 | #ifndef SIZE_T_MAX |
551 | #define SIZE_T_MAX ULONG_PTR_MAX |
552 | #endif // SIZE_T_MAX |
553 | |
554 | #ifndef SSIZE_T_MAX |
555 | #define SSIZE_T_MAX LONG_PTR_MAX |
556 | #endif |
557 | |
558 | #ifndef SSIZE_T_MIN |
559 | #define SSIZE_T_MIN I64(0x8000000000000000) |
560 | #endif |
561 | |
562 | #ifndef PAL_STDCPP_COMPAT |
563 | #if defined(__APPLE_CC__) || defined(__linux__) |
564 | #ifdef BIT64 |
565 | typedef unsigned long size_t; |
566 | typedef long ptrdiff_t; |
567 | #else // !BIT64 |
568 | typedef unsigned int size_t; |
569 | typedef int ptrdiff_t; |
570 | #endif // !BIT64 |
571 | #else |
572 | typedef ULONG_PTR size_t; |
573 | typedef LONG_PTR ptrdiff_t; |
574 | #endif |
575 | #endif // !PAL_STDCPP_COMPAT |
576 | #define _SIZE_T_DEFINED |
577 | |
578 | typedef LONG_PTR LPARAM; |
579 | |
580 | #define _PTRDIFF_T_DEFINED |
581 | #ifdef _MINGW_ |
582 | // We need to define _PTRDIFF_T to make sure ptrdiff_t doesn't get defined |
583 | // again by system headers - but only for MinGW. |
584 | #define _PTRDIFF_T |
585 | #endif |
586 | |
587 | #ifdef PAL_STDCPP_COMPAT |
588 | |
589 | typedef char16_t WCHAR; |
590 | |
591 | #else // PAL_STDCPP_COMPAT |
592 | |
593 | typedef wchar_t WCHAR; |
594 | #if defined(__linux__) |
595 | #ifdef BIT64 |
596 | typedef long int intptr_t; |
597 | typedef unsigned long int uintptr_t; |
598 | #else // !BIT64 |
599 | typedef int intptr_t; |
600 | typedef unsigned int uintptr_t; |
601 | #endif // !BIT64 |
602 | #else |
603 | typedef INT_PTR intptr_t; |
604 | typedef UINT_PTR uintptr_t; |
605 | #endif |
606 | |
607 | #endif // PAL_STDCPP_COMPAT |
608 | |
609 | #define _INTPTR_T_DEFINED |
610 | #define _UINTPTR_T_DEFINED |
611 | |
612 | typedef DWORD LCID; |
613 | typedef PDWORD PLCID; |
614 | typedef WORD LANGID; |
615 | |
616 | typedef DWORD LCTYPE; |
617 | |
618 | typedef WCHAR *PWCHAR; |
619 | typedef WCHAR *LPWCH, *PWCH; |
620 | typedef CONST WCHAR *LPCWCH, *PCWCH; |
621 | typedef WCHAR *NWPSTR; |
622 | typedef WCHAR *LPWSTR, *PWSTR; |
623 | |
624 | typedef CONST WCHAR *LPCWSTR, *PCWSTR; |
625 | |
626 | typedef char CHAR; |
627 | typedef CHAR *PCHAR; |
628 | typedef CHAR *LPCH, *PCH; |
629 | typedef CONST CHAR *LPCCH, *PCCH; |
630 | typedef CHAR *NPSTR; |
631 | typedef CHAR *LPSTR, *PSTR; |
632 | typedef CONST CHAR *LPCSTR, *PCSTR; |
633 | |
634 | #ifdef UNICODE |
635 | typedef WCHAR TCHAR; |
636 | typedef WCHAR _TCHAR; |
637 | #else |
638 | typedef CHAR TCHAR; |
639 | typedef CHAR _TCHAR; |
640 | #endif |
641 | typedef TCHAR *PTCHAR; |
642 | typedef TCHAR *LPTSTR, *PTSTR; |
643 | typedef CONST TCHAR *LPCTSTR; |
644 | |
645 | #define MAKEWORD(a, b) ((WORD)(((BYTE)((DWORD_PTR)(a) & 0xff)) | ((WORD)((BYTE)((DWORD_PTR)(b) & 0xff))) << 8)) |
646 | #define MAKELONG(a, b) ((LONG)(((WORD)((DWORD_PTR)(a) & 0xffff)) | ((DWORD)((WORD)((DWORD_PTR)(b) & 0xffff))) << 16)) |
647 | #define LOWORD(l) ((WORD)((DWORD_PTR)(l) & 0xffff)) |
648 | #define HIWORD(l) ((WORD)((DWORD_PTR)(l) >> 16)) |
649 | #define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff)) |
650 | #define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8)) |
651 | |
652 | typedef VOID *HANDLE; |
653 | typedef HANDLE HWND; |
654 | typedef struct __PAL_RemoteHandle__ { HANDLE h; } *RHANDLE; |
655 | typedef HANDLE *PHANDLE; |
656 | typedef HANDLE *LPHANDLE; |
657 | #define INVALID_HANDLE_VALUE ((VOID *)(-1)) |
658 | #define INVALID_FILE_SIZE ((DWORD)0xFFFFFFFF) |
659 | #define INVALID_FILE_ATTRIBUTES ((DWORD) -1) |
660 | typedef HANDLE HMODULE; |
661 | typedef HANDLE HINSTANCE; |
662 | typedef HANDLE HGLOBAL; |
663 | typedef HANDLE HLOCAL; |
664 | typedef HANDLE HRSRC; |
665 | |
666 | typedef LONG HRESULT; |
667 | typedef LONG NTSTATUS; |
668 | |
669 | typedef union _LARGE_INTEGER { |
670 | struct { |
671 | #if BIGENDIAN |
672 | LONG HighPart; |
673 | DWORD LowPart; |
674 | #else |
675 | DWORD LowPart; |
676 | LONG HighPart; |
677 | #endif |
678 | } u; |
679 | LONGLONG QuadPart; |
680 | } LARGE_INTEGER, *PLARGE_INTEGER; |
681 | |
682 | #ifndef GUID_DEFINED |
683 | typedef struct _GUID { |
684 | ULONG Data1; // NOTE: diff from Win32, for LP64 |
685 | USHORT Data2; |
686 | USHORT Data3; |
687 | UCHAR Data4[ 8 ]; |
688 | } GUID; |
689 | typedef const GUID *LPCGUID; |
690 | #define GUID_DEFINED |
691 | #endif // !GUID_DEFINED |
692 | |
693 | typedef struct _FILETIME { |
694 | DWORD dwLowDateTime; |
695 | DWORD dwHighDateTime; |
696 | } FILETIME, *PFILETIME, *LPFILETIME; |
697 | |
698 | /* Code Page Default Values */ |
699 | #define CP_ACP 0 /* default to ANSI code page */ |
700 | #define CP_OEMCP 1 /* default to OEM code page */ |
701 | #define CP_MACCP 2 /* default to MAC code page */ |
702 | #define CP_THREAD_ACP 3 /* current thread's ANSI code page */ |
703 | #define CP_WINUNICODE 1200 |
704 | #define CP_UNICODE 1200 /* Unicode */ |
705 | #define CP_UNICODESWAP 1201 /* Unicode Big-Endian */ |
706 | #define CP_UTF7 65000 /* UTF-7 translation */ |
707 | #define CP_UTF8 65001 /* UTF-8 translation */ |
708 | |
709 | typedef PVOID PSID; |
710 | |
711 | #ifdef __cplusplus |
712 | } |
713 | #endif |
714 | |
715 | #endif // __PAL_MSTYPES_H__ |
716 | |