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_)
131 typedef LONG NTSTATUS
, *PNTSTATUS
;
133 typedef struct _UNICODE_STRING
136 USHORT MaximumLength
;
138 } UNICODE_STRING
, *PUNICODE_STRING
;
140 typedef struct _STRING
143 USHORT MaximumLength
;
147 typedef struct _CSTRING
150 USHORT MaximumLength
;
152 } CSTRING
, *PCSTRING
;
156 typedef struct _STRING32
{
158 USHORT MaximumLength
;
160 } STRING32
, *PSTRING32
,
161 UNICODE_STRING32
, *PUNICODE_STRING32
,
162 ANSI_STRING32
, *PANSI_STRING32
;
164 typedef struct _STRING64
{
166 USHORT MaximumLength
;
168 } STRING64
, *PSTRING64
,
169 UNICODE_STRING64
, *PUNICODE_STRING64
,
170 ANSI_STRING64
, *PANSI_STRING64
;
173 typedef struct _OBJECT_ATTRIBUTES
176 HANDLE RootDirectory
;
177 PUNICODE_STRING ObjectName
;
179 PVOID SecurityDescriptor
;
180 PVOID SecurityQualityOfService
;
181 } OBJECT_ATTRIBUTES
, *POBJECT_ATTRIBUTES
;
184 // ClientID Structure
186 typedef struct _CLIENT_ID
188 HANDLE UniqueProcess
;
190 } CLIENT_ID
, *PCLIENT_ID
;
192 typedef const UNICODE_STRING
* PCUNICODE_STRING
;
193 typedef STRING ANSI_STRING
;
194 typedef PSTRING PANSI_STRING
;
195 typedef STRING OEM_STRING
;
196 typedef PSTRING POEM_STRING
;
197 typedef CONST STRING
* PCOEM_STRING
;
198 typedef STRING CANSI_STRING
;
199 typedef PSTRING PCANSI_STRING
;