1 /*++
2
3 Copyright (c) Microsoft Corporation.  All rights reserved.
4
5 Module Name:
6
7       basetsd.h
8
9 Abstract:
10
11       Type definitions for the basic sized types.
12
13 Author:
14
15 Revision History:
16
17 --*/
18
19 #ifndef _BASETSD_H_
20 #define _BASETSD_H_
21
22 #if !defined(_MAC) && (defined(_M_MRX000) || defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_VER >= 1100) && !(defined(MIDL_PASS) || defined(RC_INVOKED))
23  #define POINTER_64 __ptr64
24  typedef unsigned __int64 POINTER_64_INT;
25  #if defined(_WIN64)
26   #define POINTER_32 __ptr32
27  #else
28   #define POINTER_32
29  #endif
30 #else
31  #if defined(_MAC) && defined(_MAC_INT_64)
32   #define POINTER_64 __ptr64
33   typedef unsigned __int64 POINTER_64_INT;
34  #else
35   #if (_MSC_VER >= 1300) && !(defined(MIDL_PASS) || defined(RC_INVOKED))
36      #define POINTER_64 __ptr64
37   #else
38      #define POINTER_64
39   #endif
40   typedef unsigned long POINTER_64_INT;
41  #endif
42  #define POINTER_32
43 #endif
44
45 #if defined(_IA64_) || defined(_AMD64_)
46 #define FIRMWARE_PTR
47 #else
48 #define FIRMWARE_PTR POINTER_32
49 #endif
50
51 //
52 // A compiler with support for __sptr and __uptr is in qualification.  To
53 // participate in qualification, remove the "0 &&" term below and also
54 // enable warning 4826 in warning.w
55 // 
56
57 #if 0 && (_MSC_FULL_VER >= 140041204) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
58 #define POINTER_SIGNED __sptr
59 #define POINTER_UNSIGNED __uptr
60 #else
61 #define POINTER_SIGNED
62 #define POINTER_UNSIGNED
63 #endif
64
65 #define SPOINTER_32 POINTER_SIGNED POINTER_32
66 #define UPOINTER_32 POINTER_UNSIGNED POINTER_32
67
68 #if _MSC_VER > 1000
69 #pragma once
70 #endif
71
72 #ifdef __cplusplus
73 extern "C" {
74 #endif
75
76 typedef signed char               INT8, *PINT8;
77 typedef signed short             INT16, *PINT16;
78 typedef signed int                INT32, *PINT32;
79 typedef signed __int64          INT64, *PINT64;
80 typedef unsigned char           UINT8, *PUINT8;
81 typedef unsigned short          UINT16, *PUINT16;
82 typedef unsigned int             UINT32, *PUINT32;
83 typedef unsigned __int64      UINT64, *PUINT64;
84
85 //
86 // The following types are guaranteed to be signed and 32 bits wide.
87 //
88
89 typedef signed int LONG32, *PLONG32;
90
91 //
92 // The following types are guaranteed to be unsigned and 32 bits wide.
93 //
94
95 typedef unsigned int ULONG32, *PULONG32;
96 typedef unsigned int DWORD32, *PDWORD32;
97
98 #if !defined(_W64)
99 #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
100 #define _W64 __w64
101 #else
102 #define _W64
103 #endif
104 #endif
105
106 //
107 // The INT_PTR is guaranteed to be the same size as a pointer.  Its
108 // size with change with pointer size (32/64).  It should be used
109 // anywhere that a pointer is cast to an integer type. UINT_PTR is
110 // the unsigned variation.
111 //
112 // __int3264 is intrinsic to 64b MIDL but not to old MIDL or to C compiler.
113 //
114 #if ( 501 < __midl )
115
116       typedef [public] __int3264 INT_PTR, *PINT_PTR;
117       typedef [public] unsigned __int3264 UINT_PTR, *PUINT_PTR;
118
119       typedef [public] __int3264 LONG_PTR, *PLONG_PTR;
120       typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR;
121
122 #else  // midl64
123 // old midl and C++ compiler
124
125 #if defined(_WIN64)
126       typedef __int64 INT_PTR, *PINT_PTR;
127       typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
128
129       typedef __int64 LONG_PTR, *PLONG_PTR;
130       typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
131
132       #define __int3264     __int64
133
134 #else
135       typedef _W64 int INT_PTR, *PINT_PTR;
136       typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
137
138       typedef _W64 long LONG_PTR, *PLONG_PTR;
139       typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR;
140
141       #define __int3264     __int32
142
143 #endif
144 #endif // midl64
145
146 //
147 // HALF_PTR is half the size of a pointer it intended for use with
148 // within structures which contain a pointer and two small fields.
149 // UHALF_PTR is the unsigned variation.
150 //
151
152 #ifdef _WIN64
Lines 153 ... 450 are skipped.
451 #define MINLONGLONG ((LONGLONG)~MAXLONGLONG)
452
453 #define MAXSIZE_T     ((SIZE_T)~((SIZE_T)0))
454 #define MAXSSIZE_T  ((SSIZE_T)(MAXSIZE_T >> 1))
455 #define MINSSIZE_T  ((SSIZE_T)~MAXSSIZE_T)
456
457 #define MAXUINT        ((UINT)~((UINT)0))
458 #define MAXINT          ((INT)(MAXUINT >> 1))
459 #define MININT          ((INT)~MAXINT)
460
461 #define MAXDWORD32  ((DWORD32)~((DWORD32)0))
462 #define MAXDWORD64  ((DWORD64)~((DWORD64)0))
463
464 #endif // _WIN32_WINNT >= 0x0600
465
466 //
467 // Add Windows flavor DWORD_PTR types
468 //
469
470 typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
471
472 //
473 // The following types are guaranteed to be signed and 64 bits wide.
474 //
475
476 typedef __int64 LONG64, *PLONG64;
477
478
479 //
480 // The following types are guaranteed to be unsigned and 64 bits wide.
481 //
482
483 typedef unsigned __int64 ULONG64, *PULONG64;
484 typedef unsigned __int64 DWORD64, *PDWORD64;
485
486 //
487 // Thread affinity.
488 //
489
490 typedef ULONG_PTR KAFFINITY;
491 typedef KAFFINITY *PKAFFINITY;
492
493 #ifdef __cplusplus
494 }
495 #endif
496
497 #endif // _BASETSD_H_
498
499