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 // Don't use the SDK status values
34 #ifndef WIN32_NO_STATUS
35 #define WIN32_NO_STATUS
39 // Let the NDK know we're in Application Mode
41 #define NTOS_MODE_USER
47 #undef WIN32_NO_STATUS
53 // Compiler Definitions
58 #define FASTCALL __fastcall
64 #define FASTCALL NTAPI
67 #if !defined(_M_CEE_PURE)
68 #define NTAPI_INLINE NTAPI
76 #define ALIGN_DOWN(s, t) \
77 ((ULONG)(s) & ~(sizeof(t) - 1))
79 #define ALIGN_UP(s, t) \
80 (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
82 #define ALIGN_DOWN_POINTER(p, t) \
83 ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
85 #define ALIGN_UP_POINTER(p, t) \
86 (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
89 // Native API Return Value Macros
91 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
92 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
93 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
94 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
101 #define MINSHORT 0x8000
102 #define MAXSHORT 0x7fff
103 #define MINLONG 0x80000000
104 #define MAXLONG 0x7fffffff
105 #define MAXUCHAR 0xff
106 #define MAXUSHORT 0xffff
107 #define MAXULONG 0xffffffff
110 // Basic Types that aren't defined in User-Mode Headers
112 typedef CONST
int CINT
;
113 typedef CONST
char *PCSZ
;
115 typedef short CSHORT
;
116 typedef CSHORT
*PCSHORT
;
117 typedef LARGE_INTEGER PHYSICAL_ADDRESS
, *PPHYSICAL_ADDRESS
;
118 typedef LONG KPRIORITY
;
123 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H) && !defined(_NTSECAPI_)
125 #if !defined(__BCRYPT_H__) && !defined(__WINE_BCRYPT_H)
126 typedef _Return_type_success_(return >= 0) long NTSTATUS
, *PNTSTATUS
;
129 typedef struct _UNICODE_STRING
132 USHORT MaximumLength
;
134 } UNICODE_STRING
, *PUNICODE_STRING
;
136 typedef struct _STRING
139 USHORT MaximumLength
;
143 typedef struct _CSTRING
146 USHORT MaximumLength
;
148 } CSTRING
, *PCSTRING
;
152 typedef struct _STRING32
{
154 USHORT MaximumLength
;
156 } STRING32
, *PSTRING32
,
157 UNICODE_STRING32
, *PUNICODE_STRING32
,
158 ANSI_STRING32
, *PANSI_STRING32
;
160 typedef struct _STRING64
{
162 USHORT MaximumLength
;
164 } STRING64
, *PSTRING64
,
165 UNICODE_STRING64
, *PUNICODE_STRING64
,
166 ANSI_STRING64
, *PANSI_STRING64
;
169 typedef struct _OBJECT_ATTRIBUTES
172 HANDLE RootDirectory
;
173 PUNICODE_STRING ObjectName
;
175 PVOID SecurityDescriptor
;
176 PVOID SecurityQualityOfService
;
177 } OBJECT_ATTRIBUTES
, *POBJECT_ATTRIBUTES
;
180 // ClientID Structure
182 typedef struct _CLIENT_ID
184 HANDLE UniqueProcess
;
186 } CLIENT_ID
, *PCLIENT_ID
;
188 typedef const UNICODE_STRING
* PCUNICODE_STRING
;
189 typedef STRING ANSI_STRING
;
190 typedef PSTRING PANSI_STRING
;
191 typedef STRING OEM_STRING
;
192 typedef PSTRING POEM_STRING
;
193 typedef CONST STRING
* PCOEM_STRING
;
194 typedef STRING CANSI_STRING
;
195 typedef PSTRING PCANSI_STRING
;