Warning killing commit
[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 UlongToPtr(ul) ULongToPtr(ul)
39 #define UintToPtr(ui) UIntToPtr(ui)
40 #define MAXUINT_PTR (~((UINT_PTR)0))
41 #define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1))
42 #define MININT_PTR (~MAXINT_PTR)
43 #define MAXULONG_PTR (~((ULONG_PTR)0))
44 #define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1))
45 #define MINLONG_PTR (~MAXLONG_PTR)
46 #define MAXUHALF_PTR ((UHALF_PTR)~0)
47 #define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1))
48 #define MINHALF_PTR (~MAXHALF_PTR)
49
50 #ifndef RC_INVOKED
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 typedef int LONG32, *PLONG32;
55 #ifndef XFree86Server
56 typedef int INT32, *PINT32;
57 #endif /* ndef XFree86Server */
58 typedef unsigned int ULONG32, *PULONG32;
59 typedef unsigned int DWORD32, *PDWORD32;
60 typedef unsigned int UINT32, *PUINT32;
61
62 #if defined(_WIN64)
63 typedef __int64 INT_PTR, *PINT_PTR;
64 typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
65 typedef __int64 LONG_PTR, *PLONG_PTR;
66 typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
67 typedef unsigned __int64 HANDLE_PTR;
68 typedef unsigned int UHALF_PTR, *PUHALF_PTR;
69 typedef int HALF_PTR, *PHALF_PTR;
70
71 #if !defined(__midl) && !defined(__WIDL__)
72 static inline unsigned long HandleToUlong(const void* h )
73 { return((unsigned long)(ULONG_PTR) h ); }
74 static inline long HandleToLong( const void* h )
75 { return((long)(LONG_PTR) h ); }
76 static inline void* ULongToHandle( const long h )
77 { return((void*) (UINT_PTR) h ); }
78 static inline void* LongToHandle( const long h )
79 { return((void*) (INT_PTR) h ); }
80 static inline unsigned long PtrToUlong( const void* p)
81 { return((unsigned long)(ULONG_PTR) p ); }
82 static inline unsigned int PtrToUint( const void* p )
83 { return((unsigned int)(UINT_PTR) p ); }
84 static inline unsigned short PtrToUshort( const void* p )
85 { return((unsigned short)(ULONG_PTR) p ); }
86 static inline long PtrToLong( const void* p )
87 { return((long)(LONG_PTR) p ); }
88 static inline int PtrToInt( const void* p )
89 { return((int)(INT_PTR) p ); }
90 static inline short PtrToShort( const void* p )
91 { return((short)(INT_PTR) p ); }
92 static inline void* IntToPtr( const int i )
93 { return( (void*)(INT_PTR)i ); }
94 static inline void* UIntToPtr(const unsigned int ui)
95 { return( (void*)(UINT_PTR)ui ); }
96 static inline void* LongToPtr( const long l )
97 { return( (void*)(LONG_PTR)l ); }
98 static inline void* ULongToPtr( const unsigned long ul )
99 { return( (void*)(ULONG_PTR)ul ); }
100 #endif /* !__midl */
101 #else /* !_WIN64 */
102 #if !defined(__ROS_LONG64__)
103 typedef int INT_PTR, *PINT_PTR;
104 typedef unsigned int UINT_PTR, *PUINT_PTR;
105 #else
106 typedef long INT_PTR, *PINT_PTR;
107 typedef unsigned long UINT_PTR, *PUINT_PTR;
108 #endif
109
110 #ifndef LONG_PTR_DEFINED
111 #define LONG_PTR_DEFINED
112 typedef long LONG_PTR, *PLONG_PTR;
113 typedef unsigned long ULONG_PTR, *PULONG_PTR;
114 #endif
115
116 typedef unsigned short UHALF_PTR, *PUHALF_PTR;
117 typedef short HALF_PTR, *PHALF_PTR;
118
119 #ifndef HANDLE_PTR_DEFINED
120 #define HANDLE_PTR_DEFINED
121 typedef unsigned long HANDLE_PTR;
122 #endif
123
124 #endif /* !_WIN64 */
125
126 typedef ULONG_PTR SIZE_T, *PSIZE_T;
127 typedef LONG_PTR SSIZE_T, *PSSIZE_T;
128 typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
129 typedef __int64 LONG64, *PLONG64;
130 typedef __int64 INT64, *PINT64;
131 typedef unsigned __int64 ULONG64, *PULONG64;
132 typedef unsigned __int64 DWORD64, *PDWORD64;
133 typedef unsigned __int64 UINT64, *PUINT64;
134
135 typedef signed char INT8, *PINT8;
136 typedef unsigned char UINT8, *PUINT8;
137 typedef signed short INT16, *PINT16;
138 typedef unsigned short UINT16, *PUINT16;
139
140 typedef ULONG_PTR KAFFINITY;
141 typedef KAFFINITY *PKAFFINITY;
142
143 #ifdef __cplusplus
144 }
145 #endif
146 #endif /* !RC_INVOKED */
147
148 #endif /* _BASETSD_H */