ReactOS  r76032
basetsd.h
Go to the documentation of this file.
1 #ifndef _BASETSD_H_
2 #define _BASETSD_H_
3 #pragma once
4 
5 #ifdef __GNUC__
6 #include <msvctarget.h>
7 #endif
8 
9 #if defined(__LP64__) || (!defined(_M_AMD64) && defined(__WINESRC__))
10 #if !defined(__ROS_LONG64__)
11 #define __ROS_LONG64__
12 #endif
13 #endif
14 
15 #ifdef __GNUC__
16 #ifndef __int64
17 #define __int64 long long
18 #endif
19 #endif
20 
21 #if defined(_MSC_VER) && (_MSC_VER < 1300)
22 #error Old MSVC compiler version.
23 #endif
24 
25 #ifdef _MAC
26 #error Not supported.
27 #endif
28 
29 #if defined(_MSC_VER) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
30  #define POINTER_64 __ptr64
31  #if defined(_WIN64)
32  #define POINTER_32 __ptr32
33  #else
34  #define POINTER_32
35  #endif
36 #else
37  #define POINTER_64
38  #define POINTER_32
39 #endif /* defined(_MSC_VER) && !defined(MIDL_PASS) && !defined(RC_INVOKED) */
40 
41 #if defined(_M_MRX000) || defined(_M_AMD64) || defined(_M_IA64)
42  typedef unsigned __int64 POINTER_64_INT;
43 #else
44  typedef unsigned long POINTER_64_INT;
45 #endif
46 
47 #if defined(_IA64_) || defined(_AMD64_)
48  #define FIRMWARE_PTR
49 #else
50  #define FIRMWARE_PTR POINTER_32
51 #endif
52 
53 #if 0 /* Not supported yet */
54 #define POINTER_SIGNED __sptr
55 #define POINTER_UNSIGNED __uptr
56 #else
57 #define POINTER_SIGNED
58 #define POINTER_UNSIGNED
59 #endif
60 
61 #define SPOINTER_32 POINTER_SIGNED POINTER_32
62 #define UPOINTER_32 POINTER_UNSIGNED POINTER_32
63 
64 #if defined(_WIN64)
65 #define __int3264 __int64
66 typedef __int64 SHANDLE_PTR;
67 typedef unsigned __int64 HANDLE_PTR;
68 typedef unsigned int UHALF_PTR, *PUHALF_PTR;
69 typedef int HALF_PTR, *PHALF_PTR;
70 #define ADDRESS_TAG_BIT 0x40000000000UI64
71 #else /* !_WIN64 */
72 #define __int3264 __int32
73 #define ADDRESS_TAG_BIT 0x80000000UL
74 typedef unsigned short UHALF_PTR, *PUHALF_PTR;
75 typedef short HALF_PTR, *PHALF_PTR;
76 typedef long SHANDLE_PTR;
77 typedef unsigned long HANDLE_PTR;
78 #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) )
79 #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) )
80 #define ULongToHandle( h) ((HANDLE)(ULONG_PTR) (h))
81 #define LongToHandle( h) ((HANDLE)(LONG_PTR) (h))
82 #define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) )
83 #define PtrToLong( p ) ((LONG)(LONG_PTR) (p) )
84 #define PtrToUint( p ) ((UINT)(UINT_PTR) (p) )
85 #define PtrToInt( p ) ((INT)(INT_PTR) (p) )
86 #define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) )
87 #define PtrToShort( p ) ((short)(LONG_PTR)(p) )
88 #define IntToPtr( i ) ((VOID*)(INT_PTR)((int)i))
89 #define UIntToPtr( ui ) ((VOID*)(UINT_PTR)((unsigned int)ui))
90 #define LongToPtr( l ) ((VOID*)(LONG_PTR)((long)l))
91 #define ULongToPtr( ul ) ((VOID*)(ULONG_PTR)((unsigned long)ul))
92 #endif /* !_WIN64 */
93 
94 #define HandleToULong(h) HandleToUlong(h)
95 
96 #define UlongToHandle(ul) ULongToHandle(ul)
97 #define UlongToPtr(ul) ULongToPtr(ul)
98 #define UintToPtr(ui) UIntToPtr(ui)
99 #define MAXUINT_PTR (~((UINT_PTR)0))
100 #define MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1))
101 #define MININT_PTR (~MAXINT_PTR)
102 #define MAXULONG_PTR (~((ULONG_PTR)0))
103 #define MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1))
104 #define MINLONG_PTR (~MAXLONG_PTR)
105 #define MAXUHALF_PTR ((UHALF_PTR)~0)
106 #define MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1))
107 #define MINHALF_PTR (~MAXHALF_PTR)
108 
109 #if _WIN32_WINNT >= 0x0600
110 
111 #define MAXUINT ((UINT)~((UINT)0))
112 #define MAXULONGLONG ((ULONGLONG)~((ULONGLONG)0))
113 
114 #endif
115 
116 #ifndef RC_INVOKED
117 #ifdef __cplusplus
118 extern "C" {
119 #endif
120 typedef int LONG32, *PLONG32;
121 #ifndef XFree86Server
122 typedef int INT32, *PINT32;
123 #endif /* ndef XFree86Server */
124 typedef unsigned int ULONG32, *PULONG32;
125 typedef unsigned int DWORD32, *PDWORD32;
126 typedef unsigned int UINT32, *PUINT32;
127 
128 #if defined(_WIN64)
129 typedef __int64 INT_PTR, *PINT_PTR;
130 typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
131 typedef __int64 LONG_PTR, *PLONG_PTR;
132 typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
133 
134 #if !defined(__midl) && !defined(__WIDL__)
135 static inline unsigned long HandleToUlong(const void* h )
136  { return((unsigned long)(ULONG_PTR) h ); }
137 static inline long HandleToLong( const void* h )
138  { return((long)(LONG_PTR) h ); }
139 static inline void* ULongToHandle( const long h )
140  { return((void*) (UINT_PTR) h ); }
141 static inline void* LongToHandle( const long h )
142  { return((void*) (INT_PTR) h ); }
143 static inline unsigned long PtrToUlong( const void* p)
144  { return((unsigned long)(ULONG_PTR) p ); }
145 static inline unsigned int PtrToUint( const void* p )
146  { return((unsigned int)(UINT_PTR) p ); }
147 static inline unsigned short PtrToUshort( const void* p )
148  { return((unsigned short)(ULONG_PTR) p ); }
149 static inline long PtrToLong( const void* p )
150  { return((long)(LONG_PTR) p ); }
151 static inline int PtrToInt( const void* p )
152  { return((int)(INT_PTR) p ); }
153 static inline short PtrToShort( const void* p )
154  { return((short)(INT_PTR) p ); }
155 static inline void* IntToPtr( const int i )
156  { return( (void*)(INT_PTR)i ); }
157 static inline void* UIntToPtr(const unsigned int ui)
158  { return( (void*)(UINT_PTR)ui ); }
159 static inline void* LongToPtr( const long l )
160  { return( (void*)(LONG_PTR)l ); }
161 static inline void* ULongToPtr( const unsigned long ul )
162  { return( (void*)(ULONG_PTR)ul ); }
163 #endif /* !__midl */
164 #else /* !_WIN64 */
165 #if !defined(__ROS_LONG64__)
166 typedef int INT_PTR, *PINT_PTR;
167 typedef unsigned int UINT_PTR, *PUINT_PTR;
168 #else
169 typedef long INT_PTR, *PINT_PTR;
170 typedef unsigned long UINT_PTR, *PUINT_PTR;
171 #endif
172 
173 #ifndef LONG_PTR_DEFINED
174 #define LONG_PTR_DEFINED
175  typedef long LONG_PTR, *PLONG_PTR;
176  typedef unsigned long ULONG_PTR, *PULONG_PTR;
177 #endif
178 
179 #endif /* !_WIN64 */
180 
181 typedef ULONG_PTR SIZE_T, *PSIZE_T;
182 typedef LONG_PTR SSIZE_T, *PSSIZE_T;
183 typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
185 typedef __int64 INT64, *PINT64;
186 typedef unsigned __int64 ULONG64, *PULONG64;
187 typedef unsigned __int64 DWORD64, *PDWORD64;
188 typedef unsigned __int64 UINT64, *PUINT64;
189 
190 typedef signed char INT8, *PINT8;
191 typedef unsigned char UINT8, *PUINT8;
192 typedef signed short INT16, *PINT16;
193 typedef unsigned short UINT16, *PUINT16;
194 
195 typedef ULONG_PTR KAFFINITY;
196 typedef KAFFINITY *PKAFFINITY;
197 
198 #ifdef __cplusplus
199 }
200 #endif
201 #endif /* !RC_INVOKED */
202 
203 #endif /* _BASETSD_H_ */
unsigned int * PULONG32
Definition: basetsd.h:124
int * PINT_PTR
Definition: basetsd.h:166
unsigned long * PULONG_PTR
Definition: basetsd.h:176
#define ULongToHandle(h)
Definition: basetsd.h:80
#define PtrToUint(p)
Definition: basetsd.h:84
#define LongToPtr(l)
Definition: basetsd.h:90
#define ULongToPtr(ul)
Definition: basetsd.h:91
unsigned int ULONG32
Definition: basetsd.h:124
unsigned short UHALF_PTR
Definition: basetsd.h:74
unsigned int * PUINT32
Definition: basetsd.h:126
#define UIntToPtr(ui)
Definition: basetsd.h:89
signed short INT16
Definition: basetsd.h:192
LONG_PTR * PSSIZE_T
Definition: basetsd.h:182
#define PtrToLong(p)
Definition: basetsd.h:83
UINT ui
Definition: oleauto.h:49
#define PtrToShort(p)
Definition: basetsd.h:87
#define HandleToUlong(h)
Definition: basetsd.h:78
unsigned __int64 * PDWORD64
Definition: basetsd.h:187
short HALF_PTR
Definition: basetsd.h:75
LONG_PTR SSIZE_T
Definition: basetsd.h:182
int INT_PTR
Definition: basetsd.h:166
long LONG_PTR
Definition: basetsd.h:175
ULONG_PTR * PSIZE_T
Definition: basetsd.h:181
long SHANDLE_PTR
Definition: basetsd.h:76
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
int * PINT32
Definition: basetsd.h:122
long * PLONG_PTR
Definition: basetsd.h:175
GLenum GLclampf GLint i
Definition: glfuncs.h:14
unsigned short * PUINT16
Definition: basetsd.h:193
KAFFINITY * PKAFFINITY
Definition: basetsd.h:196
signed char * PINT8
Definition: basetsd.h:190
unsigned int * PDWORD32
Definition: basetsd.h:125
ULONG_PTR DWORD_PTR
Definition: basetsd.h:183
#define IntToPtr(i)
Definition: basetsd.h:88
#define PtrToUlong(p)
Definition: basetsd.h:82
int INT32
Definition: basetsd.h:122
r l[0]
Definition: byte_order.h:167
#define PtrToInt(p)
Definition: basetsd.h:85
signed short * PINT16
Definition: basetsd.h:192
unsigned char UINT8
Definition: basetsd.h:191
unsigned int UINT_PTR
Definition: basetsd.h:167
int * PLONG32
Definition: basetsd.h:120
#define PtrToUshort(p)
Definition: basetsd.h:86
ULONG_PTR * PDWORD_PTR
Definition: basetsd.h:183
ULONG_PTR KAFFINITY
Definition: basetsd.h:195
__int64 LONG64
Definition: basetsd.h:184
unsigned int UINT32
Definition: basetsd.h:126
unsigned long POINTER_64_INT
Definition: basetsd.h:44
#define LongToHandle(h)
Definition: basetsd.h:81
signed char INT8
Definition: basetsd.h:190
__int64 * PINT64
Definition: basetsd.h:185
unsigned __int64 DWORD64
Definition: basetsd.h:187
unsigned char * PUINT8
Definition: basetsd.h:191
unsigned long ULONG_PTR
Definition: basetsd.h:176
unsigned __int64 UINT64
Definition: basetsd.h:188
unsigned int DWORD32
Definition: basetsd.h:125
unsigned long HANDLE_PTR
Definition: basetsd.h:77
unsigned int * PUINT_PTR
Definition: basetsd.h:167
unsigned __int64 ULONG64
Definition: basetsd.h:186
unsigned short * PUHALF_PTR
Definition: basetsd.h:74
ULONG_PTR SIZE_T
Definition: basetsd.h:181
__int64 INT64
Definition: basetsd.h:185
unsigned __int64 * PULONG64
Definition: basetsd.h:186
GLfloat GLfloat p
Definition: glext.h:8902
unsigned short UINT16
Definition: basetsd.h:193
short * PHALF_PTR
Definition: basetsd.h:75
__int64 * PLONG64
Definition: basetsd.h:184
int LONG32
Definition: basetsd.h:120
unsigned __int64 * PUINT64
Definition: basetsd.h:188
#define __int64
Definition: basetyps.h:16
#define HandleToLong(h)
Definition: basetsd.h:79