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 // Use dummy macros, if SAL 2 is not available
27 #if (_SAL_VERSION < 20)
32 // NDK Applications must use Unicode
39 // Don't use the SDK status values
41 #ifndef WIN32_NO_STATUS
42 #define WIN32_NO_STATUS
46 // Let the NDK know we're in Application Mode
48 #define NTOS_MODE_USER
54 #undef WIN32_NO_STATUS
60 // Compiler Definitions
65 #define FASTCALL __fastcall
71 #define FASTCALL NTAPI
74 #if !defined(_M_CEE_PURE)
75 #define NTAPI_INLINE NTAPI
83 #define ALIGN_DOWN(s, t) \
84 ((ULONG)(s) & ~(sizeof(t) - 1))
86 #define ALIGN_UP(s, t) \
87 (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
89 #define ALIGN_DOWN_POINTER(p, t) \
90 ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
92 #define ALIGN_UP_POINTER(p, t) \
93 (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
96 // Native API Return Value Macros
98 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
99 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
100 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
101 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
108 #define MINSHORT 0x8000
109 #define MAXSHORT 0x7fff
110 #define MINLONG 0x80000000
111 #define MAXLONG 0x7fffffff
112 #define MAXUCHAR 0xff
113 #define MAXUSHORT 0xffff
114 #define MAXULONG 0xffffffff
117 // Basic Types that aren't defined in User-Mode Headers
119 typedef CONST
int CINT
;
120 typedef CONST
char *PCSZ
;
122 typedef short CSHORT
;
123 typedef CSHORT
*PCSHORT
;
124 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
125 typedef LONG KPRIORITY
;
130 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H) && !defined(_NTSECAPI_)
132 #if !defined(__BCRYPT_H__) && !defined(__WINE_BCRYPT_H)
133 typedef _Return_type_success_(return >= 0) long NTSTATUS
, *PNTSTATUS
;
136 typedef struct _UNICODE_STRING
139 USHORT MaximumLength
;
141 } UNICODE_STRING
, *PUNICODE_STRING
;
143 typedef struct _STRING
146 USHORT MaximumLength
;
150 typedef struct _CSTRING
153 USHORT MaximumLength
;
155 } CSTRING
, *PCSTRING
;
159 typedef struct _STRING32
{
161 USHORT MaximumLength
;
163 } STRING32
, *PSTRING32
,
164 UNICODE_STRING32
, *PUNICODE_STRING32
,
165 ANSI_STRING32
, *PANSI_STRING32
;
167 typedef struct _STRING64
{
169 USHORT MaximumLength
;
171 } STRING64
, *PSTRING64
,
172 UNICODE_STRING64
, *PUNICODE_STRING64
,
173 ANSI_STRING64
, *PANSI_STRING64
;
176 typedef struct _OBJECT_ATTRIBUTES
179 HANDLE RootDirectory
;
180 PUNICODE_STRING ObjectName
;
182 PVOID SecurityDescriptor
;
183 PVOID SecurityQualityOfService
;
184 } OBJECT_ATTRIBUTES
, *POBJECT_ATTRIBUTES
;
187 // ClientID Structure
189 typedef struct _CLIENT_ID
191 HANDLE UniqueProcess
;
193 } CLIENT_ID
, *PCLIENT_ID
;
195 typedef const UNICODE_STRING
* PCUNICODE_STRING
;
196 typedef STRING ANSI_STRING
;
197 typedef PSTRING PANSI_STRING
;
198 typedef STRING OEM_STRING
;
199 typedef PSTRING POEM_STRING
;
200 typedef CONST STRING
* PCOEM_STRING
;
201 typedef STRING CANSI_STRING
;
202 typedef PSTRING PCANSI_STRING
;