[UMPNPMGR] Partially implement ReenumerateDeviceInstance which is needed by the Lenov...
[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_BY(size, align) \
77 ((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))
78
79 #define ALIGN_UP_BY(size, align) \
80 (ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))
81
82 #define ALIGN_DOWN_POINTER_BY(ptr, align) \
83 ((PVOID)ALIGN_DOWN_BY(ptr, align))
84
85 #define ALIGN_UP_POINTER_BY(ptr, align) \
86 ((PVOID)ALIGN_UP_BY(ptr, align))
87
88 #define ALIGN_DOWN(size, type) \
89 ALIGN_DOWN_BY(size, sizeof(type))
90
91 #define ALIGN_UP(size, type) \
92 ALIGN_UP_BY(size, sizeof(type))
93
94 #define ALIGN_DOWN_POINTER(ptr, type) \
95 ALIGN_DOWN_POINTER_BY(ptr, sizeof(type))
96
97 #define ALIGN_UP_POINTER(ptr, type) \
98 ALIGN_UP_POINTER_BY(ptr, sizeof(type))
99
100 //
101 // Native API Return Value Macros
102 //
103 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
104 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1)
105 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2)
106 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3)
107
108 //
109 // Limits
110 //
111 #define MINCHAR 0x80
112 #define MAXCHAR 0x7f
113 #define MINSHORT 0x8000
114 #define MAXSHORT 0x7fff
115 #define MINLONG 0x80000000
116 #define MAXLONG 0x7fffffff
117 #define MAXUCHAR 0xff
118 #define MAXUSHORT 0xffff
119 #define MAXULONG 0xffffffff
120
121 //
122 // Basic Types that aren't defined in User-Mode Headers
123 //
124 typedef CONST int CINT;
125 typedef CONST char *PCSZ;
126 typedef ULONG CLONG;
127 typedef short CSHORT;
128 typedef CSHORT *PCSHORT;
129 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
130 typedef LONG KPRIORITY;
131
132 //
133 // Basic NT Types
134 //
135 #if !defined(_NTSECAPI_H) && !defined(_SUBAUTH_H) && !defined(_NTSECAPI_)
136
137 #if !defined(__BCRYPT_H__) && !defined(__WINE_BCRYPT_H)
138 typedef _Return_type_success_(return >= 0) long NTSTATUS, *PNTSTATUS;
139 #endif
140
141 typedef struct _UNICODE_STRING
142 {
143 USHORT Length;
144 USHORT MaximumLength;
145 PWSTR Buffer;
146 } UNICODE_STRING, *PUNICODE_STRING;
147
148 typedef struct _STRING
149 {
150 USHORT Length;
151 USHORT MaximumLength;
152 PCHAR Buffer;
153 } STRING, *PSTRING;
154
155 typedef struct _CSTRING
156 {
157 USHORT Length;
158 USHORT MaximumLength;
159 CONST CHAR *Buffer;
160 } CSTRING, *PCSTRING;
161
162 #endif
163
164 typedef struct _STRING32 {
165 USHORT Length;
166 USHORT MaximumLength;
167 ULONG Buffer;
168 } STRING32, *PSTRING32,
169 UNICODE_STRING32, *PUNICODE_STRING32,
170 ANSI_STRING32, *PANSI_STRING32;
171
172 typedef struct _STRING64 {
173 USHORT Length;
174 USHORT MaximumLength;
175 ULONGLONG Buffer;
176 } STRING64, *PSTRING64,
177 UNICODE_STRING64, *PUNICODE_STRING64,
178 ANSI_STRING64, *PANSI_STRING64;
179
180
181 typedef struct _OBJECT_ATTRIBUTES
182 {
183 ULONG Length;
184 HANDLE RootDirectory;
185 PUNICODE_STRING ObjectName;
186 ULONG Attributes;
187 PVOID SecurityDescriptor;
188 PVOID SecurityQualityOfService;
189 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
190
191 //
192 // ClientID Structure
193 //
194 typedef struct _CLIENT_ID
195 {
196 HANDLE UniqueProcess;
197 HANDLE UniqueThread;
198 } CLIENT_ID, *PCLIENT_ID;
199
200 typedef const UNICODE_STRING* PCUNICODE_STRING;
201 typedef STRING ANSI_STRING;
202 typedef PSTRING PANSI_STRING;
203 typedef STRING OEM_STRING;
204 typedef PSTRING POEM_STRING;
205 typedef CONST STRING* PCOEM_STRING;
206 typedef STRING CANSI_STRING;
207 typedef PSTRING PCANSI_STRING;
208
209 #endif