3 Copyright (c) Alex Ionescu. All rights reserved.
11 Type definitions for the basic native types.
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
19 #if !defined(_NTDEF_) && !defined(_NTDEF_H)
24 // NDK Applications must use Unicode
31 // Don't use the SDK status values
33 #ifndef WIN32_NO_STATUS
34 #define WIN32_NO_STATUS
38 // Let the NDK know we're in Application Mode
40 #define NTOS_MODE_USER
46 #undef WIN32_NO_STATUS
52 // Compiler Definitions
57 #define FASTCALL _fastcall
63 #define FASTCALL NTAPI
66 #if !defined(_M_CEE_PURE)
67 #define NTAPI_INLINE NTAPI
75 #define ALIGN_DOWN(s, t) \
76 ((ULONG)(s) & ~(sizeof(t) - 1))
78 #define ALIGN_UP(s, t) \
79 (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
81 #define ALIGN_DOWN_POINTER(p, t) \
82 ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
84 #define ALIGN_UP_POINTER(p, t) \
85 (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
88 // Native API Return Value Macros
90 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
91 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
92 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
93 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
100 #define MINSHORT 0x8000
101 #define MAXSHORT 0x7fff
102 #define MINLONG 0x80000000
103 #define MAXLONG 0x7fffffff
104 #define MAXUCHAR 0xff
105 #define MAXUSHORT 0xffff
106 #define MAXULONG 0xffffffff
111 #define CSR_MAKE_OPCODE(s,m) ((s) << 16) | (m)
112 #define CSR_API_ID_FROM_OPCODE(n) ((ULONG)((USHORT)(n)))
113 #define CSR_SERVER_ID_FROM_OPCODE(n) (ULONG)((n) >> 16)
116 // Basic Types that aren't defined in User-Mode Headers
118 typedef CONST
int CINT
;
119 typedef CONST
char *PCSZ
;
121 typedef short CSHORT
;
122 typedef CSHORT
*PCSHORT
;
123 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
124 typedef LONG KPRIORITY
;
129 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H) && !defined(_NTSECAPI_)
132 typedef LONG NTSTATUS
, *PNTSTATUS
;
135 typedef struct _UNICODE_STRING
138 USHORT MaximumLength
;
140 } UNICODE_STRING
, *PUNICODE_STRING
;
142 typedef struct _STRING
145 USHORT MaximumLength
;
149 typedef struct _CSTRING
152 USHORT MaximumLength
;
154 } CSTRING
, *PCSTRING
;
158 typedef struct _STRING32
{
160 USHORT MaximumLength
;
162 } STRING32
, *PSTRING32
,
163 UNICODE_STRING32
, *PUNICODE_STRING32
,
164 ANSI_STRING32
, *PANSI_STRING32
;
166 typedef struct _STRING64
{
168 USHORT MaximumLength
;
170 } STRING64
, *PSTRING64
,
171 UNICODE_STRING64
, *PUNICODE_STRING64
,
172 ANSI_STRING64
, *PANSI_STRING64
;
175 typedef struct _OBJECT_ATTRIBUTES
178 HANDLE RootDirectory
;
179 PUNICODE_STRING ObjectName
;
181 PVOID SecurityDescriptor
;
182 PVOID SecurityQualityOfService
;
183 } OBJECT_ATTRIBUTES
, *POBJECT_ATTRIBUTES
;
186 // ClientID Structure
188 typedef struct _CLIENT_ID
190 HANDLE UniqueProcess
;
192 } CLIENT_ID
, *PCLIENT_ID
;
194 typedef const UNICODE_STRING
* PCUNICODE_STRING
;
195 typedef STRING ANSI_STRING
;
196 typedef PSTRING PANSI_STRING
;
197 typedef STRING OEM_STRING
;
198 typedef PSTRING POEM_STRING
;
199 typedef CONST STRING
* PCOEM_STRING
;
200 typedef STRING CANSI_STRING
;
201 typedef PSTRING PCANSI_STRING
;