1 // Copyright (c) 2006-2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SANDBOX_TOOLS_FINDER_NTUNDOC_H__
6 #define SANDBOX_TOOLS_FINDER_NTUNDOC_H__
9 #define STATUS_SUCCESS 0x00000000
10 #define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
11 #define STATUS_ACCESS_DENIED 0xC0000022
12 #define STATUS_BUFFER_OVERFLOW 0x80000005
14 typedef struct _LSA_UNICODE_STRING
{
20 typedef struct _OBJDIR_INFORMATION
{
21 UNICODE_STRING ObjectName
;
22 UNICODE_STRING ObjectTypeName
;
26 typedef struct _OBJECT_ATTRIBUTES
{
29 UNICODE_STRING
*ObjectName
;
31 PVOID SecurityDescriptor
;
32 PVOID SecurityQualityOfService
;
35 typedef struct _PUBLIC_OBJECT_BASIC_INFORMATION
{
37 ACCESS_MASK GrantedAccess
;
40 ULONG Reserved
[10]; // reserved for internal use
41 } PUBLIC_OBJECT_BASIC_INFORMATION
, *PPUBLIC_OBJECT_BASIC_INFORMATION
;
43 typedef struct __PUBLIC_OBJECT_TYPE_INFORMATION
{
44 UNICODE_STRING TypeName
;
45 ULONG Reserved
[22]; // reserved for internal use
46 } PUBLIC_OBJECT_TYPE_INFORMATION
, *PPUBLIC_OBJECT_TYPE_INFORMATION
;
48 typedef enum _POOL_TYPE
{
51 NonPagedPoolMustSucceed
,
53 NonPagedPoolCacheAligned
,
54 PagedPoolCacheAligned
,
55 NonPagedPoolCacheAlignedMustS
58 typedef struct _OBJECT_TYPE_INFORMATION
{
60 ULONG TotalNumberOfObjects
;
61 ULONG TotalNumberOfHandles
;
62 ULONG TotalPagedPoolUsage
;
63 ULONG TotalNonPagedPoolUsage
;
64 ULONG TotalNamePoolUsage
;
65 ULONG TotalHandleTableUsage
;
66 ULONG HighWaterNumberOfObjects
;
67 ULONG HighWaterNumberOfHandles
;
68 ULONG HighWaterPagedPoolUsage
;
69 ULONG HighWaterNonPagedPoolUsage
;
70 ULONG HighWaterNamePoolUsage
;
71 ULONG HighWaterHandleTableUsage
;
72 ULONG InvalidAttributes
;
73 GENERIC_MAPPING GenericMapping
;
75 BOOLEAN SecurityRequired
;
76 BOOLEAN MaintainHandleCount
;
77 USHORT MaintainTypeList
;
80 ULONG NonPagedPoolUsage
;
81 } OBJECT_TYPE_INFORMATION
, *POBJECT_TYPE_INFORMATION
;
83 typedef struct _OBJECT_NAME_INFORMATION
{
84 UNICODE_STRING ObjectName
;
85 } OBJECT_NAME_INFORMATION
, *POBJECT_NAME_INFORMATION
;
87 typedef enum _OBJECT_INFORMATION_CLASS
{
88 ObjectBasicInformation
,
89 ObjectNameInformation
,
90 ObjectTypeInformation
,
93 } OBJECT_INFORMATION_CLASS
, *POBJECT_INFORMATION_CLASS
;
95 typedef struct _FILE_NAME_INFORMATION
{
98 } FILE_NAME_INFORMATION
, *PFILE_NAME_INFORMATION
;
100 typedef enum _FILE_INFORMATION_CLASS
{
102 FileDirectoryInformation
= 1,
103 FileFullDirectoryInformation
, // 2
104 FileBothDirectoryInformation
, // 3
105 FileBasicInformation
, // 4 wdm
106 FileStandardInformation
, // 5 wdm
107 FileInternalInformation
, // 6
108 FileEaInformation
, // 7
109 FileAccessInformation
, // 8
110 FileNameInformation
, // 9
111 FileRenameInformation
, // 10
112 FileLinkInformation
, // 11
113 FileNamesInformation
, // 12
114 FileDispositionInformation
, // 13
115 FilePositionInformation
, // 14 wdm
116 FileFullEaInformation
, // 15
117 FileModeInformation
, // 16
118 FileAlignmentInformation
, // 17
119 FileAllInformation
, // 18
120 FileAllocationInformation
, // 19
121 FileEndOfFileInformation
, // 20 wdm
122 FileAlternateNameInformation
, // 21
123 FileStreamInformation
, // 22
124 FilePipeInformation
, // 23
125 FilePipeLocalInformation
, // 24
126 FilePipeRemoteInformation
, // 25
127 FileMailslotQueryInformation
, // 26
128 FileMailslotSetInformation
, // 27
129 FileCompressionInformation
, // 28
130 FileObjectIdInformation
, // 29
131 FileCompletionInformation
, // 30
132 FileMoveClusterInformation
, // 31
133 FileQuotaInformation
, // 32
134 FileReparsePointInformation
, // 33
135 FileNetworkOpenInformation
, // 34
136 FileAttributeTagInformation
, // 35
137 FileTrackingInformation
, // 36
138 FileMaximumInformation
140 } FILE_INFORMATION_CLASS
, *PFILE_INFORMATION_CLASS
;
142 typedef enum _SYSTEM_INFORMATION_CLASS
{
143 SystemHandleInformation
= 16
144 } SYSTEM_INFORMATION_CLASS
;
146 typedef struct _IO_STATUS_BLOCK
{
151 ULONG_PTR Information
;
152 } IO_STATUS_BLOCK
, *PIO_STATUS_BLOCK
;
154 #define InitializeObjectAttributes( p, n, a, r, s ) { \
155 (p)->Length = sizeof( OBJECT_ATTRIBUTES ); \
156 (p)->RootDirectory = r; \
157 (p)->Attributes = a; \
158 (p)->ObjectName = n; \
159 (p)->SecurityDescriptor = s; \
160 (p)->SecurityQualityOfService = NULL; \
163 typedef struct _SYSTEM_HANDLE_INFORMATION
{
165 USHORT CreatorBackTraceIndex
;
166 UCHAR ObjectTypeNumber
;
170 ACCESS_MASK GrantedAccess
;
171 } SYSTEM_HANDLE_INFORMATION
, *PSYSTEM_HANDLE_INFORMATION
;
173 typedef struct _SYSTEM_HANDLE_INFORMATION_EX
{
174 ULONG NumberOfHandles
;
175 SYSTEM_HANDLE_INFORMATION Information
[1];
176 } SYSTEM_HANDLE_INFORMATION_EX
, *PSYSTEM_HANDLE_INFORMATION_EX
;
178 #define POBJECT_ATTRIBUTES OBJECT_ATTRIBUTES*
180 typedef NTSTATUS (WINAPI
* NTQUERYDIRECTORYOBJECT
)(
189 typedef NTSTATUS (WINAPI
* NTOPENDIRECTORYOBJECT
)(
192 OBJECT_ATTRIBUTES
* );
194 typedef NTSTATUS (WINAPI
* NTGENERICOPEN
) (
195 OUT PHANDLE EventHandle
,
196 IN ACCESS_MASK DesiredAccess
,
197 IN POBJECT_ATTRIBUTES ObjectAttributes
);
199 typedef NTSTATUS (WINAPI
* NTOPENEVENT
)(
200 OUT PHANDLE EventHandle
,
201 IN ACCESS_MASK DesiredAccess
,
202 IN POBJECT_ATTRIBUTES ObjectAttributes
);
204 typedef NTSTATUS (WINAPI
* NTOPENJOBOBJECT
)(
205 OUT PHANDLE JobHandle
,
206 IN ACCESS_MASK DesiredAccess
,
207 IN POBJECT_ATTRIBUTES ObjectAttributes
);
209 typedef NTSTATUS (WINAPI
* NTOPENKEYEDEVENT
)(
210 OUT PHANDLE KeyedEventHandle
,
211 IN ACCESS_MASK DesiredAccess
,
212 IN POBJECT_ATTRIBUTES ObjectAttributes
);
214 typedef NTSTATUS (WINAPI
* NTOPENMUTANT
)(
215 OUT PHANDLE MutantHandle
,
216 IN ACCESS_MASK DesiredAccess
,
217 IN POBJECT_ATTRIBUTES ObjectAttributes
);
219 typedef NTSTATUS (WINAPI
* NTOPENSECTION
)(
220 OUT PHANDLE SectionHandle
,
221 IN ACCESS_MASK DesiredAccess
,
222 IN POBJECT_ATTRIBUTES ObjectAttributes
);
224 typedef NTSTATUS (WINAPI
* NTOPENSEMAPHORE
)(
225 OUT PHANDLE SemaphoreHandle
,
226 IN ACCESS_MASK DesiredAccess
,
227 IN POBJECT_ATTRIBUTES ObjectAttributes
);
229 typedef NTSTATUS (WINAPI
* NTOPENSYMBOLICLINKOBJECT
)(
230 OUT PHANDLE SymbolicLinkHandle
,
231 IN ACCESS_MASK DesiredAccess
,
232 IN POBJECT_ATTRIBUTES ObjectAttributes
);
234 typedef NTSTATUS (WINAPI
* NTOPENTIMER
)(
235 OUT PHANDLE TimerHandle
,
236 IN ACCESS_MASK DesiredAccess
,
237 IN POBJECT_ATTRIBUTES ObjectAttributes
);
239 typedef NTSTATUS (WINAPI
* NTOPENFILE
)(
247 typedef NTSTATUS (WINAPI
* NTQUERYINFORMATIONFILE
)(
252 FILE_INFORMATION_CLASS
);
254 typedef NTSTATUS (WINAPI
* NTQUERYSYSTEMINFORMATION
)(
255 SYSTEM_INFORMATION_CLASS SystemInformationClass
,
256 PVOID SystemInformation
,
257 ULONG SystemInformationLength
,
258 PULONG ReturnLength
);
260 typedef NTSTATUS (WINAPI
* NTQUERYOBJECT
)(
262 OBJECT_INFORMATION_CLASS ObjectInformationClass
,
263 PVOID ObjectInformation
,
264 ULONG ObjectInformationLength
,
265 PULONG ReturnLength
);
267 typedef NTSTATUS (WINAPI
* NTCLOSE
) (HANDLE
);
269 #define DIRECTORY_QUERY 0x0001
270 #define DIRECTORY_TRAVERSE 0x0002
271 #define DIRECTORY_CREATE_OBJECT 0x0004
272 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
273 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
275 #endif // SANDBOX_TOOLS_FINDER_NTUNDOC_H__