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