[XDK] Move more stuff from ntddk.template.h into appropriate headers
[reactos.git] / include / xdk / pstypes.h
1 /******************************************************************************
2 * Process Manager Types *
3 ******************************************************************************/
4 $if (_WDMDDK_)
5
6 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
7 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
8 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
9 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
10 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
11
12 /* Thread Access Rights */
13 #define THREAD_TERMINATE 0x0001
14 #define THREAD_SUSPEND_RESUME 0x0002
15 #define THREAD_ALERT 0x0004
16 #define THREAD_GET_CONTEXT 0x0008
17 #define THREAD_SET_CONTEXT 0x0010
18 #define THREAD_SET_INFORMATION 0x0020
19 #define THREAD_SET_LIMITED_INFORMATION 0x0400
20 #define THREAD_QUERY_LIMITED_INFORMATION 0x0800
21
22 #define PROCESS_DUP_HANDLE (0x0040)
23
24 #if (NTDDI_VERSION >= NTDDI_VISTA)
25 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF)
26 #else
27 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFF)
28 #endif
29
30 #if (NTDDI_VERSION >= NTDDI_VISTA)
31 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF)
32 #else
33 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3FF)
34 #endif
35
36 #define LOW_PRIORITY 0
37 #define LOW_REALTIME_PRIORITY 16
38 #define HIGH_PRIORITY 31
39 #define MAXIMUM_PRIORITY 32
40
41 $endif /* _WDMDDK_ */
42 $if (_NTDDK_)
43
44 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
45 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
46 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
47 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
48 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
49
50 typedef struct _QUOTA_LIMITS {
51 SIZE_T PagedPoolLimit;
52 SIZE_T NonPagedPoolLimit;
53 SIZE_T MinimumWorkingSetSize;
54 SIZE_T MaximumWorkingSetSize;
55 SIZE_T PagefileLimit;
56 LARGE_INTEGER TimeLimit;
57 } QUOTA_LIMITS, *PQUOTA_LIMITS;
58
59 typedef union _RATE_QUOTA_LIMIT {
60 ULONG RateData;
61 struct {
62 ULONG RatePercent:7;
63 ULONG Reserved0:25;
64 } DUMMYSTRUCTNAME;
65 } RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT;
66
67 typedef struct _QUOTA_LIMITS_EX {
68 SIZE_T PagedPoolLimit;
69 SIZE_T NonPagedPoolLimit;
70 SIZE_T MinimumWorkingSetSize;
71 SIZE_T MaximumWorkingSetSize;
72 SIZE_T PagefileLimit;
73 LARGE_INTEGER TimeLimit;
74 SIZE_T WorkingSetLimit;
75 SIZE_T Reserved2;
76 SIZE_T Reserved3;
77 SIZE_T Reserved4;
78 ULONG Flags;
79 RATE_QUOTA_LIMIT CpuRateLimit;
80 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
81
82 typedef struct _IO_COUNTERS {
83 ULONGLONG ReadOperationCount;
84 ULONGLONG WriteOperationCount;
85 ULONGLONG OtherOperationCount;
86 ULONGLONG ReadTransferCount;
87 ULONGLONG WriteTransferCount;
88 ULONGLONG OtherTransferCount;
89 } IO_COUNTERS, *PIO_COUNTERS;
90
91 typedef struct _VM_COUNTERS {
92 SIZE_T PeakVirtualSize;
93 SIZE_T VirtualSize;
94 ULONG PageFaultCount;
95 SIZE_T PeakWorkingSetSize;
96 SIZE_T WorkingSetSize;
97 SIZE_T QuotaPeakPagedPoolUsage;
98 SIZE_T QuotaPagedPoolUsage;
99 SIZE_T QuotaPeakNonPagedPoolUsage;
100 SIZE_T QuotaNonPagedPoolUsage;
101 SIZE_T PagefileUsage;
102 SIZE_T PeakPagefileUsage;
103 } VM_COUNTERS, *PVM_COUNTERS;
104
105 typedef struct _VM_COUNTERS_EX {
106 SIZE_T PeakVirtualSize;
107 SIZE_T VirtualSize;
108 ULONG PageFaultCount;
109 SIZE_T PeakWorkingSetSize;
110 SIZE_T WorkingSetSize;
111 SIZE_T QuotaPeakPagedPoolUsage;
112 SIZE_T QuotaPagedPoolUsage;
113 SIZE_T QuotaPeakNonPagedPoolUsage;
114 SIZE_T QuotaNonPagedPoolUsage;
115 SIZE_T PagefileUsage;
116 SIZE_T PeakPagefileUsage;
117 SIZE_T PrivateUsage;
118 } VM_COUNTERS_EX, *PVM_COUNTERS_EX;
119
120 #define MAX_HW_COUNTERS 16
121 #define THREAD_PROFILING_FLAG_DISPATCH 0x00000001
122
123 typedef enum _HARDWARE_COUNTER_TYPE {
124 PMCCounter,
125 MaxHardwareCounterType
126 } HARDWARE_COUNTER_TYPE, *PHARDWARE_COUNTER_TYPE;
127
128 typedef struct _HARDWARE_COUNTER {
129 HARDWARE_COUNTER_TYPE Type;
130 ULONG Reserved;
131 ULONG64 Index;
132 } HARDWARE_COUNTER, *PHARDWARE_COUNTER;
133
134 typedef struct _POOLED_USAGE_AND_LIMITS {
135 SIZE_T PeakPagedPoolUsage;
136 SIZE_T PagedPoolUsage;
137 SIZE_T PagedPoolLimit;
138 SIZE_T PeakNonPagedPoolUsage;
139 SIZE_T NonPagedPoolUsage;
140 SIZE_T NonPagedPoolLimit;
141 SIZE_T PeakPagefileUsage;
142 SIZE_T PagefileUsage;
143 SIZE_T PagefileLimit;
144 } POOLED_USAGE_AND_LIMITS, *PPOOLED_USAGE_AND_LIMITS;
145
146 typedef struct _PROCESS_ACCESS_TOKEN {
147 HANDLE Token;
148 HANDLE Thread;
149 } PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN;
150
151 #define PROCESS_EXCEPTION_PORT_ALL_STATE_BITS 0x00000003UL
152 #define PROCESS_EXCEPTION_PORT_ALL_STATE_FLAGS ((ULONG_PTR)((1UL << PROCESS_EXCEPTION_PORT_ALL_STATE_BITS) - 1))
153
154 typedef struct _PROCESS_EXCEPTION_PORT {
155 IN HANDLE ExceptionPortHandle;
156 IN OUT ULONG StateFlags;
157 } PROCESS_EXCEPTION_PORT, *PPROCESS_EXCEPTION_PORT;
158
159 typedef VOID
160 (NTAPI *PCREATE_PROCESS_NOTIFY_ROUTINE)(
161 IN HANDLE ParentId,
162 IN HANDLE ProcessId,
163 IN BOOLEAN Create);
164
165 typedef struct _PS_CREATE_NOTIFY_INFO {
166 IN SIZE_T Size;
167 union {
168 IN ULONG Flags;
169 struct {
170 IN ULONG FileOpenNameAvailable:1;
171 IN ULONG Reserved:31;
172 };
173 };
174 IN HANDLE ParentProcessId;
175 IN CLIENT_ID CreatingThreadId;
176 IN OUT struct _FILE_OBJECT *FileObject;
177 IN PCUNICODE_STRING ImageFileName;
178 IN PCUNICODE_STRING CommandLine OPTIONAL;
179 IN OUT NTSTATUS CreationStatus;
180 } PS_CREATE_NOTIFY_INFO, *PPS_CREATE_NOTIFY_INFO;
181
182 typedef VOID
183 (NTAPI *PCREATE_PROCESS_NOTIFY_ROUTINE_EX)(
184 IN OUT PEPROCESS Process,
185 IN HANDLE ProcessId,
186 IN PPS_CREATE_NOTIFY_INFO CreateInfo OPTIONAL);
187
188 typedef VOID
189 (NTAPI *PCREATE_THREAD_NOTIFY_ROUTINE)(
190 IN HANDLE ProcessId,
191 IN HANDLE ThreadId,
192 IN BOOLEAN Create);
193
194 #define IMAGE_ADDRESSING_MODE_32BIT 3
195
196 typedef struct _IMAGE_INFO {
197 _ANONYMOUS_UNION union {
198 ULONG Properties;
199 _ANONYMOUS_STRUCT struct {
200 ULONG ImageAddressingMode:8;
201 ULONG SystemModeImage:1;
202 ULONG ImageMappedToAllPids:1;
203 ULONG ExtendedInfoPresent:1;
204 ULONG Reserved:21;
205 } DUMMYSTRUCTNAME;
206 } DUMMYUNIONNAME;
207 PVOID ImageBase;
208 ULONG ImageSelector;
209 SIZE_T ImageSize;
210 ULONG ImageSectionNumber;
211 } IMAGE_INFO, *PIMAGE_INFO;
212
213 typedef struct _IMAGE_INFO_EX {
214 SIZE_T Size;
215 IMAGE_INFO ImageInfo;
216 struct _FILE_OBJECT *FileObject;
217 } IMAGE_INFO_EX, *PIMAGE_INFO_EX;
218
219 typedef VOID
220 (NTAPI *PLOAD_IMAGE_NOTIFY_ROUTINE)(
221 IN PUNICODE_STRING FullImageName,
222 IN HANDLE ProcessId,
223 IN PIMAGE_INFO ImageInfo);
224
225 #define THREAD_CSWITCH_PMU_DISABLE FALSE
226 #define THREAD_CSWITCH_PMU_ENABLE TRUE
227
228 #define PROCESS_LUID_DOSDEVICES_ONLY 0x00000001
229
230 #define PROCESS_HANDLE_TRACING_MAX_STACKS 16
231
232 typedef struct _NT_TIB {
233 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
234 PVOID StackBase;
235 PVOID StackLimit;
236 PVOID SubSystemTib;
237 _ANONYMOUS_UNION union {
238 PVOID FiberData;
239 ULONG Version;
240 } DUMMYUNIONNAME;
241 PVOID ArbitraryUserPointer;
242 struct _NT_TIB *Self;
243 } NT_TIB, *PNT_TIB;
244
245 typedef struct _NT_TIB32 {
246 ULONG ExceptionList;
247 ULONG StackBase;
248 ULONG StackLimit;
249 ULONG SubSystemTib;
250 __GNU_EXTENSION union {
251 ULONG FiberData;
252 ULONG Version;
253 };
254 ULONG ArbitraryUserPointer;
255 ULONG Self;
256 } NT_TIB32,*PNT_TIB32;
257
258 typedef struct _NT_TIB64 {
259 ULONG64 ExceptionList;
260 ULONG64 StackBase;
261 ULONG64 StackLimit;
262 ULONG64 SubSystemTib;
263 __GNU_EXTENSION union {
264 ULONG64 FiberData;
265 ULONG Version;
266 };
267 ULONG64 ArbitraryUserPointer;
268 ULONG64 Self;
269 } NT_TIB64,*PNT_TIB64;
270
271 typedef enum _PROCESSINFOCLASS {
272 ProcessBasicInformation,
273 ProcessQuotaLimits,
274 ProcessIoCounters,
275 ProcessVmCounters,
276 ProcessTimes,
277 ProcessBasePriority,
278 ProcessRaisePriority,
279 ProcessDebugPort,
280 ProcessExceptionPort,
281 ProcessAccessToken,
282 ProcessLdtInformation,
283 ProcessLdtSize,
284 ProcessDefaultHardErrorMode,
285 ProcessIoPortHandlers,
286 ProcessPooledUsageAndLimits,
287 ProcessWorkingSetWatch,
288 ProcessUserModeIOPL,
289 ProcessEnableAlignmentFaultFixup,
290 ProcessPriorityClass,
291 ProcessWx86Information,
292 ProcessHandleCount,
293 ProcessAffinityMask,
294 ProcessPriorityBoost,
295 ProcessDeviceMap,
296 ProcessSessionInformation,
297 ProcessForegroundInformation,
298 ProcessWow64Information,
299 ProcessImageFileName,
300 ProcessLUIDDeviceMapsEnabled,
301 ProcessBreakOnTermination,
302 ProcessDebugObjectHandle,
303 ProcessDebugFlags,
304 ProcessHandleTracing,
305 ProcessIoPriority,
306 ProcessExecuteFlags,
307 ProcessTlsInformation,
308 ProcessCookie,
309 ProcessImageInformation,
310 ProcessCycleTime,
311 ProcessPagePriority,
312 ProcessInstrumentationCallback,
313 ProcessThreadStackAllocation,
314 ProcessWorkingSetWatchEx,
315 ProcessImageFileNameWin32,
316 ProcessImageFileMapping,
317 ProcessAffinityUpdateMode,
318 ProcessMemoryAllocationMode,
319 ProcessGroupInformation,
320 ProcessTokenVirtualizationEnabled,
321 ProcessConsoleHostProcess,
322 ProcessWindowInformation,
323 MaxProcessInfoClass
324 } PROCESSINFOCLASS;
325
326 typedef enum _THREADINFOCLASS {
327 ThreadBasicInformation,
328 ThreadTimes,
329 ThreadPriority,
330 ThreadBasePriority,
331 ThreadAffinityMask,
332 ThreadImpersonationToken,
333 ThreadDescriptorTableEntry,
334 ThreadEnableAlignmentFaultFixup,
335 ThreadEventPair_Reusable,
336 ThreadQuerySetWin32StartAddress,
337 ThreadZeroTlsCell,
338 ThreadPerformanceCount,
339 ThreadAmILastThread,
340 ThreadIdealProcessor,
341 ThreadPriorityBoost,
342 ThreadSetTlsArrayAddress,
343 ThreadIsIoPending,
344 ThreadHideFromDebugger,
345 ThreadBreakOnTermination,
346 ThreadSwitchLegacyState,
347 ThreadIsTerminated,
348 ThreadLastSystemCall,
349 ThreadIoPriority,
350 ThreadCycleTime,
351 ThreadPagePriority,
352 ThreadActualBasePriority,
353 ThreadTebInformation,
354 ThreadCSwitchMon,
355 ThreadCSwitchPmu,
356 ThreadWow64Context,
357 ThreadGroupInformation,
358 ThreadUmsInformation,
359 ThreadCounterProfiling,
360 ThreadIdealProcessorEx,
361 MaxThreadInfoClass
362 } THREADINFOCLASS;
363
364 typedef struct _PAGE_PRIORITY_INFORMATION {
365 ULONG PagePriority;
366 } PAGE_PRIORITY_INFORMATION, *PPAGE_PRIORITY_INFORMATION;
367
368 typedef struct _PROCESS_WS_WATCH_INFORMATION {
369 PVOID FaultingPc;
370 PVOID FaultingVa;
371 } PROCESS_WS_WATCH_INFORMATION, *PPROCESS_WS_WATCH_INFORMATION;
372
373 typedef struct _PROCESS_BASIC_INFORMATION {
374 NTSTATUS ExitStatus;
375 struct _PEB *PebBaseAddress;
376 ULONG_PTR AffinityMask;
377 KPRIORITY BasePriority;
378 ULONG_PTR UniqueProcessId;
379 ULONG_PTR InheritedFromUniqueProcessId;
380 } PROCESS_BASIC_INFORMATION,*PPROCESS_BASIC_INFORMATION;
381
382 typedef struct _PROCESS_EXTENDED_BASIC_INFORMATION {
383 SIZE_T Size;
384 PROCESS_BASIC_INFORMATION BasicInfo;
385 union {
386 ULONG Flags;
387 struct {
388 ULONG IsProtectedProcess:1;
389 ULONG IsWow64Process:1;
390 ULONG IsProcessDeleting:1;
391 ULONG IsCrossSessionCreate:1;
392 ULONG SpareBits:28;
393 } DUMMYSTRUCTNAME;
394 } DUMMYUNIONNAME;
395 } PROCESS_EXTENDED_BASIC_INFORMATION, *PPROCESS_EXTENDED_BASIC_INFORMATION;
396
397 typedef struct _PROCESS_DEVICEMAP_INFORMATION {
398 __GNU_EXTENSION union {
399 struct {
400 HANDLE DirectoryHandle;
401 } Set;
402 struct {
403 ULONG DriveMap;
404 UCHAR DriveType[32];
405 } Query;
406 };
407 } PROCESS_DEVICEMAP_INFORMATION, *PPROCESS_DEVICEMAP_INFORMATION;
408
409 typedef struct _PROCESS_DEVICEMAP_INFORMATION_EX {
410 union {
411 struct {
412 HANDLE DirectoryHandle;
413 } Set;
414 struct {
415 ULONG DriveMap;
416 UCHAR DriveType[32];
417 } Query;
418 } DUMMYUNIONNAME;
419 ULONG Flags;
420 } PROCESS_DEVICEMAP_INFORMATION_EX, *PPROCESS_DEVICEMAP_INFORMATION_EX;
421
422 typedef struct _PROCESS_SESSION_INFORMATION {
423 ULONG SessionId;
424 } PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
425
426 typedef struct _PROCESS_HANDLE_TRACING_ENABLE {
427 ULONG Flags;
428 } PROCESS_HANDLE_TRACING_ENABLE, *PPROCESS_HANDLE_TRACING_ENABLE;
429
430 typedef struct _PROCESS_HANDLE_TRACING_ENABLE_EX {
431 ULONG Flags;
432 ULONG TotalSlots;
433 } PROCESS_HANDLE_TRACING_ENABLE_EX, *PPROCESS_HANDLE_TRACING_ENABLE_EX;
434
435 typedef struct _PROCESS_HANDLE_TRACING_ENTRY {
436 HANDLE Handle;
437 CLIENT_ID ClientId;
438 ULONG Type;
439 PVOID Stacks[PROCESS_HANDLE_TRACING_MAX_STACKS];
440 } PROCESS_HANDLE_TRACING_ENTRY, *PPROCESS_HANDLE_TRACING_ENTRY;
441
442 typedef struct _PROCESS_HANDLE_TRACING_QUERY {
443 HANDLE Handle;
444 ULONG TotalTraces;
445 PROCESS_HANDLE_TRACING_ENTRY HandleTrace[1];
446 } PROCESS_HANDLE_TRACING_QUERY, *PPROCESS_HANDLE_TRACING_QUERY;
447
448 extern NTKERNELAPI PEPROCESS PsInitialSystemProcess;
449
450 $endif /* _NTDDK_ */
451