1 | /* $Id: nt.h 52039 2014-07-15 14:32:21Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Header for code using the Native NT API.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2014 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___iprt_nt_nt_h___
|
---|
28 | #define ___iprt_nt_nt_h___
|
---|
29 |
|
---|
30 | /** @def IPRT_NT_MAP_TO_ZW
|
---|
31 | * Map Nt calls to Zw calls. In ring-0 the Zw calls let you pass kernel memory
|
---|
32 | * to the APIs (takes care of the previous context checks).
|
---|
33 | */
|
---|
34 | #ifdef DOXYGEN_RUNNING
|
---|
35 | # define IPRT_NT_MAP_TO_ZW
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #ifdef IPRT_NT_MAP_TO_ZW
|
---|
39 | # define NtQueryInformationFile ZwQueryInformationFile
|
---|
40 | # define NtQueryInformationProcess ZwQueryInformationProcess
|
---|
41 | # define NtQueryInformationThread ZwQueryInformationThread
|
---|
42 | # define NtQuerySystemInformation ZwQuerySystemInformation
|
---|
43 | # define NtClose ZwClose
|
---|
44 | # define NtCreateFile ZwCreateFile
|
---|
45 | # define NtReadFile ZwReadFile
|
---|
46 | # define NtWriteFile ZwWriteFile
|
---|
47 | /** @todo this is very incomplete! */
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | #include <ntstatus.h>
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * Hacks common to both base header sets.
|
---|
54 | */
|
---|
55 | #define NtQueryObject Incomplete_NtQueryObject
|
---|
56 | #define ZwQueryObject Incomplete_ZwQueryObject
|
---|
57 | #define NtSetInformationObject Incomplete_NtSetInformationObject
|
---|
58 | #define _OBJECT_INFORMATION_CLASS Incomplete_OBJECT_INFORMATION_CLASS
|
---|
59 | #define OBJECT_INFORMATION_CLASS Incomplete_OBJECT_INFORMATION_CLASS
|
---|
60 | #define ObjectBasicInformation Incomplete_ObjectBasicInformation
|
---|
61 | #define ObjectTypeInformation Incomplete_ObjectTypeInformation
|
---|
62 |
|
---|
63 |
|
---|
64 | #ifdef IPRT_NT_USE_WINTERNL
|
---|
65 | /*
|
---|
66 | * Use Winternl.h.
|
---|
67 | */
|
---|
68 | # define _FILE_INFORMATION_CLASS IncompleteWinternl_FILE_INFORMATION_CLASS
|
---|
69 | # define FILE_INFORMATION_CLASS IncompleteWinternl_FILE_INFORMATION_CLASS
|
---|
70 | # define FileDirectoryInformation IncompleteWinternl_FileDirectoryInformation
|
---|
71 |
|
---|
72 | # define NtQueryInformationProcess IncompleteWinternl_NtQueryInformationProcess
|
---|
73 | # define NtSetInformationProcess IncompleteWinternl_NtSetInformationProcess
|
---|
74 | # define PROCESSINFOCLASS IncompleteWinternl_PROCESSINFOCLASS
|
---|
75 | # define _PROCESSINFOCLASS IncompleteWinternl_PROCESSINFOCLASS
|
---|
76 | # define PROCESS_BASIC_INFORMATION IncompleteWinternl_PROCESS_BASIC_INFORMATION
|
---|
77 | # define PPROCESS_BASIC_INFORMATION IncompleteWinternl_PPROCESS_BASIC_INFORMATION
|
---|
78 | # define _PROCESS_BASIC_INFORMATION IncompleteWinternl_PROCESS_BASIC_INFORMATION
|
---|
79 | # define ProcessBasicInformation IncompleteWinternl_ProcessBasicInformation
|
---|
80 | # define ProcessDebugPort IncompleteWinternl_ProcessDebugPort
|
---|
81 | # define ProcessWow64Information IncompleteWinternl_ProcessWow64Information
|
---|
82 | # define ProcessImageFileName IncompleteWinternl_ProcessImageFileName
|
---|
83 | # define ProcessBreakOnTermination IncompleteWinternl_ProcessBreakOnTermination
|
---|
84 |
|
---|
85 | # define NtQueryInformationThread IncompleteWinternl_NtQueryInformationThread
|
---|
86 | # define NtSetInformationThread IncompleteWinternl_NtSetInformationThread
|
---|
87 | # define THREADINFOCLASS IncompleteWinternl_THREADINFOCLASS
|
---|
88 | # define _THREADINFOCLASS IncompleteWinternl_THREADINFOCLASS
|
---|
89 | # define ThreadIsIoPending IncompleteWinternl_ThreadIsIoPending
|
---|
90 |
|
---|
91 | # define NtQuerySystemInformation IncompleteWinternl_NtQuerySystemInformation
|
---|
92 | # define NtSetSystemInformation IncompleteWinternl_NtSetSystemInformation
|
---|
93 | # define SYSTEM_INFORMATION_CLASS IncompleteWinternl_SYSTEM_INFORMATION_CLASS
|
---|
94 | # define _SYSTEM_INFORMATION_CLASS IncompleteWinternl_SYSTEM_INFORMATION_CLASS
|
---|
95 | # define SystemBasicInformation IncompleteWinternl_SystemBasicInformation
|
---|
96 | # define SystemPerformanceInformation IncompleteWinternl_SystemPerformanceInformation
|
---|
97 | # define SystemTimeOfDayInformation IncompleteWinternl_SystemTimeOfDayInformation
|
---|
98 | # define SystemProcessInformation IncompleteWinternl_SystemProcessInformation
|
---|
99 | # define SystemProcessorPerformanceInformation IncompleteWinternl_SystemProcessorPerformanceInformation
|
---|
100 | # define SystemInterruptInformation IncompleteWinternl_SystemInterruptInformation
|
---|
101 | # define SystemExceptionInformation IncompleteWinternl_SystemExceptionInformation
|
---|
102 | # define SystemRegistryQuotaInformation IncompleteWinternl_SystemRegistryQuotaInformation
|
---|
103 | # define SystemLookasideInformation IncompleteWinternl_SystemLookasideInformation
|
---|
104 | # define SystemPolicyInformation IncompleteWinternl_SystemPolicyInformation
|
---|
105 |
|
---|
106 |
|
---|
107 | # define WIN32_NO_STATUS
|
---|
108 | # include <windef.h>
|
---|
109 | # include <winnt.h>
|
---|
110 | # include <winternl.h>
|
---|
111 | # undef WIN32_NO_STATUS
|
---|
112 | # include <ntstatus.h>
|
---|
113 |
|
---|
114 |
|
---|
115 | # undef _FILE_INFORMATION_CLASS
|
---|
116 | # undef FILE_INFORMATION_CLASS
|
---|
117 | # undef FileDirectoryInformation
|
---|
118 |
|
---|
119 | # undef NtQueryInformationProcess
|
---|
120 | # undef NtSetInformationProcess
|
---|
121 | # undef PROCESSINFOCLASS
|
---|
122 | # undef _PROCESSINFOCLASS
|
---|
123 | # undef PROCESS_BASIC_INFORMATION
|
---|
124 | # undef PPROCESS_BASIC_INFORMATION
|
---|
125 | # undef _PROCESS_BASIC_INFORMATION
|
---|
126 | # undef ProcessBasicInformation
|
---|
127 | # undef ProcessDebugPort
|
---|
128 | # undef ProcessWow64Information
|
---|
129 | # undef ProcessImageFileName
|
---|
130 | # undef ProcessBreakOnTermination
|
---|
131 |
|
---|
132 | # undef NtQueryInformationThread
|
---|
133 | # undef NtSetInformationThread
|
---|
134 | # undef THREADINFOCLASS
|
---|
135 | # undef _THREADINFOCLASS
|
---|
136 | # undef ThreadIsIoPending
|
---|
137 |
|
---|
138 | # undef NtQuerySystemInformation
|
---|
139 | # undef NtSetSystemInformation
|
---|
140 | # undef SYSTEM_INFORMATION_CLASS
|
---|
141 | # undef _SYSTEM_INFORMATION_CLASS
|
---|
142 | # undef SystemBasicInformation
|
---|
143 | # undef SystemPerformanceInformation
|
---|
144 | # undef SystemTimeOfDayInformation
|
---|
145 | # undef SystemProcessInformation
|
---|
146 | # undef SystemProcessorPerformanceInformation
|
---|
147 | # undef SystemInterruptInformation
|
---|
148 | # undef SystemExceptionInformation
|
---|
149 | # undef SystemRegistryQuotaInformation
|
---|
150 | # undef SystemLookasideInformation
|
---|
151 | # undef SystemPolicyInformation
|
---|
152 |
|
---|
153 | #else
|
---|
154 | /*
|
---|
155 | * Use ntifs.h and wdm.h.
|
---|
156 | */
|
---|
157 | # ifdef RT_ARCH_X86
|
---|
158 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
|
---|
159 | # pragma warning(disable : 4163)
|
---|
160 | # endif
|
---|
161 |
|
---|
162 | # include <ntifs.h>
|
---|
163 | # include <wdm.h>
|
---|
164 |
|
---|
165 | # ifdef RT_ARCH_X86
|
---|
166 | # pragma warning(default : 4163)
|
---|
167 | # undef _InterlockedAddLargeStatistic
|
---|
168 | # endif
|
---|
169 |
|
---|
170 | # define IPRT_NT_NEED_API_GROUP_NTIFS
|
---|
171 | #endif
|
---|
172 |
|
---|
173 | #undef NtQueryObject
|
---|
174 | #undef ZwQueryObject
|
---|
175 | #undef NtSetInformationObject
|
---|
176 | #undef _OBJECT_INFORMATION_CLASS
|
---|
177 | #undef OBJECT_INFORMATION_CLASS
|
---|
178 | #undef ObjectBasicInformation
|
---|
179 | #undef ObjectTypeInformation
|
---|
180 |
|
---|
181 | #include <iprt/types.h>
|
---|
182 |
|
---|
183 |
|
---|
184 | /** @name Useful macros
|
---|
185 | * @{ */
|
---|
186 | /** Indicates that we're targetting native NT in the current source. */
|
---|
187 | #define RTNT_USE_NATIVE_NT 1
|
---|
188 | /** Initializes a IO_STATUS_BLOCK. */
|
---|
189 | #define RTNT_IO_STATUS_BLOCK_INITIALIZER { STATUS_FAILED_DRIVER_ENTRY, ~(uintptr_t)42 }
|
---|
190 | /** Similar to INVALID_HANDLE_VALUE in the Windows environment. */
|
---|
191 | #define RTNT_INVALID_HANDLE_VALUE ( (HANDLE)~(uintptr_t)0 )
|
---|
192 | /** @} */
|
---|
193 |
|
---|
194 |
|
---|
195 | /** @name IPRT helper functions for NT
|
---|
196 | * @{ */
|
---|
197 | RT_C_DECLS_BEGIN
|
---|
198 |
|
---|
199 | RTDECL(int) RTNtPathOpen(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess,
|
---|
200 | ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs,
|
---|
201 | PHANDLE phHandle, PULONG_PTR puDisposition);
|
---|
202 | RTDECL(int) RTNtPathOpenDir(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fShareAccess, ULONG fCreateOptions,
|
---|
203 | ULONG fObjAttribs, PHANDLE phHandle, bool *pfObjDir);
|
---|
204 | RTDECL(int) RTNtPathClose(HANDLE hHandle);
|
---|
205 |
|
---|
206 | RT_C_DECLS_END
|
---|
207 | /** @} */
|
---|
208 |
|
---|
209 |
|
---|
210 | /** @name NT API delcarations.
|
---|
211 | * @{ */
|
---|
212 | RT_C_DECLS_BEGIN
|
---|
213 |
|
---|
214 | /** @name Process access rights missing in ntddk headers
|
---|
215 | * @{ */
|
---|
216 | #ifndef PROCESS_TERMINATE
|
---|
217 | # define PROCESS_TERMINATE UINT32_C(0x00000001)
|
---|
218 | #endif
|
---|
219 | #ifndef PROCESS_CREATE_THREAD
|
---|
220 | # define PROCESS_CREATE_THREAD UINT32_C(0x00000002)
|
---|
221 | #endif
|
---|
222 | #ifndef PROCESS_SET_SESSIONID
|
---|
223 | # define PROCESS_SET_SESSIONID UINT32_C(0x00000004)
|
---|
224 | #endif
|
---|
225 | #ifndef PROCESS_VM_OPERATION
|
---|
226 | # define PROCESS_VM_OPERATION UINT32_C(0x00000008)
|
---|
227 | #endif
|
---|
228 | #ifndef PROCESS_VM_READ
|
---|
229 | # define PROCESS_VM_READ UINT32_C(0x00000010)
|
---|
230 | #endif
|
---|
231 | #ifndef PROCESS_VM_WRITE
|
---|
232 | # define PROCESS_VM_WRITE UINT32_C(0x00000020)
|
---|
233 | #endif
|
---|
234 | #ifndef PROCESS_DUP_HANDLE
|
---|
235 | # define PROCESS_DUP_HANDLE UINT32_C(0x00000040)
|
---|
236 | #endif
|
---|
237 | #ifndef PROCESS_CREATE_PROCESS
|
---|
238 | # define PROCESS_CREATE_PROCESS UINT32_C(0x00000080)
|
---|
239 | #endif
|
---|
240 | #ifndef PROCESS_SET_QUOTA
|
---|
241 | # define PROCESS_SET_QUOTA UINT32_C(0x00000100)
|
---|
242 | #endif
|
---|
243 | #ifndef PROCESS_SET_INFORMATION
|
---|
244 | # define PROCESS_SET_INFORMATION UINT32_C(0x00000200)
|
---|
245 | #endif
|
---|
246 | #ifndef PROCESS_QUERY_INFORMATION
|
---|
247 | # define PROCESS_QUERY_INFORMATION UINT32_C(0x00000400)
|
---|
248 | #endif
|
---|
249 | #ifndef PROCESS_SUSPEND_RESUME
|
---|
250 | # define PROCESS_SUSPEND_RESUME UINT32_C(0x00000800)
|
---|
251 | #endif
|
---|
252 | #ifndef PROCESS_QUERY_LIMITED_INFORMATION
|
---|
253 | # define PROCESS_QUERY_LIMITED_INFORMATION UINT32_C(0x00001000)
|
---|
254 | #endif
|
---|
255 | #ifndef PROCESS_SET_LIMITED_INFORMATION
|
---|
256 | # define PROCESS_SET_LIMITED_INFORMATION UINT32_C(0x00002000)
|
---|
257 | #endif
|
---|
258 | #define PROCESS_UNKNOWN_4000 UINT32_C(0x00004000)
|
---|
259 | #define PROCESS_UNKNOWN_6000 UINT32_C(0x00008000)
|
---|
260 | #ifndef PROCESS_ALL_ACCESS
|
---|
261 | # define PROCESS_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | UINT32_C(0x0000ffff) )
|
---|
262 | #endif
|
---|
263 | /** @} */
|
---|
264 |
|
---|
265 | /** @name Thread access rights missing in ntddk headers
|
---|
266 | * @{ */
|
---|
267 | #ifndef THREAD_QUERY_INFORMATION
|
---|
268 | # define THREAD_QUERY_INFORMATION UINT32_C(0x00000040)
|
---|
269 | #endif
|
---|
270 | #ifndef THREAD_SET_THREAD_TOKEN
|
---|
271 | # define THREAD_SET_THREAD_TOKEN UINT32_C(0x00000080)
|
---|
272 | #endif
|
---|
273 | #ifndef THREAD_IMPERSONATE
|
---|
274 | # define THREAD_IMPERSONATE UINT32_C(0x00000100)
|
---|
275 | #endif
|
---|
276 | #ifndef THREAD_DIRECT_IMPERSONATION
|
---|
277 | # define THREAD_DIRECT_IMPERSONATION UINT32_C(0x00000200)
|
---|
278 | #endif
|
---|
279 | #ifndef THREAD_RESUME
|
---|
280 | # define THREAD_RESUME UINT32_C(0x00001000)
|
---|
281 | #endif
|
---|
282 | #define THREAD_UNKNOWN_2000 UINT32_C(0x00002000)
|
---|
283 | #define THREAD_UNKNOWN_4000 UINT32_C(0x00004000)
|
---|
284 | #define THREAD_UNKNOWN_8000 UINT32_C(0x00008000)
|
---|
285 | /** @} */
|
---|
286 |
|
---|
287 | /** @name Special handle values.
|
---|
288 | * @{ */
|
---|
289 | #ifndef NtCurrentProcess
|
---|
290 | # define NtCurrentProcess() ( (HANDLE)-(intptr_t)1 )
|
---|
291 | #endif
|
---|
292 | #ifndef NtCurrentThread
|
---|
293 | # define NtCurrentThread() ( (HANDLE)-(intptr_t)2 )
|
---|
294 | #endif
|
---|
295 | #ifndef ZwCurrentProcess
|
---|
296 | # define ZwCurrentProcess() NtCurrentProcess()
|
---|
297 | #endif
|
---|
298 | #ifndef ZwCurrentThread
|
---|
299 | # define ZwCurrentThread() NtCurrentThread()
|
---|
300 | #endif
|
---|
301 | /** @} */
|
---|
302 |
|
---|
303 |
|
---|
304 | /** @name Directory object access rights.
|
---|
305 | * @{ */
|
---|
306 | #ifndef DIRECTORY_QUERY
|
---|
307 | # define DIRECTORY_QUERY UINT32_C(0x00000001)
|
---|
308 | #endif
|
---|
309 | #ifndef DIRECTORY_TRAVERSE
|
---|
310 | # define DIRECTORY_TRAVERSE UINT32_C(0x00000002)
|
---|
311 | #endif
|
---|
312 | #ifndef DIRECTORY_CREATE_OBJECT
|
---|
313 | # define DIRECTORY_CREATE_OBJECT UINT32_C(0x00000004)
|
---|
314 | #endif
|
---|
315 | #ifndef DIRECTORY_CREATE_SUBDIRECTORY
|
---|
316 | # define DIRECTORY_CREATE_SUBDIRECTORY UINT32_C(0x00000008)
|
---|
317 | #endif
|
---|
318 | #ifndef DIRECTORY_ALL_ACCESS
|
---|
319 | # define DIRECTORY_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | UINT32_C(0x0000000f) )
|
---|
320 | #endif
|
---|
321 | /** @} */
|
---|
322 |
|
---|
323 |
|
---|
324 | #ifdef IPRT_NT_USE_WINTERNL
|
---|
325 | typedef struct _CLIENT_ID
|
---|
326 | {
|
---|
327 | HANDLE UniqueProcess;
|
---|
328 | HANDLE UniqueThread;
|
---|
329 | } CLIENT_ID;
|
---|
330 | typedef CLIENT_ID *PCLIENT_ID;
|
---|
331 |
|
---|
332 | NTSYSAPI NTSTATUS NTAPI NtCreateSection(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PLARGE_INTEGER, ULONG, ULONG, HANDLE);
|
---|
333 |
|
---|
334 | typedef struct _FILE_FS_ATTRIBUTE_INFORMATION
|
---|
335 | {
|
---|
336 | ULONG FileSystemAttributes;
|
---|
337 | LONG MaximumComponentNameLength;
|
---|
338 | ULONG FileSystemNameLength;
|
---|
339 | WCHAR FileSystemName[1];
|
---|
340 | } FILE_FS_ATTRIBUTE_INFORMATION;
|
---|
341 | typedef FILE_FS_ATTRIBUTE_INFORMATION *PFILE_FS_ATTRIBUTE_INFORMATION;
|
---|
342 |
|
---|
343 | NTSYSAPI NTSTATUS NTAPI NtOpenProcessToken(HANDLE, ACCESS_MASK, PHANDLE);
|
---|
344 | NTSYSAPI NTSTATUS NTAPI NtOpenThreadToken(HANDLE, ACCESS_MASK, BOOLEAN, PHANDLE);
|
---|
345 |
|
---|
346 | typedef enum _FSINFOCLASS
|
---|
347 | {
|
---|
348 | FileFsVolumeInformation = 1,
|
---|
349 | FileFsLabelInformation,
|
---|
350 | FileFsSizeInformation,
|
---|
351 | FileFsDeviceInformation,
|
---|
352 | FileFsAttributeInformation,
|
---|
353 | FileFsControlInformation,
|
---|
354 | FileFsFullSizeInformation,
|
---|
355 | FileFsObjectIdInformation,
|
---|
356 | FileFsDriverPathInformation,
|
---|
357 | FileFsVolumeFlagsInformation,
|
---|
358 | FileFsSectorSizeInformation,
|
---|
359 | FileFsDataCopyInformation,
|
---|
360 | FileFsMaximumInformation
|
---|
361 | } FS_INFORMATION_CLASS;
|
---|
362 | typedef FS_INFORMATION_CLASS *PFS_INFORMATION_CLASS;
|
---|
363 | NTSYSAPI NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FS_INFORMATION_CLASS);
|
---|
364 |
|
---|
365 | typedef struct _FILE_BOTH_DIR_INFORMATION
|
---|
366 | {
|
---|
367 | ULONG NextEntryOffset;
|
---|
368 | ULONG FileIndex;
|
---|
369 | LARGE_INTEGER CreationTime;
|
---|
370 | LARGE_INTEGER LastAccessTime;
|
---|
371 | LARGE_INTEGER LastWriteTime;
|
---|
372 | LARGE_INTEGER ChangeTime;
|
---|
373 | LARGE_INTEGER EndOfFile;
|
---|
374 | LARGE_INTEGER AllocationSize;
|
---|
375 | ULONG FileAttributes;
|
---|
376 | ULONG FileNameLength;
|
---|
377 | ULONG EaSize;
|
---|
378 | CCHAR ShortNameLength;
|
---|
379 | WCHAR ShortName[12];
|
---|
380 | WCHAR FileName[1];
|
---|
381 | } FILE_BOTH_DIR_INFORMATION;
|
---|
382 | typedef FILE_BOTH_DIR_INFORMATION *PFILE_BOTH_DIR_INFORMATION;
|
---|
383 | typedef struct _FILE_STANDARD_INFORMATION
|
---|
384 | {
|
---|
385 | LARGE_INTEGER AllocationSize;
|
---|
386 | LARGE_INTEGER EndOfFile;
|
---|
387 | ULONG NumberOfLinks;
|
---|
388 | BOOLEAN DeletePending;
|
---|
389 | BOOLEAN Directory;
|
---|
390 | } FILE_STANDARD_INFORMATION;
|
---|
391 | typedef FILE_STANDARD_INFORMATION *PFILE_STANDARD_INFORMATION;
|
---|
392 | typedef struct _FILE_NAME_INFORMATION
|
---|
393 | {
|
---|
394 | ULONG FileNameLength;
|
---|
395 | WCHAR FileName[1];
|
---|
396 | } FILE_NAME_INFORMATION;
|
---|
397 | typedef FILE_NAME_INFORMATION *PFILE_NAME_INFORMATION;
|
---|
398 | typedef enum _FILE_INFORMATION_CLASS
|
---|
399 | {
|
---|
400 | FileDirectoryInformation = 1,
|
---|
401 | FileFullDirectoryInformation,
|
---|
402 | FileBothDirectoryInformation,
|
---|
403 | FileBasicInformation,
|
---|
404 | FileStandardInformation,
|
---|
405 | FileInternalInformation,
|
---|
406 | FileEaInformation,
|
---|
407 | FileAccessInformation,
|
---|
408 | FileNameInformation,
|
---|
409 | FileRenameInformation,
|
---|
410 | FileLinkInformation,
|
---|
411 | FileNamesInformation,
|
---|
412 | FileDispositionInformation,
|
---|
413 | FilePositionInformation,
|
---|
414 | FileFullEaInformation,
|
---|
415 | FileModeInformation,
|
---|
416 | FileAlignmentInformation,
|
---|
417 | FileAllInformation,
|
---|
418 | FileAllocationInformation,
|
---|
419 | FileEndOfFileInformation,
|
---|
420 | FileAlternateNameInformation,
|
---|
421 | FileStreamInformation,
|
---|
422 | FilePipeInformation,
|
---|
423 | FilePipeLocalInformation,
|
---|
424 | FilePipeRemoteInformation,
|
---|
425 | FileMailslotQueryInformation,
|
---|
426 | FileMailslotSetInformation,
|
---|
427 | FileCompressionInformation,
|
---|
428 | FileObjectIdInformation,
|
---|
429 | FileCompletionInformation,
|
---|
430 | FileMoveClusterInformation,
|
---|
431 | FileQuotaInformation,
|
---|
432 | FileReparsePointInformation,
|
---|
433 | FileNetworkOpenInformation,
|
---|
434 | FileAttributeTagInformation,
|
---|
435 | FileTrackingInformation,
|
---|
436 | FileIdBothDirectoryInformation,
|
---|
437 | FileIdFullDirectoryInformation,
|
---|
438 | FileValidDataLengthInformation,
|
---|
439 | FileShortNameInformation,
|
---|
440 | FileIoCompletionNotificationInformation,
|
---|
441 | FileIoStatusBlockRangeInformation,
|
---|
442 | FileIoPriorityHintInformation,
|
---|
443 | FileSfioReserveInformation,
|
---|
444 | FileSfioVolumeInformation,
|
---|
445 | FileHardLinkInformation,
|
---|
446 | FileProcessIdsUsingFileInformation,
|
---|
447 | FileNormalizedNameInformation,
|
---|
448 | FileNetworkPhysicalNameInformation,
|
---|
449 | FileIdGlobalTxDirectoryInformation,
|
---|
450 | FileIsRemoteDeviceInformation,
|
---|
451 | FileUnusedInformation,
|
---|
452 | FileNumaNodeInformation,
|
---|
453 | FileStandardLinkInformation,
|
---|
454 | FileRemoteProtocolInformation,
|
---|
455 | FileRenameInformationBypassAccessCheck,
|
---|
456 | FileLinkInformationBypassAccessCheck,
|
---|
457 | FileVolumeNameInformation,
|
---|
458 | FileIdInformation,
|
---|
459 | FileIdExtdDirectoryInformation,
|
---|
460 | FileReplaceCompletionInformation,
|
---|
461 | FileHardLinkFullIdInformation,
|
---|
462 | FileMaximumInformation
|
---|
463 | } FILE_INFORMATION_CLASS;
|
---|
464 | typedef FILE_INFORMATION_CLASS *PFILE_INFORMATION_CLASS;
|
---|
465 | NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FILE_INFORMATION_CLASS);
|
---|
466 |
|
---|
467 | typedef struct _MEMORY_SECTION_NAME
|
---|
468 | {
|
---|
469 | UNICODE_STRING SectionFileName;
|
---|
470 | WCHAR NameBuffer[1];
|
---|
471 | } MEMORY_SECTION_NAME;
|
---|
472 |
|
---|
473 | #ifdef IPRT_NT_USE_WINTERNL
|
---|
474 | typedef struct _PROCESS_BASIC_INFORMATION
|
---|
475 | {
|
---|
476 | NTSTATUS ExitStatus;
|
---|
477 | PPEB PebBaseAddress;
|
---|
478 | ULONG_PTR AffinityMask;
|
---|
479 | int32_t BasePriority;
|
---|
480 | ULONG_PTR UniqueProcessId;
|
---|
481 | ULONG_PTR InheritedFromUniqueProcessId;
|
---|
482 | } PROCESS_BASIC_INFORMATION;
|
---|
483 | typedef PROCESS_BASIC_INFORMATION *PPROCESS_BASIC_INFORMATION;
|
---|
484 | #endif
|
---|
485 |
|
---|
486 | typedef enum _PROCESSINFOCLASS
|
---|
487 | {
|
---|
488 | ProcessBasicInformation = 0,
|
---|
489 | ProcessQuotaLimits,
|
---|
490 | ProcessIoCounters,
|
---|
491 | ProcessVmCounters,
|
---|
492 | ProcessTimes,
|
---|
493 | ProcessBasePriority,
|
---|
494 | ProcessRaisePriority,
|
---|
495 | ProcessDebugPort,
|
---|
496 | ProcessExceptionPort,
|
---|
497 | ProcessAccessToken,
|
---|
498 | ProcessLdtInformation,
|
---|
499 | ProcessLdtSize,
|
---|
500 | ProcessDefaultHardErrorMode,
|
---|
501 | ProcessIoPortHandlers,
|
---|
502 | ProcessPooledUsageAndLimits,
|
---|
503 | ProcessWorkingSetWatch,
|
---|
504 | ProcessUserModeIOPL,
|
---|
505 | ProcessEnableAlignmentFaultFixup,
|
---|
506 | ProcessPriorityClass,
|
---|
507 | ProcessWx86Information,
|
---|
508 | ProcessHandleCount,
|
---|
509 | ProcessAffinityMask,
|
---|
510 | ProcessPriorityBoost,
|
---|
511 | ProcessDeviceMap,
|
---|
512 | ProcessSessionInformation,
|
---|
513 | ProcessForegroundInformation,
|
---|
514 | ProcessWow64Information,
|
---|
515 | ProcessImageFileName,
|
---|
516 | ProcessLUIDDeviceMapsEnabled,
|
---|
517 | ProcessBreakOnTermination,
|
---|
518 | ProcessDebugObjectHandle,
|
---|
519 | ProcessDebugFlags,
|
---|
520 | ProcessHandleTracing,
|
---|
521 | ProcessIoPriority,
|
---|
522 | ProcessExecuteFlags,
|
---|
523 | ProcessTlsInformation,
|
---|
524 | ProcessCookie,
|
---|
525 | ProcessImageInformation,
|
---|
526 | ProcessCycleTime,
|
---|
527 | ProcessPagePriority,
|
---|
528 | ProcessInstrumentationCallbak,
|
---|
529 | ProcessThreadStackAllocation,
|
---|
530 | ProcessWorkingSetWatchEx,
|
---|
531 | ProcessImageFileNameWin32,
|
---|
532 | ProcessImageFileMapping,
|
---|
533 | ProcessAffinityUpdateMode,
|
---|
534 | ProcessMemoryAllocationMode,
|
---|
535 | ProcessGroupInformation,
|
---|
536 | ProcessTokenVirtualizationEnabled,
|
---|
537 | ProcessConsoleHostProcess,
|
---|
538 | ProcessWindowsInformation,
|
---|
539 | MaxProcessInfoClass
|
---|
540 | } PROCESSINFOCLASS;
|
---|
541 | NTSYSAPI NTSTATUS NTAPI NtQueryInformationProcess(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
|
---|
542 |
|
---|
543 | typedef enum _THREADINFOCLASS
|
---|
544 | {
|
---|
545 | ThreadBasicInformation = 0,
|
---|
546 | ThreadTimes,
|
---|
547 | ThreadPriority,
|
---|
548 | ThreadBasePriority,
|
---|
549 | ThreadAffinityMask,
|
---|
550 | ThreadImpersonationToken,
|
---|
551 | ThreadDescriptorTableEntry,
|
---|
552 | ThreadEnableAlignmentFaultFixup,
|
---|
553 | ThreadEventPair_Reusable,
|
---|
554 | ThreadQuerySetWin32StartAddress,
|
---|
555 | ThreadZeroTlsCell,
|
---|
556 | ThreadPerformanceCount,
|
---|
557 | ThreadAmILastThread,
|
---|
558 | ThreadIdealProcessor,
|
---|
559 | ThreadPriorityBoost,
|
---|
560 | ThreadSetTlsArrayAddress,
|
---|
561 | ThreadIsIoPending,
|
---|
562 | ThreadHideFromDebugger,
|
---|
563 | ThreadBreakOnTermination,
|
---|
564 | ThreadSwitchLegacyState,
|
---|
565 | ThreadIsTerminated,
|
---|
566 | ThreadLastSystemCall,
|
---|
567 | ThreadIoPriority,
|
---|
568 | ThreadCycleTime,
|
---|
569 | ThreadPagePriority,
|
---|
570 | ThreadActualBasePriority,
|
---|
571 | ThreadTebInformation,
|
---|
572 | ThreadCSwitchMon,
|
---|
573 | ThreadCSwitchPmu,
|
---|
574 | ThreadWow64Context,
|
---|
575 | ThreadGroupInformation,
|
---|
576 | ThreadUmsInformation,
|
---|
577 | ThreadCounterProfiling,
|
---|
578 | ThreadIdealProcessorEx,
|
---|
579 | ThreadCpuAccountingInformation,
|
---|
580 | MaxThreadInfoClass
|
---|
581 | } THREADINFOCLASS;
|
---|
582 | NTSYSAPI NTSTATUS NTAPI NtSetInformationThread(HANDLE, THREADINFOCLASS, LPCVOID, ULONG);
|
---|
583 |
|
---|
584 | NTSYSAPI NTSTATUS NTAPI NtQueryInformationToken(HANDLE, TOKEN_INFORMATION_CLASS, PVOID, ULONG, PULONG);
|
---|
585 |
|
---|
586 | NTSYSAPI NTSTATUS NTAPI NtReadFile(HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID, PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER, PULONG);
|
---|
587 | NTSYSAPI NTSTATUS NTAPI NtWriteFile(HANDLE, HANDLE, PIO_APC_ROUTINE, void const *, PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER, PULONG);
|
---|
588 |
|
---|
589 | NTSYSAPI NTSTATUS NTAPI NtReadVirtualMemory(HANDLE, PVOID, PVOID, SIZE_T, PSIZE_T);
|
---|
590 | NTSYSAPI NTSTATUS NTAPI NtWriteVirtualMemory(HANDLE, PVOID, void const *, SIZE_T, PSIZE_T);
|
---|
591 |
|
---|
592 | NTSYSAPI NTSTATUS NTAPI RtlAddAccessAllowedAce(PACL, ULONG, ULONG, PSID);
|
---|
593 | NTSYSAPI NTSTATUS NTAPI RtlCopySid(ULONG, PSID, PSID);
|
---|
594 | NTSYSAPI NTSTATUS NTAPI RtlCreateAcl(PACL, ULONG, ULONG);
|
---|
595 | NTSYSAPI NTSTATUS NTAPI RtlCreateSecurityDescriptor(PSECURITY_DESCRIPTOR, ULONG);
|
---|
596 | NTSYSAPI NTSTATUS NTAPI RtlGetVersion(PRTL_OSVERSIONINFOW);
|
---|
597 | NTSYSAPI NTSTATUS NTAPI RtlInitializeSid(PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
|
---|
598 | NTSYSAPI NTSTATUS NTAPI RtlSetDaclSecurityDescriptor(PSECURITY_DESCRIPTOR, BOOLEAN, PACL, BOOLEAN);
|
---|
599 | NTSYSAPI PULONG NTAPI RtlSubAuthoritySid(PSID, ULONG);
|
---|
600 |
|
---|
601 | #endif /* IPRT_NT_USE_WINTERNL */
|
---|
602 |
|
---|
603 | typedef enum _OBJECT_INFORMATION_CLASS
|
---|
604 | {
|
---|
605 | ObjectBasicInformation = 0,
|
---|
606 | ObjectNameInformation,
|
---|
607 | ObjectTypeInformation,
|
---|
608 | ObjectAllInformation,
|
---|
609 | ObjectDataInformation
|
---|
610 | } OBJECT_INFORMATION_CLASS;
|
---|
611 | typedef OBJECT_INFORMATION_CLASS *POBJECT_INFORMATION_CLASS;
|
---|
612 | #ifdef IN_RING0
|
---|
613 | # define NtQueryObject ZwQueryObject
|
---|
614 | #endif
|
---|
615 | NTSYSAPI NTSTATUS NTAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
|
---|
616 | NTSYSAPI NTSTATUS NTAPI NtSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG);
|
---|
617 | NTSYSAPI NTSTATUS NTAPI NtDuplicateObject(HANDLE, HANDLE, HANDLE, PHANDLE, ACCESS_MASK, ULONG, ULONG);
|
---|
618 |
|
---|
619 | NTSYSAPI NTSTATUS NTAPI NtOpenDirectoryObject(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
---|
620 |
|
---|
621 | typedef struct _OBJECT_DIRECTORY_INFORMATION
|
---|
622 | {
|
---|
623 | UNICODE_STRING Name;
|
---|
624 | UNICODE_STRING TypeName;
|
---|
625 | } OBJECT_DIRECTORY_INFORMATION;
|
---|
626 | typedef OBJECT_DIRECTORY_INFORMATION *POBJECT_DIRECTORY_INFORMATION;
|
---|
627 | NTSYSAPI NTSTATUS NTAPI NtQueryDirectoryObject(HANDLE, PVOID, ULONG, BOOLEAN, BOOLEAN, PULONG, PULONG);
|
---|
628 |
|
---|
629 | /** Retured by ProcessImageInformation as well as NtQuerySection. */
|
---|
630 | typedef struct _SECTION_IMAGE_INFORMATION
|
---|
631 | {
|
---|
632 | PVOID TransferAddress;
|
---|
633 | ULONG ZeroBits;
|
---|
634 | SIZE_T MaximumStackSize;
|
---|
635 | SIZE_T CommittedStackSize;
|
---|
636 | ULONG SubSystemType;
|
---|
637 | union
|
---|
638 | {
|
---|
639 | struct
|
---|
640 | {
|
---|
641 | USHORT SubSystemMinorVersion;
|
---|
642 | USHORT SubSystemMajorVersion;
|
---|
643 | };
|
---|
644 | ULONG SubSystemVersion;
|
---|
645 | };
|
---|
646 | ULONG GpValue;
|
---|
647 | USHORT ImageCharacteristics;
|
---|
648 | USHORT DllCharacteristics;
|
---|
649 | USHORT Machine;
|
---|
650 | BOOLEAN ImageContainsCode;
|
---|
651 | union /**< Since Vista, used to be a spare BOOLEAN. */
|
---|
652 | {
|
---|
653 | struct
|
---|
654 | {
|
---|
655 | UCHAR ComPlusNativeRead : 1;
|
---|
656 | UCHAR ComPlusILOnly : 1;
|
---|
657 | UCHAR ImageDynamicallyRelocated : 1;
|
---|
658 | UCHAR ImageMAppedFlat : 1;
|
---|
659 | UCHAR Reserved : 4;
|
---|
660 | };
|
---|
661 | UCHAR ImageFlags;
|
---|
662 | };
|
---|
663 | ULONG LoaderFlags;
|
---|
664 | ULONG ImageFileSize; /**< Since XP? */
|
---|
665 | ULONG CheckSum; /**< Since Vista, Used to be a reserved/spare ULONG. */
|
---|
666 | } SECTION_IMAGE_INFORMATION;
|
---|
667 | typedef SECTION_IMAGE_INFORMATION *PSECTION_IMAGE_INFORMATION;
|
---|
668 |
|
---|
669 | typedef enum _SECTION_INFORMATION_CLASS
|
---|
670 | {
|
---|
671 | SectionBasicInformation = 0,
|
---|
672 | SectionImageInformation,
|
---|
673 | MaxSectionInfoClass
|
---|
674 | } SECTION_INFORMATION_CLASS;
|
---|
675 | NTSYSAPI NTSTATUS NTAPI NtQuerySection(HANDLE, SECTION_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T);
|
---|
676 |
|
---|
677 | NTSYSAPI NTSTATUS NTAPI NtQueryInformationThread(HANDLE, THREADINFOCLASS, PVOID, ULONG, PULONG);
|
---|
678 |
|
---|
679 | #ifndef SEC_FILE
|
---|
680 | # define SEC_FILE UINT32_C(0x00800000)
|
---|
681 | #endif
|
---|
682 | #ifndef SEC_IMAGE
|
---|
683 | # define SEC_IMAGE UINT32_C(0x01000000)
|
---|
684 | #endif
|
---|
685 | #ifndef SEC_PROTECTED_IMAGE
|
---|
686 | # define SEC_PROTECTED_IMAGE UINT32_C(0x02000000)
|
---|
687 | #endif
|
---|
688 | #ifndef SEC_NOCACHE
|
---|
689 | # define SEC_NOCACHE UINT32_C(0x10000000)
|
---|
690 | #endif
|
---|
691 | #ifndef MEM_ROTATE
|
---|
692 | # define MEM_ROTATE UINT32_C(0x00800000)
|
---|
693 | #endif
|
---|
694 | typedef enum _MEMORY_INFORMATION_CLASS
|
---|
695 | {
|
---|
696 | MemoryBasicInformation = 0,
|
---|
697 | MemoryWorkingSetList,
|
---|
698 | MemorySectionName,
|
---|
699 | MemoryBasicVlmInformation
|
---|
700 | } MEMORY_INFORMATION_CLASS;
|
---|
701 | #ifdef IN_RING0
|
---|
702 | typedef struct _MEMORY_BASIC_INFORMATION
|
---|
703 | {
|
---|
704 | PVOID BaseAddress;
|
---|
705 | PVOID AllocationBase;
|
---|
706 | ULONG AllocationProtect;
|
---|
707 | SIZE_T RegionSize;
|
---|
708 | ULONG State;
|
---|
709 | ULONG Protect;
|
---|
710 | ULONG Type;
|
---|
711 | } MEMORY_BASIC_INFORMATION;
|
---|
712 | typedef MEMORY_BASIC_INFORMATION *PMEMORY_BASIC_INFORMATION;
|
---|
713 | # define NtQueryVirtualMemory ZwQueryVirtualMemory
|
---|
714 | #endif
|
---|
715 | NTSYSAPI NTSTATUS NTAPI NtQueryVirtualMemory(HANDLE, void const *, MEMORY_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T);
|
---|
716 |
|
---|
717 | typedef enum _SYSTEM_INFORMATION_CLASS
|
---|
718 | {
|
---|
719 | SystemBasicInformation = 0,
|
---|
720 | SystemCpuInformation,
|
---|
721 | SystemPerformanceInformation,
|
---|
722 | SystemTimeOfDayInformation,
|
---|
723 | SystemInformation_Unknown_4,
|
---|
724 | SystemProcessInformation,
|
---|
725 | SystemInformation_Unknown_6,
|
---|
726 | SystemInformation_Unknown_7,
|
---|
727 | SystemProcessorPerformanceInformation,
|
---|
728 | SystemInformation_Unknown_9,
|
---|
729 | SystemInformation_Unknown_10,
|
---|
730 | SystemModuleInformation,
|
---|
731 | SystemInformation_Unknown_12,
|
---|
732 | SystemInformation_Unknown_13,
|
---|
733 | SystemInformation_Unknown_14,
|
---|
734 | SystemInformation_Unknown_15,
|
---|
735 | SystemHandleInformation,
|
---|
736 | SystemInformation_Unknown_17,
|
---|
737 | SystemPageFileInformation,
|
---|
738 | SystemInformation_Unknown_19,
|
---|
739 | SystemInformation_Unknown_20,
|
---|
740 | SystemCacheInformation,
|
---|
741 | SystemInformation_Unknown_22,
|
---|
742 | SystemInterruptInformation,
|
---|
743 | SystemDpcBehaviourInformation,
|
---|
744 | SystemFullMemoryInformation,
|
---|
745 | SystemLoadGdiDriverInformation, /* 26 */
|
---|
746 | SystemUnloadGdiDriverInformation, /* 27 */
|
---|
747 | SystemTimeAdjustmentInformation,
|
---|
748 | SystemSummaryMemoryInformation,
|
---|
749 | SystemInformation_Unknown_30,
|
---|
750 | SystemInformation_Unknown_31,
|
---|
751 | SystemInformation_Unknown_32,
|
---|
752 | SystemExceptionInformation,
|
---|
753 | SystemCrashDumpStateInformation,
|
---|
754 | SystemKernelDebuggerInformation,
|
---|
755 | SystemContextSwitchInformation,
|
---|
756 | SystemRegistryQuotaInformation,
|
---|
757 | SystemInformation_Unknown_38,
|
---|
758 | SystemInformation_Unknown_39,
|
---|
759 | SystemInformation_Unknown_40,
|
---|
760 | SystemInformation_Unknown_41,
|
---|
761 | SystemInformation_Unknown_42,
|
---|
762 | SystemInformation_Unknown_43,
|
---|
763 | SystemCurrentTimeZoneInformation,
|
---|
764 | SystemLookasideInformation,
|
---|
765 | SystemSetTimeSlipEvent,
|
---|
766 | SystemCreateSession,
|
---|
767 | SystemDeleteSession,
|
---|
768 | SystemInformation_Unknown_49,
|
---|
769 | SystemRangeStartInformation,
|
---|
770 | SystemVerifierInformation,
|
---|
771 | SystemInformation_Unknown_52,
|
---|
772 | SystemSessionProcessInformation,
|
---|
773 | SystemLoadGdiDriverInSystemSpaceInformation, /* 54 */
|
---|
774 | SystemInformation_Unknown_55,
|
---|
775 | SystemInformation_Unknown_56,
|
---|
776 | SystemExtendedProcessInformation,
|
---|
777 | SystemInformation_Unknown_58,
|
---|
778 | SystemInformation_Unknown_59,
|
---|
779 | SystemInformation_Unknown_60,
|
---|
780 | SystemInformation_Unknown_61,
|
---|
781 | SystemInformation_Unknown_62,
|
---|
782 | SystemInformation_Unknown_63,
|
---|
783 | SystemExtendedHandleInformation, /* 64 */
|
---|
784 |
|
---|
785 | /** @todo fill gap. they've added a whole bunch of things */
|
---|
786 | SystemPolicyInformation = 134,
|
---|
787 | SystemInformationClassMax
|
---|
788 | } SYSTEM_INFORMATION_CLASS;
|
---|
789 |
|
---|
790 | #ifdef IPRT_NT_USE_WINTERNL
|
---|
791 | typedef struct _VM_COUNTERS
|
---|
792 | {
|
---|
793 | SIZE_T PeakVirtualSize;
|
---|
794 | SIZE_T VirtualSize;
|
---|
795 | ULONG PageFaultCount;
|
---|
796 | SIZE_T PeakWorkingSetSize;
|
---|
797 | SIZE_T WorkingSetSize;
|
---|
798 | SIZE_T QuotaPeakPagedPoolUsage;
|
---|
799 | SIZE_T QuotaPagedPoolUsage;
|
---|
800 | SIZE_T QuotaPeakNonPagedPoolUsage;
|
---|
801 | SIZE_T QuotaNonPagedPoolUsage;
|
---|
802 | SIZE_T PagefileUsage;
|
---|
803 | SIZE_T PeakPagefileUsage;
|
---|
804 | } VM_COUNTERS;
|
---|
805 | typedef VM_COUNTERS *PVM_COUNTERS;
|
---|
806 | #endif
|
---|
807 |
|
---|
808 | #if 0
|
---|
809 | typedef struct _IO_COUNTERS
|
---|
810 | {
|
---|
811 | ULONGLONG ReadOperationCount;
|
---|
812 | ULONGLONG WriteOperationCount;
|
---|
813 | ULONGLONG OtherOperationCount;
|
---|
814 | ULONGLONG ReadTransferCount;
|
---|
815 | ULONGLONG WriteTransferCount;
|
---|
816 | ULONGLONG OtherTransferCount;
|
---|
817 | } IO_COUNTERS;
|
---|
818 | typedef IO_COUNTERS *PIO_COUNTERS;
|
---|
819 | #endif
|
---|
820 |
|
---|
821 | typedef struct _RTNT_SYSTEM_PROCESS_INFORMATION
|
---|
822 | {
|
---|
823 | ULONG NextEntryOffset; /**< 0x00 / 0x00 */
|
---|
824 | ULONG NumberOfThreads; /**< 0x04 / 0x04 */
|
---|
825 | LARGE_INTEGER Reserved1[3]; /**< 0x08 / 0x08 */
|
---|
826 | LARGE_INTEGER CreationTime; /**< 0x20 / 0x20 */
|
---|
827 | LARGE_INTEGER UserTime; /**< 0x28 / 0x28 */
|
---|
828 | LARGE_INTEGER KernelTime; /**< 0x30 / 0x30 */
|
---|
829 | UNICODE_STRING ProcessName; /**< 0x38 / 0x38 Clean unicode encoding? */
|
---|
830 | int32_t BasePriority; /**< 0x40 / 0x48 */
|
---|
831 | HANDLE UniqueProcessId; /**< 0x44 / 0x50 */
|
---|
832 | HANDLE ParentProcessId; /**< 0x48 / 0x58 */
|
---|
833 | ULONG HandleCount; /**< 0x4c / 0x60 */
|
---|
834 | ULONG Reserved2; /**< 0x50 / 0x64 Session ID? */
|
---|
835 | ULONG_PTR Reserved3; /**< 0x54 / 0x68 */
|
---|
836 | VM_COUNTERS VmCounters; /**< 0x58 / 0x70 */
|
---|
837 | IO_COUNTERS IoCounters; /**< 0x88 / 0xd0 Might not be present in earlier windows versions. */
|
---|
838 | /* After this follows the threads, then the ProcessName.Buffer. */
|
---|
839 | } RTNT_SYSTEM_PROCESS_INFORMATION;
|
---|
840 | typedef RTNT_SYSTEM_PROCESS_INFORMATION *PRTNT_SYSTEM_PROCESS_INFORMATION;
|
---|
841 | #ifndef IPRT_NT_USE_WINTERNL
|
---|
842 | typedef RTNT_SYSTEM_PROCESS_INFORMATION SYSTEM_PROCESS_INFORMATION ;
|
---|
843 | typedef SYSTEM_PROCESS_INFORMATION *PSYSTEM_PROCESS_INFORMATION;
|
---|
844 | #endif
|
---|
845 |
|
---|
846 | typedef struct _SYSTEM_HANDLE_ENTRY_INFO
|
---|
847 | {
|
---|
848 | USHORT UniqueProcessId;
|
---|
849 | USHORT CreatorBackTraceIndex;
|
---|
850 | UCHAR ObjectTypeIndex;
|
---|
851 | UCHAR HandleAttributes;
|
---|
852 | USHORT HandleValue;
|
---|
853 | PVOID Object;
|
---|
854 | ULONG GrantedAccess;
|
---|
855 | } SYSTEM_HANDLE_ENTRY_INFO;
|
---|
856 | typedef SYSTEM_HANDLE_ENTRY_INFO *PSYSTEM_HANDLE_ENTRY_INFO;
|
---|
857 |
|
---|
858 | /** Returned by SystemHandleInformation */
|
---|
859 | typedef struct _SYSTEM_HANDLE_INFORMATION
|
---|
860 | {
|
---|
861 | ULONG NumberOfHandles;
|
---|
862 | SYSTEM_HANDLE_ENTRY_INFO Handles[1];
|
---|
863 | } SYSTEM_HANDLE_INFORMATION;
|
---|
864 | typedef SYSTEM_HANDLE_INFORMATION *PSYSTEM_HANDLE_INFORMATION;
|
---|
865 |
|
---|
866 | /** Extended handle information entry.
|
---|
867 | * @remarks 3 x PVOID + 4 x ULONG = 28 bytes on 32-bit / 40 bytes on 64-bit */
|
---|
868 | typedef struct _SYSTEM_HANDLE_ENTRY_INFO_EX
|
---|
869 | {
|
---|
870 | PVOID Object;
|
---|
871 | HANDLE UniqueProcessId;
|
---|
872 | HANDLE HandleValue;
|
---|
873 | ACCESS_MASK GrantedAccess;
|
---|
874 | USHORT CreatorBackTraceIndex;
|
---|
875 | USHORT ObjectTypeIndex;
|
---|
876 | ULONG HandleAttributes;
|
---|
877 | ULONG Reserved;
|
---|
878 | } SYSTEM_HANDLE_ENTRY_INFO_EX;
|
---|
879 | typedef SYSTEM_HANDLE_ENTRY_INFO_EX *PSYSTEM_HANDLE_ENTRY_INFO_EX;
|
---|
880 |
|
---|
881 | /** Returned by SystemExtendedHandleInformation. */
|
---|
882 | typedef struct _SYSTEM_HANDLE_INFORMATION_EX
|
---|
883 | {
|
---|
884 | ULONG_PTR NumberOfHandles;
|
---|
885 | ULONG_PTR Reserved;
|
---|
886 | SYSTEM_HANDLE_ENTRY_INFO_EX Handles[1];
|
---|
887 | } SYSTEM_HANDLE_INFORMATION_EX;
|
---|
888 | typedef SYSTEM_HANDLE_INFORMATION_EX *PSYSTEM_HANDLE_INFORMATION_EX;
|
---|
889 |
|
---|
890 | /** Input to SystemSessionProcessInformation. */
|
---|
891 | typedef struct _SYSTEM_SESSION_PROCESS_INFORMATION
|
---|
892 | {
|
---|
893 | ULONG SessionId;
|
---|
894 | ULONG BufferLength;
|
---|
895 | /** Return buffer, SYSTEM_PROCESS_INFORMATION entries. */
|
---|
896 | PVOID Buffer;
|
---|
897 | } SYSTEM_SESSION_PROCESS_INFORMATION;
|
---|
898 | typedef SYSTEM_SESSION_PROCESS_INFORMATION *PSYSTEM_SESSION_PROCESS_INFORMATION;
|
---|
899 |
|
---|
900 | NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
|
---|
901 |
|
---|
902 | NTSYSAPI NTSTATUS NTAPI NtDelayExecution(BOOLEAN, PLARGE_INTEGER);
|
---|
903 | NTSYSAPI NTSTATUS NTAPI NtYieldExecution(void);
|
---|
904 |
|
---|
905 | NTSYSAPI NTSTATUS NTAPI RtlAddAccessDeniedAce(PACL, ULONG, ULONG, PSID);
|
---|
906 |
|
---|
907 | RT_C_DECLS_END
|
---|
908 | /** @} */
|
---|
909 |
|
---|
910 |
|
---|
911 | #if defined(IN_RING0) || defined(DOXYGEN_RUNNING)
|
---|
912 | /** @name NT Kernel APIs
|
---|
913 | * @{ */
|
---|
914 | NTSYSAPI BOOLEAN NTAPI ObFindHandleForObject(PEPROCESS pProcess, PVOID pvObject, POBJECT_TYPE pObjectType,
|
---|
915 | PVOID pvOptionalConditions, PHANDLE phFound);
|
---|
916 | NTSYSAPI NTSTATUS NTAPI ObReferenceObjectByName(PUNICODE_STRING pObjectPath, ULONG fAttributes, PACCESS_STATE pAccessState,
|
---|
917 | ACCESS_MASK fDesiredAccess, POBJECT_TYPE pObjectType,
|
---|
918 | KPROCESSOR_MODE enmAccessMode, PVOID pvParseContext, PVOID *ppvObject);
|
---|
919 | NTSYSAPI HANDLE NTAPI PsGetProcessInheritedFromUniqueProcessId(PEPROCESS);
|
---|
920 | NTSYSAPI UCHAR * NTAPI PsGetProcessImageFileName(PEPROCESS);
|
---|
921 | NTSYSAPI BOOLEAN NTAPI PsIsProcessBeingDebugged(PEPROCESS);
|
---|
922 | NTSYSAPI ULONG NTAPI PsGetProcessSessionId(PEPROCESS);
|
---|
923 | extern DECLIMPORT(POBJECT_TYPE *) LpcPortObjectType; /**< In vista+ this is the ALPC port object type. */
|
---|
924 | extern DECLIMPORT(POBJECT_TYPE *) LpcWaitablePortObjectType; /**< In vista+ this is the ALPC port object type. */
|
---|
925 |
|
---|
926 | /** @ */
|
---|
927 | #endif /* IN_RING0 */
|
---|
928 |
|
---|
929 | #endif
|
---|
930 |
|
---|