1 | /**
|
---|
2 | * This file is part of the mingw-w64 runtime package.
|
---|
3 | * No warranty is given; refer to the file DISCLAIMER within this package.
|
---|
4 | */
|
---|
5 | #include <_mingw.h>
|
---|
6 |
|
---|
7 | #ifndef _BASETSD_H_
|
---|
8 | #define _BASETSD_H_
|
---|
9 |
|
---|
10 | #if (defined (__x86_64__) || defined (__ia64__)) && !(defined (__WIDL__) || defined (RC_INVOKED))
|
---|
11 | __MINGW_EXTENSION typedef unsigned __int64 POINTER_64_INT;
|
---|
12 | #else
|
---|
13 | typedef unsigned long POINTER_64_INT;
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #define POINTER_32
|
---|
17 | #define POINTER_64
|
---|
18 | #define FIRMWARE_PTR
|
---|
19 |
|
---|
20 | #define POINTER_SIGNED
|
---|
21 | #define POINTER_UNSIGNED
|
---|
22 | #define SPOINTER_32 POINTER_SIGNED POINTER_32
|
---|
23 | #define UPOINTER_32 POINTER_UNSIGNED POINTER_32
|
---|
24 |
|
---|
25 | #ifdef __cplusplus
|
---|
26 | extern "C" {
|
---|
27 | #endif
|
---|
28 |
|
---|
29 | typedef signed char INT8,*PINT8;
|
---|
30 | typedef signed short INT16,*PINT16;
|
---|
31 | typedef signed int INT32,*PINT32;
|
---|
32 | __MINGW_EXTENSION typedef signed __int64 INT64,*PINT64;
|
---|
33 | typedef unsigned char UINT8,*PUINT8;
|
---|
34 | typedef unsigned short UINT16,*PUINT16;
|
---|
35 | typedef unsigned int UINT32,*PUINT32;
|
---|
36 | __MINGW_EXTENSION typedef unsigned __int64 UINT64,*PUINT64;
|
---|
37 | typedef signed int LONG32,*PLONG32;
|
---|
38 | typedef unsigned int ULONG32,*PULONG32;
|
---|
39 | typedef unsigned int DWORD32,*PDWORD32;
|
---|
40 |
|
---|
41 | #ifndef _W64
|
---|
42 | #define _W64
|
---|
43 | #endif
|
---|
44 |
|
---|
45 | #ifdef _WIN64
|
---|
46 | __MINGW_EXTENSION typedef __int64 INT_PTR,*PINT_PTR;
|
---|
47 | __MINGW_EXTENSION typedef unsigned __int64 UINT_PTR,*PUINT_PTR;
|
---|
48 | __MINGW_EXTENSION typedef __int64 LONG_PTR,*PLONG_PTR;
|
---|
49 | __MINGW_EXTENSION typedef unsigned __int64 ULONG_PTR,*PULONG_PTR;
|
---|
50 | #define __int3264 __int64
|
---|
51 | #else
|
---|
52 | typedef int INT_PTR,*PINT_PTR;
|
---|
53 | typedef unsigned int UINT_PTR,*PUINT_PTR;
|
---|
54 | typedef long LONG_PTR,*PLONG_PTR;
|
---|
55 | typedef unsigned long ULONG_PTR,*PULONG_PTR;
|
---|
56 | #define __int3264 int
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #ifdef _WIN64
|
---|
60 | #define ADDRESS_TAG_BIT 0x40000000000ULL
|
---|
61 |
|
---|
62 | __MINGW_EXTENSION typedef __int64 SHANDLE_PTR;
|
---|
63 | __MINGW_EXTENSION typedef unsigned __int64 HANDLE_PTR;
|
---|
64 | typedef unsigned int UHALF_PTR,*PUHALF_PTR;
|
---|
65 | typedef int HALF_PTR,*PHALF_PTR;
|
---|
66 |
|
---|
67 | #ifndef __WIDL__
|
---|
68 | static __inline unsigned __LONG32 HandleToULong (const void *h) { return ((unsigned __LONG32) (ULONG_PTR) h); }
|
---|
69 | static __inline __LONG32 HandleToLong (const void *h) { return ((__LONG32) (LONG_PTR) h); }
|
---|
70 | static __inline void *ULongToHandle (const unsigned __LONG32 h) { return ((void *) (UINT_PTR) h); }
|
---|
71 | static __inline void *LongToHandle (const __LONG32 h) { return ((void *) (INT_PTR) h); }
|
---|
72 | static __inline unsigned __LONG32 PtrToUlong (const void *p) { return ((unsigned __LONG32) (ULONG_PTR) p); }
|
---|
73 | static __inline unsigned int PtrToUint (const void *p) { return ((unsigned int) (UINT_PTR) p); }
|
---|
74 | static __inline unsigned short PtrToUshort (const void *p) { return ((unsigned short) (unsigned __LONG32) (ULONG_PTR) p); }
|
---|
75 | static __inline __LONG32 PtrToLong (const void *p) { return ((__LONG32) (LONG_PTR) p); }
|
---|
76 | static __inline int PtrToInt (const void *p) { return ((int) (INT_PTR) p); }
|
---|
77 | static __inline short PtrToShort (const void *p) { return ((short) (__LONG32) (LONG_PTR) p); }
|
---|
78 | static __inline void *IntToPtr (const int i) { return ((void *) (INT_PTR)i); }
|
---|
79 | static __inline void *UIntToPtr (const unsigned int ui) { return ((void *) (UINT_PTR)ui); }
|
---|
80 | static __inline void *LongToPtr (const __LONG32 l) { return ((void *) (LONG_PTR)l); }
|
---|
81 | static __inline void *ULongToPtr (const unsigned __LONG32 ul) { return ((void *) (ULONG_PTR)ul); }
|
---|
82 |
|
---|
83 | #define PtrToPtr64(p) ((void *POINTER_64) p)
|
---|
84 | #define Ptr64ToPtr(p) ((void *) p)
|
---|
85 | #define HandleToHandle64(h) (PtrToPtr64 (h))
|
---|
86 | #define Handle64ToHandle(h) (Ptr64ToPtr (h))
|
---|
87 |
|
---|
88 | static __inline void *Ptr32ToPtr (const void *POINTER_32 p) { return ((void *) (ULONG_PTR) (unsigned __LONG32) (ULONG_PTR) p); }
|
---|
89 | static __inline void *Handle32ToHandle (const void *POINTER_32 h) { return ((void *) (LONG_PTR) (__LONG32) (ULONG_PTR) h); }
|
---|
90 | static __inline void *POINTER_32 PtrToPtr32 (const void *p) { return ((void *POINTER_32) (ULONG_PTR) (unsigned __LONG32) (ULONG_PTR) p); }
|
---|
91 |
|
---|
92 | #define HandleToHandle32(h) (PtrToPtr32 (h))
|
---|
93 | #endif
|
---|
94 | #else
|
---|
95 | #define ADDRESS_TAG_BIT __MSABI_LONG (0x80000000U)
|
---|
96 |
|
---|
97 | typedef unsigned short UHALF_PTR,*PUHALF_PTR;
|
---|
98 | typedef short HALF_PTR,*PHALF_PTR;
|
---|
99 | typedef __LONG32 SHANDLE_PTR;
|
---|
100 | typedef unsigned __LONG32 HANDLE_PTR;
|
---|
101 |
|
---|
102 | #define HandleToULong(h) ((ULONG) (ULONG_PTR) (h))
|
---|
103 | #define HandleToLong(h) ((LONG) (LONG_PTR) (h))
|
---|
104 | #define ULongToHandle(ul) ((HANDLE) (ULONG_PTR) (ul))
|
---|
105 | #define LongToHandle(h) ((HANDLE) (LONG_PTR) (h))
|
---|
106 | #define PtrToUlong(p) ((ULONG) (ULONG_PTR) (p))
|
---|
107 | #define PtrToLong(p) ((LONG) (LONG_PTR) (p))
|
---|
108 | #define PtrToUint(p) ((UINT) (UINT_PTR) (p))
|
---|
109 | #define PtrToInt(p) ((INT) (INT_PTR) (p))
|
---|
110 | #define PtrToUshort(p) ((unsigned short) (ULONG_PTR) (p))
|
---|
111 | #define PtrToShort(p) ((short) (LONG_PTR) (p))
|
---|
112 | #define IntToPtr(i) ((VOID *) (INT_PTR) ((int)i))
|
---|
113 | #define UIntToPtr(ui) ((VOID *) (UINT_PTR) ((unsigned int)ui))
|
---|
114 | #define LongToPtr(l) ((VOID *) (LONG_PTR) ((__LONG32) l))
|
---|
115 | #define ULongToPtr(ul) ((VOID *) (ULONG_PTR) ((unsigned __LONG32) ul))
|
---|
116 |
|
---|
117 | #ifndef __WIDL__
|
---|
118 | static __inline void *POINTER_64 PtrToPtr64 (const void *p) { return ((void *POINTER_64) (ULONG_PTR) p); }
|
---|
119 | static __inline void *Ptr64ToPtr (const void *POINTER_64 p) { return ((void *) (ULONG_PTR) p); }
|
---|
120 | static __inline void *POINTER_64 HandleToHandle64 (const void *h) { return ((void *POINTER_64) (LONG_PTR) h); }
|
---|
121 | static __inline void *Handle64ToHandle (const void *POINTER_64 h) { return ((void *) (ULONG_PTR) h); }
|
---|
122 | #endif
|
---|
123 |
|
---|
124 | #define Ptr32ToPtr(p) ((void *) p)
|
---|
125 | #define Handle32ToHandle(h) (Ptr32ToPtr (h))
|
---|
126 | #define PtrToPtr32(p) ((void *POINTER_32) p)
|
---|
127 | #define HandleToHandle32(h) (PtrToPtr32 (h))
|
---|
128 | #endif
|
---|
129 |
|
---|
130 | #define HandleToUlong(h) HandleToULong (h)
|
---|
131 | #define UlongToHandle(ul) ULongToHandle (ul)
|
---|
132 | #define UlongToPtr(ul) ULongToPtr (ul)
|
---|
133 | #define UintToPtr(ui) UIntToPtr (ui)
|
---|
134 |
|
---|
135 | #define MAXUINT_PTR (~ ((UINT_PTR)0))
|
---|
136 | #define MAXINT_PTR ((INT_PTR) (MAXUINT_PTR >> 1))
|
---|
137 | #define MININT_PTR (~MAXINT_PTR)
|
---|
138 |
|
---|
139 | #define MAXULONG_PTR (~ ((ULONG_PTR)0))
|
---|
140 | #define MAXLONG_PTR ((LONG_PTR) (MAXULONG_PTR >> 1))
|
---|
141 | #define MINLONG_PTR (~MAXLONG_PTR)
|
---|
142 |
|
---|
143 | #define MAXUHALF_PTR ((UHALF_PTR)~0)
|
---|
144 | #define MAXHALF_PTR ((HALF_PTR) (MAXUHALF_PTR >> 1))
|
---|
145 | #define MINHALF_PTR (~MAXHALF_PTR)
|
---|
146 |
|
---|
147 | __MINGW_EXTENSION typedef ULONG_PTR SIZE_T,*PSIZE_T;
|
---|
148 | __MINGW_EXTENSION typedef LONG_PTR SSIZE_T,*PSSIZE_T;
|
---|
149 |
|
---|
150 | #if _WIN32_WINNT >= 0x0600 || (defined (__cplusplus) && defined (WINDOWS_ENABLE_CPLUSPLUS))
|
---|
151 |
|
---|
152 | #define MAXUINT8 ((UINT8)~ ((UINT8)0))
|
---|
153 | #define MAXINT8 ((INT8) (MAXUINT8 >> 1))
|
---|
154 | #define MININT8 ((INT8)~MAXINT8)
|
---|
155 |
|
---|
156 | #define MAXUINT16 ((UINT16)~ ((UINT16)0))
|
---|
157 | #define MAXINT16 ((INT16) (MAXUINT16 >> 1))
|
---|
158 | #define MININT16 ((INT16)~MAXINT16)
|
---|
159 |
|
---|
160 | #define MAXUINT32 ((UINT32)~ ((UINT32)0))
|
---|
161 | #define MAXINT32 ((INT32) (MAXUINT32 >> 1))
|
---|
162 | #define MININT32 ((INT32)~MAXINT32)
|
---|
163 |
|
---|
164 | #define MAXUINT64 ((UINT64)~ ((UINT64)0))
|
---|
165 | #define MAXINT64 ((INT64) (MAXUINT64 >> 1))
|
---|
166 | #define MININT64 ((INT64)~MAXINT64)
|
---|
167 |
|
---|
168 | #define MAXULONG32 ((ULONG32)~ ((ULONG32)0))
|
---|
169 | #define MAXLONG32 ((LONG32) (MAXULONG32 >> 1))
|
---|
170 | #define MINLONG32 ((LONG32)~MAXLONG32)
|
---|
171 |
|
---|
172 | #define MAXULONG64 ((ULONG64)~ ((ULONG64)0))
|
---|
173 | #define MAXLONG64 ((LONG64) (MAXULONG64 >> 1))
|
---|
174 | #define MINLONG64 ((LONG64)~MAXLONG64)
|
---|
175 |
|
---|
176 | #define MAXULONGLONG ((ULONGLONG)~ ((ULONGLONG)0))
|
---|
177 | #define MINLONGLONG ((LONGLONG)~MAXLONGLONG)
|
---|
178 |
|
---|
179 | #define MAXSIZE_T ((SIZE_T)~ ((SIZE_T)0))
|
---|
180 | #define MAXSSIZE_T ((SSIZE_T) (MAXSIZE_T >> 1))
|
---|
181 | #define MINSSIZE_T ((SSIZE_T)~MAXSSIZE_T)
|
---|
182 |
|
---|
183 | #define MAXUINT ((UINT)~ ((UINT)0))
|
---|
184 | #define MAXINT ((INT) (MAXUINT >> 1))
|
---|
185 | #define MININT ((INT)~MAXINT)
|
---|
186 |
|
---|
187 | #define MAXDWORD32 ((DWORD32)~ ((DWORD32)0))
|
---|
188 | #define MAXDWORD64 ((DWORD64)~ ((DWORD64)0))
|
---|
189 | #endif
|
---|
190 |
|
---|
191 | __MINGW_EXTENSION typedef ULONG_PTR DWORD_PTR,*PDWORD_PTR;
|
---|
192 | __MINGW_EXTENSION typedef __int64 LONG64,*PLONG64;
|
---|
193 | __MINGW_EXTENSION typedef unsigned __int64 ULONG64,*PULONG64;
|
---|
194 | __MINGW_EXTENSION typedef unsigned __int64 DWORD64,*PDWORD64;
|
---|
195 | __MINGW_EXTENSION typedef ULONG_PTR KAFFINITY;
|
---|
196 | __MINGW_EXTENSION typedef KAFFINITY *PKAFFINITY;
|
---|
197 |
|
---|
198 | #ifdef __cplusplus
|
---|
199 | }
|
---|
200 | #endif
|
---|
201 | #endif
|
---|