Add .gitattributes and .gitignore files and normalize line endings in the repository...
[reactos.git] / sdk / include / ndk / umtypes.h
1 /*++ NDK Version: 0095
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 umtypes.h
8
9 Abstract:
10
11 Type definitions for the basic native types.
12
13 Author:
14
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
16
17 --*/
18
19 #if !defined(_NTDEF_) && !defined(_NTDEF_H)
20 #define _NTDEF_
21 #define _NTDEF_H
22
23 //
24 // Use dummy macros, if SAL 2 is not available
25 //
26 #include <sal.h>
27 #if (_SAL_VERSION < 20)
28 #include <no_sal2.h>
29 #endif
30
31 //
32 // Don't use the SDK status values
33 //
34 #ifndef WIN32_NO_STATUS
35 #define WIN32_NO_STATUS
36 #endif
37
38 //
39 // Let the NDK know we're in Application Mode
40 //
41 #define NTOS_MODE_USER
42
43 //
44 // Dependencies
45 //
46 #include <windef.h>
47 #undef WIN32_NO_STATUS
48 #include <ntstatus.h>
49 #include <winioctl.h>
50 #include <ntnls.h>
51
52 //
53 // Compiler Definitions
54 //
55 #ifndef _MANAGED
56 #if defined(_M_IX86)
57 #ifndef FASTCALL
58 #define FASTCALL __fastcall
59 #endif
60 #else
61 #define FASTCALL
62 #endif
63 #else
64 #define FASTCALL NTAPI
65 #endif
66
67 #if !defined(_M_CEE_PURE)
68 #define NTAPI_INLINE NTAPI
69 #else
70 #define NTAPI_INLINE
71 #endif
72
73 //
74 // Alignment Macros
75 //
76 #define ALIGN_DOWN(s, t) \
77 ((ULONG)(s) & ~(sizeof(t) - 1))
78
79 #define ALIGN_UP(s, t) \
80 (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
81
82 #define ALIGN_DOWN_POINTER(p, t) \
83 ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
84
85 #define ALIGN_UP_POINTER(p, t) \
86 (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
87
88 //
89 // Native API Return Value Macros
90 //
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)
95
96 //
97 // Limits
98 //
99 #define MINCHAR 0x80
100 #define MAXCHAR 0x7f
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
108
109 //
110 // Basic Types that aren't defined in User-Mode Headers
111 //
112 typedef CONST int CINT;
113 typedef CONST char *PCSZ;
114 typedef ULONG CLONG;
115 typedef short CSHORT;
116 typedef CSHORT *PCSHORT;
117 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
118 typedef LONG KPRIORITY;
119
120 //
121 // Basic NT Types
122 //
123 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H) && !defined(_NTSECAPI_)
124
125 #if !defined(__BCRYPT_H__) && !defined(__WINE_BCRYPT_H)
126 typedef _Return_type_success_(return >= 0) long NTSTATUS, *PNTSTATUS;
127 #endif
128
129 typedef struct _UNICODE_STRING
130 {
131 USHORT Length;
132 USHORT MaximumLength;
133 PWSTR Buffer;
134 } UNICODE_STRING, *PUNICODE_STRING;
135
136 typedef struct _STRING
137 {
138 USHORT Length;
139 USHORT MaximumLength;
140 PCHAR Buffer;
141 } STRING, *PSTRING;
142
143 typedef struct _CSTRING
144 {
145 USHORT Length;
146 USHORT MaximumLength;
147 CONST CHAR *Buffer;
148 } CSTRING, *PCSTRING;
149
150 #endif
151
152 typedef struct _STRING32 {
153 USHORT Length;
154 USHORT MaximumLength;
155 ULONG Buffer;
156 } STRING32, *PSTRING32,
157 UNICODE_STRING32, *PUNICODE_STRING32,
158 ANSI_STRING32, *PANSI_STRING32;
159
160 typedef struct _STRING64 {
161 USHORT Length;
162 USHORT MaximumLength;
163 ULONGLONG Buffer;
164 } STRING64, *PSTRING64,
165 UNICODE_STRING64, *PUNICODE_STRING64,
166 ANSI_STRING64, *PANSI_STRING64;
167
168
169 typedef struct _OBJECT_ATTRIBUTES
170 {
171 ULONG Length;
172 HANDLE RootDirectory;
173 PUNICODE_STRING ObjectName;
174 ULONG Attributes;
175 PVOID SecurityDescriptor;
176 PVOID SecurityQualityOfService;
177 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
178
179 //
180 // ClientID Structure
181 //
182 typedef struct _CLIENT_ID
183 {
184 HANDLE UniqueProcess;
185 HANDLE UniqueThread;
186 } CLIENT_ID, *PCLIENT_ID;
187
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;
196
197 #endif