Merge amd64 NDK from amd64 branch:
[reactos.git] / reactos / include / psdk / basetsd.h
1 #ifndef _BASETSD_H
2 #define _BASETSD_H
3
4 #if !defined(__ROS_LONG64__)
5 #ifdef __WINESRC__
6 #define __ROS_LONG64__
7 #endif
8 #endif
9
10 #ifdef __GNUC__
11 #ifndef __int64
12 #define __int64 long long
13 #endif
14 #endif
15
16 #if defined(_WIN64)
17 #define __int3264 __int64
18 #define ADDRESS_TAG_BIT 0x40000000000UI64
19 #else /* !_WIN64 */
20 #define __int3264 __int32
21 #define ADDRESS_TAG_BIT 0x80000000UL
22 #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) )
23 #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) )
24 #define ULongToHandle( h) ((HANDLE)(ULONG_PTR) (h))
25 #define LongToHandle( h) ((HANDLE)(LONG_PTR) (h))
26 #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) )
27 #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) )
28 #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) )
29 #define PtrToInt( p ) ((INT)(INT_PTR) (p) )
30 #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) )
31 #define PtrToShort( p ) ((short)(LONG_PTR)(p) )
32 #define IntToPtr( i ) ((VOID*)(INT_PTR)((int)i))
33 #define UIntToPtr( ui ) ((VOID*)(UINT_PTR)((unsigned int)ui))
34 #define LongToPtr( l ) ((VOID*)(LONG_PTR)((long)l))
35 #define ULongToPtr( ul ) ((VOID*)(ULONG_PTR)((unsigned long)ul))
36 #endif /* !_WIN64 */
37
38 #define UlongToHandle(ul) ULongToHandle(ul)
39 #define UlongToPtr(ul) ULongToPtr(ul)
40 #define UintToPtr(ui) UIntToPtr(ui)
41 #define MAXUINT_PTR (~((UINT_PTR)0))
42 #define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1))
43 #define MININT_PTR (~MAXINT_PTR)
44 #define MAXULONG_PTR (~((ULONG_PTR)0))
45 #define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1))
46 #define MINLONG_PTR (~MAXLONG_PTR)
47 #define MAXUHALF_PTR ((UHALF_PTR)~0)
48 #define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1))
49 #define MINHALF_PTR (~MAXHALF_PTR)
50
51 #define MAXUINT ((UINT)~((UINT)0))
52
53 #define MAXULONGLONG ((ULONGLONG)~((ULONGLONG)0))
54
55 #ifndef RC_INVOKED
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 typedef int LONG32, *PLONG32;
60 #ifndef XFree86Server
61 typedef int INT32, *PINT32;
62 #endif /* ndef XFree86Server */
63 typedef unsigned int ULONG32, *PULONG32;
64 typedef unsigned int DWORD32, *PDWORD32;
65 typedef unsigned int UINT32, *PUINT32;
66
67 #if defined(_WIN64)
68 typedef __int64 INT_PTR, *PINT_PTR;
69 typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
70 typedef __int64 LONG_PTR, *PLONG_PTR;
71 typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
72 typedef unsigned __int64 HANDLE_PTR;
73 typedef unsigned int UHALF_PTR, *PUHALF_PTR;
74 typedef int HALF_PTR, *PHALF_PTR;
75
76 #if !defined(__midl) && !defined(__WIDL__)
77 static inline unsigned long HandleToUlong(const void* h )
78 { return((unsigned long)(ULONG_PTR) h ); }
79 static inline long HandleToLong( const void* h )
80 { return((long)(LONG_PTR) h ); }
81 static inline void* ULongToHandle( const long h )
82 { return((void*) (UINT_PTR) h ); }
83 static inline void* LongToHandle( const long h )
84 { return((void*) (INT_PTR) h ); }
85 static inline unsigned long PtrToUlong( const void* p)
86 { return((unsigned long)(ULONG_PTR) p ); }
87 static inline unsigned int PtrToUint( const void* p )
88 { return((unsigned int)(UINT_PTR) p ); }
89 static inline unsigned short PtrToUshort( const void* p )
90 { return((unsigned short)(ULONG_PTR) p ); }
91 static inline long PtrToLong( const void* p )
92 { return((long)(LONG_PTR) p ); }
93 static inline int PtrToInt( const void* p )
94 { return((int)(INT_PTR) p ); }
95 static inline short PtrToShort( const void* p )
96 { return((short)(INT_PTR) p ); }
97 static inline void* IntToPtr( const int i )
98 { return( (void*)(INT_PTR)i ); }
99 static inline void* UIntToPtr(const unsigned int ui)
100 { return( (void*)(UINT_PTR)ui ); }
101 static inline void* LongToPtr( const long l )
102 { return( (void*)(LONG_PTR)l ); }
103 static inline void* ULongToPtr( const unsigned long ul )
104 { return( (void*)(ULONG_PTR)ul ); }
105 #endif /* !__midl */
106 #else /* !_WIN64 */
107 #if !defined(__ROS_LONG64__)
108 typedef int INT_PTR, *PINT_PTR;
109 typedef unsigned int UINT_PTR, *PUINT_PTR;
110 #else
111 typedef long INT_PTR, *PINT_PTR;
112 typedef unsigned long UINT_PTR, *PUINT_PTR;
113 #endif
114
115 #ifndef LONG_PTR_DEFINED
116 #define LONG_PTR_DEFINED
117 typedef long LONG_PTR, *PLONG_PTR;
118 typedef unsigned long ULONG_PTR, *PULONG_PTR;
119 #endif
120
121 typedef unsigned short UHALF_PTR, *PUHALF_PTR;
122 typedef short HALF_PTR, *PHALF_PTR;
123
124 #ifndef HANDLE_PTR_DEFINED
125 #define HANDLE_PTR_DEFINED
126 typedef unsigned long HANDLE_PTR;
127 #endif
128
129 #endif /* !_WIN64 */
130
131 typedef ULONG_PTR SIZE_T, *PSIZE_T;
132 typedef LONG_PTR SSIZE_T, *PSSIZE_T;
133 typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
134 typedef __int64 LONG64, *PLONG64;
135 typedef __int64 INT64, *PINT64;
136 typedef unsigned __int64 ULONG64, *PULONG64;
137 typedef unsigned __int64 DWORD64, *PDWORD64;
138 typedef unsigned __int64 UINT64, *PUINT64;
139
140 typedef signed char INT8, *PINT8;
141 typedef unsigned char UINT8, *PUINT8;
142 typedef signed short INT16, *PINT16;
143 typedef unsigned short UINT16, *PUINT16;
144
145 typedef ULONG_PTR KAFFINITY;
146 typedef KAFFINITY *PKAFFINITY;
147
148 #ifdef __cplusplus
149 }
150 #endif
151 #endif /* !RC_INVOKED */
152
153 #endif /* _BASETSD_H */