c886c68d0161fc26ce2273635377f6c467c56dad
[reactos.git] / reactos / include / ndk / pstypes.h
1 /*++ NDK Version: 0095
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 pstypes.h
8
9 Abstract:
10
11 Type definitions for the Process Manager
12
13 Author:
14
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
16
17 --*/
18
19 #ifndef _PSTYPES_H
20 #define _PSTYPES_H
21
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <ldrtypes.h>
27 #include <mmtypes.h>
28 #include <obtypes.h>
29 #ifndef NTOS_MODE_USER
30 #include <extypes.h>
31 #include <setypes.h>
32 #endif
33
34 //
35 // KUSER_SHARED_DATA location in User Mode
36 //
37 #define USER_SHARED_DATA (0x7FFE0000)
38
39 //
40 // Kernel Exports
41 //
42 #ifndef NTOS_MODE_USER
43
44 extern NTSYSAPI struct _EPROCESS* PsInitialSystemProcess;
45 extern NTSYSAPI POBJECT_TYPE PsProcessType;
46
47 #endif
48
49 //
50 // Global Flags
51 //
52 #define FLG_STOP_ON_EXCEPTION 0x00000001
53 #define FLG_SHOW_LDR_SNAPS 0x00000002
54 #define FLG_DEBUG_INITIAL_COMMAND 0x00000004
55 #define FLG_STOP_ON_HUNG_GUI 0x00000008
56 #define FLG_HEAP_ENABLE_TAIL_CHECK 0x00000010
57 #define FLG_HEAP_ENABLE_FREE_CHECK 0x00000020
58 #define FLG_HEAP_VALIDATE_PARAMETERS 0x00000040
59 #define FLG_HEAP_VALIDATE_ALL 0x00000080
60 #define FLG_POOL_ENABLE_TAIL_CHECK 0x00000100
61 #define FLG_POOL_ENABLE_FREE_CHECK 0x00000200
62 #define FLG_POOL_ENABLE_TAGGING 0x00000400
63 #define FLG_HEAP_ENABLE_TAGGING 0x00000800
64 #define FLG_USER_STACK_TRACE_DB 0x00001000
65 #define FLG_KERNEL_STACK_TRACE_DB 0x00002000
66 #define FLG_MAINTAIN_OBJECT_TYPELIST 0x00004000
67 #define FLG_HEAP_ENABLE_TAG_BY_DLL 0x00008000
68 #define FLG_IGNORE_DEBUG_PRIV 0x00010000
69 #define FLG_ENABLE_CSRDEBUG 0x00020000
70 #define FLG_ENABLE_KDEBUG_SYMBOL_LOAD 0x00040000
71 #define FLG_DISABLE_PAGE_KERNEL_STACKS 0x00080000
72 #define FLG_HEAP_ENABLE_CALL_TRACING 0x00100000
73 #define FLG_HEAP_DISABLE_COALESCING 0x00200000
74 #define FLG_ENABLE_CLOSE_EXCEPTIONS 0x00400000
75 #define FLG_ENABLE_EXCEPTION_LOGGING 0x00800000
76 #define FLG_ENABLE_HANDLE_TYPE_TAGGING 0x01000000
77 #define FLG_HEAP_PAGE_ALLOCS 0x02000000
78 #define FLG_DEBUG_INITIAL_COMMAND_EX 0x04000000
79
80 //
81 // Process priority classes
82 //
83 #define PROCESS_PRIORITY_CLASS_INVALID 0
84 #define PROCESS_PRIORITY_CLASS_IDLE 1
85 #define PROCESS_PRIORITY_CLASS_NORMAL 2
86 #define PROCESS_PRIORITY_CLASS_HIGH 3
87 #define PROCESS_PRIORITY_CLASS_REALTIME 4
88 #define PROCESS_PRIORITY_CLASS_BELOW_NORMAL 5
89 #define PROCESS_PRIORITY_CLASS_ABOVE_NORMAL 6
90
91 //
92 // NtCreateProcessEx flags
93 //
94 #define PS_REQUEST_BREAKAWAY 1
95 #define PS_NO_DEBUG_INHERIT 2
96 #define PS_INHERIT_HANDLES 4
97 #define PS_UNKNOWN_VALUE 8
98 #define PS_ALL_FLAGS (PS_REQUEST_BREAKAWAY | \
99 PS_NO_DEBUG_INHERIT | \
100 PS_INHERIT_HANDLES | \
101 PS_UNKNOWN_VALUE)
102
103 //
104 // Process base priorities
105 //
106 #define PROCESS_PRIORITY_IDLE 3
107 #define PROCESS_PRIORITY_NORMAL 8
108 #define PROCESS_PRIORITY_NORMAL_FOREGROUND 9
109
110 //
111 // Process Access Types
112 //
113 #ifndef NTOS_MODE_USER
114 #define PROCESS_TERMINATE 0x0001
115 #define PROCESS_CREATE_THREAD 0x0002
116 #define PROCESS_SET_SESSIONID 0x0004
117 #define PROCESS_VM_OPERATION 0x0008
118 #define PROCESS_VM_READ 0x0010
119 #define PROCESS_VM_WRITE 0x0020
120 #define PROCESS_CREATE_PROCESS 0x0080
121 #define PROCESS_SET_QUOTA 0x0100
122 #define PROCESS_SET_INFORMATION 0x0200
123 #define PROCESS_QUERY_INFORMATION 0x0400
124 #define PROCESS_SUSPEND_RESUME 0x0800
125 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
126 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF)
127
128
129 //
130 // Job Access Types
131 //
132 #define JOB_OBJECT_ASSIGN_PROCESS 0x1
133 #define JOB_OBJECT_SET_ATTRIBUTES 0x2
134 #define JOB_OBJECT_QUERY 0x4
135 #define JOB_OBJECT_TERMINATE 0x8
136 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x10
137 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 31)
138 #endif
139
140 #ifdef NTOS_MODE_USER
141 //
142 // Current Process/Thread built-in 'special' handles
143 //
144 #define NtCurrentProcess() ((HANDLE)(LONG_PTR)-1)
145 #define ZwCurrentProcess() NtCurrentProcess()
146 #define NtCurrentThread() ((HANDLE)(LONG_PTR)-2)
147 #define ZwCurrentThread() NtCurrentThread()
148
149 //
150 // Process/Thread/Job Information Classes for NtQueryInformationProcess/Thread/Job
151 //
152 typedef enum _PROCESSINFOCLASS
153 {
154 ProcessBasicInformation,
155 ProcessQuotaLimits,
156 ProcessIoCounters,
157 ProcessVmCounters,
158 ProcessTimes,
159 ProcessBasePriority,
160 ProcessRaisePriority,
161 ProcessDebugPort,
162 ProcessExceptionPort,
163 ProcessAccessToken,
164 ProcessLdtInformation,
165 ProcessLdtSize,
166 ProcessDefaultHardErrorMode,
167 ProcessIoPortHandlers,
168 ProcessPooledUsageAndLimits,
169 ProcessWorkingSetWatch,
170 ProcessUserModeIOPL,
171 ProcessEnableAlignmentFaultFixup,
172 ProcessPriorityClass,
173 ProcessWx86Information,
174 ProcessHandleCount,
175 ProcessAffinityMask,
176 ProcessPriorityBoost,
177 ProcessDeviceMap,
178 ProcessSessionInformation,
179 ProcessForegroundInformation,
180 ProcessWow64Information,
181 ProcessImageFileName,
182 ProcessLUIDDeviceMapsEnabled,
183 ProcessBreakOnTermination,
184 ProcessDebugObjectHandle,
185 ProcessDebugFlags,
186 ProcessHandleTracing,
187 ProcessIoPriority,
188 ProcessExecuteFlags,
189 ProcessTlsInformation,
190 ProcessCookie,
191 ProcessImageInformation,
192 ProcessCycleTime,
193 ProcessPagePriority,
194 ProcessInstrumentationCallback,
195 MaxProcessInfoClass
196 } PROCESSINFOCLASS;
197
198 typedef enum _THREADINFOCLASS
199 {
200 ThreadBasicInformation,
201 ThreadTimes,
202 ThreadPriority,
203 ThreadBasePriority,
204 ThreadAffinityMask,
205 ThreadImpersonationToken,
206 ThreadDescriptorTableEntry,
207 ThreadEnableAlignmentFaultFixup,
208 ThreadEventPair_Reusable,
209 ThreadQuerySetWin32StartAddress,
210 ThreadZeroTlsCell,
211 ThreadPerformanceCount,
212 ThreadAmILastThread,
213 ThreadIdealProcessor,
214 ThreadPriorityBoost,
215 ThreadSetTlsArrayAddress,
216 ThreadIsIoPending,
217 ThreadHideFromDebugger,
218 ThreadBreakOnTermination,
219 ThreadSwitchLegacyState,
220 ThreadIsTerminated,
221 ThreadLastSystemCall,
222 ThreadIoPriority,
223 ThreadCycleTime,
224 ThreadPagePriority,
225 ThreadActualBasePriority,
226 MaxThreadInfoClass
227 } THREADINFOCLASS;
228
229 #else
230
231 typedef enum _JOBOBJECTINFOCLASS
232 {
233 JobObjectBasicAccountingInformation = 1,
234 JobObjectBasicLimitInformation,
235 JobObjectBasicProcessIdList,
236 JobObjectBasicUIRestrictions,
237 JobObjectSecurityLimitInformation,
238 JobObjectEndOfJobTimeInformation,
239 JobObjectAssociateCompletionPortInformation,
240 JobObjectBasicAndIoAccountingInformation,
241 JobObjectExtendedLimitInformation,
242 JobObjectJobSetInformation,
243 MaxJobObjectInfoClass
244 } JOBOBJECTINFOCLASS;
245
246 //
247 // Declare empty structure definitions so that they may be referenced by
248 // routines before they are defined
249 //
250 struct _W32THREAD;
251 struct _W32PROCESS;
252 struct _ETHREAD;
253
254 //
255 // Win32K Process and Thread Callbacks
256 //
257 typedef NTSTATUS
258 (NTAPI *PW32_PROCESS_CALLBACK)(
259 struct _EPROCESS *Process,
260 BOOLEAN Create
261 );
262
263 typedef NTSTATUS
264 (NTAPI *PW32_THREAD_CALLBACK)(
265 struct _ETHREAD *Thread,
266 BOOLEAN Create
267 );
268
269 #endif
270
271 #ifdef NTOS_MODE_USER
272
273 //
274 // ClientID Structure
275 //
276 typedef struct _CLIENT_ID
277 {
278 HANDLE UniqueProcess;
279 HANDLE UniqueThread;
280 } CLIENT_ID, *PCLIENT_ID;
281
282 #endif
283
284 //
285 // Descriptor Table Entry Definition
286 //
287 #define _DESCRIPTOR_TABLE_ENTRY_DEFINED
288 typedef struct _DESCRIPTOR_TABLE_ENTRY
289 {
290 ULONG Selector;
291 LDT_ENTRY Descriptor;
292 } DESCRIPTOR_TABLE_ENTRY, *PDESCRIPTOR_TABLE_ENTRY;
293
294 //
295 // PEB Lock Routine
296 //
297 typedef VOID
298 (NTAPI *PPEBLOCKROUTINE)(
299 PVOID PebLock
300 );
301
302 //
303 // PEB Free Block Descriptor
304 //
305 typedef struct _PEB_FREE_BLOCK
306 {
307 struct _PEB_FREE_BLOCK* Next;
308 ULONG Size;
309 } PEB_FREE_BLOCK, *PPEB_FREE_BLOCK;
310
311 //
312 // Process Environment Block (PEB)
313 //
314 typedef struct _PEB
315 {
316 UCHAR InheritedAddressSpace; /* 00h */
317 UCHAR ReadImageFileExecOptions; /* 01h */
318 UCHAR BeingDebugged; /* 02h */
319 BOOLEAN SpareBool; /* 03h */
320 HANDLE Mutant; /* 04h */
321 PVOID ImageBaseAddress; /* 08h */
322 PPEB_LDR_DATA Ldr; /* 0Ch */
323 struct _RTL_USER_PROCESS_PARAMETERS *ProcessParameters; /* 10h */
324 PVOID SubSystemData; /* 14h */
325 PVOID ProcessHeap; /* 18h */
326 PVOID FastPebLock; /* 1Ch */
327 PPEBLOCKROUTINE FastPebLockRoutine; /* 20h */
328 PPEBLOCKROUTINE FastPebUnlockRoutine; /* 24h */
329 ULONG EnvironmentUpdateCount; /* 28h */
330 PVOID* KernelCallbackTable; /* 2Ch */
331 PVOID EventLogSection; /* 30h */
332 PVOID EventLog; /* 34h */
333 PPEB_FREE_BLOCK FreeList; /* 38h */
334 ULONG TlsExpansionCounter; /* 3Ch */
335 PVOID TlsBitmap; /* 40h */
336 ULONG TlsBitmapBits[0x2]; /* 44h */
337 PVOID ReadOnlySharedMemoryBase; /* 4Ch */
338 PVOID ReadOnlySharedMemoryHeap; /* 50h */
339 PVOID* ReadOnlyStaticServerData; /* 54h */
340 PVOID AnsiCodePageData; /* 58h */
341 PVOID OemCodePageData; /* 5Ch */
342 PVOID UnicodeCaseTableData; /* 60h */
343 ULONG NumberOfProcessors; /* 64h */
344 ULONG NtGlobalFlag; /* 68h */
345 LARGE_INTEGER CriticalSectionTimeout; /* 70h */
346 ULONG HeapSegmentReserve; /* 78h */
347 ULONG HeapSegmentCommit; /* 7Ch */
348 ULONG HeapDeCommitTotalFreeThreshold; /* 80h */
349 ULONG HeapDeCommitFreeBlockThreshold; /* 84h */
350 ULONG NumberOfHeaps; /* 88h */
351 ULONG MaximumNumberOfHeaps; /* 8Ch */
352 PVOID* ProcessHeaps; /* 90h */
353 PVOID GdiSharedHandleTable; /* 94h */
354 PVOID ProcessStarterHelper; /* 98h */
355 PVOID GdiDCAttributeList; /* 9Ch */
356 PVOID LoaderLock; /* A0h */
357 ULONG OSMajorVersion; /* A4h */
358 ULONG OSMinorVersion; /* A8h */
359 USHORT OSBuildNumber; /* ACh */
360 USHORT OSCSDVersion; /* AEh */
361 ULONG OSPlatformId; /* B0h */
362 ULONG ImageSubSystem; /* B4h */
363 ULONG ImageSubSystemMajorVersion; /* B8h */
364 ULONG ImageSubSystemMinorVersion; /* BCh */
365 ULONG ImageProcessAffinityMask; /* C0h */
366 ULONG GdiHandleBuffer[0x22]; /* C4h */
367 PVOID PostProcessInitRoutine; /* 14Ch */
368 struct _RTL_BITMAP *TlsExpansionBitmap; /* 150h */
369 ULONG TlsExpansionBitmapBits[0x20]; /* 154h */
370 ULONG SessionId; /* 1D4h */
371 PVOID AppCompatInfo; /* 1D8h */
372 UNICODE_STRING CSDVersion; /* 1DCh */
373 } PEB, *PPEB;
374
375 //
376 // GDI Batch Descriptor
377 //
378 typedef struct _GDI_TEB_BATCH
379 {
380 ULONG Offset;
381 ULONG HDC;
382 ULONG Buffer[0x136];
383 } GDI_TEB_BATCH, *PGDI_TEB_BATCH;
384
385 //
386 // Initial TEB
387 //
388 typedef struct _INITIAL_TEB
389 {
390 PVOID PreviousStackBase;
391 PVOID PreviousStackLimit;
392 PVOID StackBase;
393 PVOID StackLimit;
394 PVOID AllocatedStackBase;
395 } INITIAL_TEB, *PINITIAL_TEB;
396
397 //
398 // TEB Active Frame Structures
399 //
400 typedef struct _TEB_ACTIVE_FRAME_CONTEXT
401 {
402 ULONG Flags;
403 LPSTR FrameName;
404 } TEB_ACTIVE_FRAME_CONTEXT, *PTEB_ACTIVE_FRAME_CONTEXT;
405
406 typedef struct _TEB_ACTIVE_FRAME
407 {
408 ULONG Flags;
409 struct _TEB_ACTIVE_FRAME *Previous;
410 PTEB_ACTIVE_FRAME_CONTEXT Context;
411 } TEB_ACTIVE_FRAME, *PTEB_ACTIVE_FRAME;
412
413 //
414 // Thread Environment Block (TEB)
415 //
416 typedef struct _TEB
417 {
418 NT_TIB Tib; /* 00h */
419 PVOID EnvironmentPointer; /* 1Ch */
420 CLIENT_ID Cid; /* 20h */
421 PVOID ActiveRpcHandle; /* 28h */
422 PVOID ThreadLocalStoragePointer; /* 2Ch */
423 struct _PEB *ProcessEnvironmentBlock; /* 30h */
424 ULONG LastErrorValue; /* 34h */
425 ULONG CountOfOwnedCriticalSections; /* 38h */
426 PVOID CsrClientThread; /* 3Ch */
427 PVOID Win32ThreadInfo; /* 40h */
428 ULONG User32Reserved[0x1A]; /* 44h */
429 ULONG UserReserved[5]; /* ACh */
430 PVOID WOW32Reserved; /* C0h */
431 LCID CurrentLocale; /* C4h */
432 ULONG FpSoftwareStatusRegister; /* C8h */
433 PVOID SystemReserved1[0x36]; /* CCh */
434 LONG ExceptionCode; /* 1A4h */
435 struct _ACTIVATION_CONTEXT_STACK *ActivationContextStackPointer; /* 1A8h */
436 UCHAR SpareBytes1[0x28]; /* 1ACh */
437 GDI_TEB_BATCH GdiTebBatch; /* 1D4h */
438 CLIENT_ID RealClientId; /* 6B4h */
439 PVOID GdiCachedProcessHandle; /* 6BCh */
440 ULONG GdiClientPID; /* 6C0h */
441 ULONG GdiClientTID; /* 6C4h */
442 PVOID GdiThreadLocalInfo; /* 6C8h */
443 ULONG Win32ClientInfo[62]; /* 6CCh */
444 PVOID glDispatchTable[0xE9]; /* 7C4h */
445 ULONG glReserved1[0x1D]; /* B68h */
446 PVOID glReserved2; /* BDCh */
447 PVOID glSectionInfo; /* BE0h */
448 PVOID glSection; /* BE4h */
449 PVOID glTable; /* BE8h */
450 PVOID glCurrentRC; /* BECh */
451 PVOID glContext; /* BF0h */
452 NTSTATUS LastStatusValue; /* BF4h */
453 UNICODE_STRING StaticUnicodeString; /* BF8h */
454 WCHAR StaticUnicodeBuffer[0x105]; /* C00h */
455 PVOID DeallocationStack; /* E0Ch */
456 PVOID TlsSlots[0x40]; /* E10h */
457 LIST_ENTRY TlsLinks; /* F10h */
458 PVOID Vdm; /* F18h */
459 PVOID ReservedForNtRpc; /* F1Ch */
460 PVOID DbgSsReserved[0x2]; /* F20h */
461 ULONG HardErrorDisabled; /* F28h */
462 PVOID Instrumentation[14]; /* F2Ch */
463 PVOID SubProcessTag; /* F64h */
464 PVOID EtwTraceData; /* F68h */
465 PVOID WinSockData; /* F6Ch */
466 ULONG GdiBatchCount; /* F70h */
467 BOOLEAN InDbgPrint; /* F74h */
468 BOOLEAN FreeStackOnTermination; /* F75h */
469 BOOLEAN HasFiberData; /* F76h */
470 UCHAR IdealProcessor; /* F77h */
471 ULONG GuaranteedStackBytes; /* F78h */
472 PVOID ReservedForPerf; /* F7Ch */
473 PVOID ReservedForOle; /* F80h */
474 ULONG WaitingOnLoaderLock; /* F84h */
475 ULONG SparePointer1; /* F88h */
476 ULONG SoftPatchPtr1; /* F8Ch */
477 ULONG SoftPatchPtr2; /* F90h */
478 PVOID *TlsExpansionSlots; /* F94h */
479 ULONG ImpersionationLocale; /* F98h */
480 ULONG IsImpersonating; /* F9Ch */
481 PVOID NlsCache; /* FA0h */
482 PVOID pShimData; /* FA4h */
483 ULONG HeapVirualAffinity; /* FA8h */
484 PVOID CurrentTransactionHandle; /* FACh */
485 PTEB_ACTIVE_FRAME ActiveFrame; /* FB0h */
486 PVOID FlsData; /* FB4h */
487 UCHAR SafeThunkCall; /* FB8h */
488 UCHAR BooleanSpare[3]; /* FB9h */
489 } TEB, *PTEB;
490
491 #ifdef NTOS_MODE_USER
492
493 //
494 // Process Information Structures for NtQueryProcessInformation
495 //
496 typedef struct _PROCESS_BASIC_INFORMATION
497 {
498 NTSTATUS ExitStatus;
499 PPEB PebBaseAddress;
500 ULONG_PTR AffinityMask;
501 KPRIORITY BasePriority;
502 ULONG_PTR UniqueProcessId;
503 ULONG_PTR InheritedFromUniqueProcessId;
504 } PROCESS_BASIC_INFORMATION,*PPROCESS_BASIC_INFORMATION;
505
506 typedef struct _PROCESS_ACCESS_TOKEN
507 {
508 HANDLE Token;
509 HANDLE Thread;
510 } PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN;
511
512 typedef struct _PROCESS_DEVICEMAP_INFORMATION
513 {
514 union
515 {
516 struct
517 {
518 HANDLE DirectoryHandle;
519 } Set;
520 struct
521 {
522 ULONG DriveMap;
523 UCHAR DriveType[32];
524 } Query;
525 };
526 } PROCESS_DEVICEMAP_INFORMATION, *PPROCESS_DEVICEMAP_INFORMATION;
527
528 typedef struct _KERNEL_USER_TIMES
529 {
530 LARGE_INTEGER CreateTime;
531 LARGE_INTEGER ExitTime;
532 LARGE_INTEGER KernelTime;
533 LARGE_INTEGER UserTime;
534 } KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
535
536 typedef struct _PROCESS_SESSION_INFORMATION
537 {
538 ULONG SessionId;
539 } PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
540
541 #endif
542
543 typedef struct _PROCESS_PRIORITY_CLASS
544 {
545 BOOLEAN Foreground;
546 UCHAR PriorityClass;
547 } PROCESS_PRIORITY_CLASS, *PPROCESS_PRIORITY_CLASS;
548
549 //
550 // Thread Information Structures for NtQueryProcessInformation
551 //
552 typedef struct _THREAD_BASIC_INFORMATION
553 {
554 NTSTATUS ExitStatus;
555 PVOID TebBaseAddress;
556 CLIENT_ID ClientId;
557 KAFFINITY AffinityMask;
558 KPRIORITY Priority;
559 KPRIORITY BasePriority;
560 } THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
561
562 #ifndef NTOS_MODE_USER
563
564 //
565 // EPROCESS Quota Structures
566 //
567 typedef struct _EPROCESS_QUOTA_ENTRY
568 {
569 SIZE_T Usage;
570 SIZE_T Limit;
571 SIZE_T Peak;
572 SIZE_T Return;
573 } EPROCESS_QUOTA_ENTRY, *PEPROCESS_QUOTA_ENTRY;
574
575 typedef struct _EPROCESS_QUOTA_BLOCK
576 {
577 EPROCESS_QUOTA_ENTRY QuotaEntry[3];
578 LIST_ENTRY QuotaList;
579 ULONG ReferenceCount;
580 ULONG ProcessCount;
581 } EPROCESS_QUOTA_BLOCK, *PEPROCESS_QUOTA_BLOCK;
582
583 //
584 // FIXME: This really belongs in mmtypes.h
585 //
586 typedef struct _PAGEFAULT_HISTORY
587 {
588 ULONG CurrentIndex;
589 ULONG MapIndex;
590 KSPIN_LOCK SpinLock;
591 PVOID Reserved;
592 PROCESS_WS_WATCH_INFORMATION WatchInfo[1];
593 } PAGEFAULT_HISTORY, *PPAGEFAULT_HISTORY;
594
595 //
596 // Process Impersonation Information
597 //
598 typedef struct _PS_IMPERSONATION_INFORMATION
599 {
600 PACCESS_TOKEN Token;
601 BOOLEAN CopyOnOpen;
602 BOOLEAN EffectiveOnly;
603 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
604 } PS_IMPERSONATION_INFORMATION, *PPS_IMPERSONATION_INFORMATION;
605
606 //
607 // Process Termination Port
608 //
609 typedef struct _TERMINATION_PORT
610 {
611 struct _TERMINATION_PORT *Next;
612 PVOID Port;
613 } TERMINATION_PORT, *PTERMINATION_PORT;
614
615 //
616 // Executive Thread (ETHREAD)
617 //
618 #include <pshpack4.h>
619 typedef struct _ETHREAD
620 {
621 KTHREAD Tcb; /* 000 */
622 PVOID Padding; /* 1B4 */
623 LARGE_INTEGER CreateTime; /* 1B8 */
624 union
625 {
626 LARGE_INTEGER ExitTime; /* 1C0 */
627 LIST_ENTRY LpcReplyChain; /* 1C0 */
628 LIST_ENTRY KeyedWaitChain; /* 1C0 */
629 };
630 union
631 {
632 NTSTATUS ExitStatus; /* 1C8 */
633 PVOID OfsChain; /* 1C8 */
634 };
635 LIST_ENTRY PostBlockList; /* 1CC */
636 union
637 {
638 struct _TERMINATION_PORT *TerminationPort; /* 1D4 */
639 struct _ETHREAD *ReaperLink; /* 1D4 */
640 PVOID KeyedWaitValue; /* 1D4 */
641 };
642 KSPIN_LOCK ActiveTimerListLock; /* 1D8 */
643 LIST_ENTRY ActiveTimerListHead; /* 1DC */
644 CLIENT_ID Cid; /* 1E4 */
645 union
646 {
647 KSEMAPHORE LpcReplySemaphore; /* 1EC */
648 KSEMAPHORE KeyedReplySemaphore; /* 1EC */
649 };
650 union
651 {
652 PVOID LpcReplyMessage; /* 200 */
653 PVOID LpcWaitingOnPort; /* 200 */
654 };
655 PPS_IMPERSONATION_INFORMATION ImpersonationInfo; /* 204 */
656 LIST_ENTRY IrpList; /* 208 */
657 ULONG TopLevelIrp; /* 210 */
658 PDEVICE_OBJECT DeviceToVerify; /* 214 */
659 struct _EPROCESS *ThreadsProcess; /* 218 */
660 PKSTART_ROUTINE StartAddress; /* 21C */
661 union
662 {
663 PVOID Win32StartAddress; /* 220 */
664 ULONG LpcReceivedMessageId; /* 220 */
665 };
666 LIST_ENTRY ThreadListEntry; /* 224 */
667 EX_RUNDOWN_REF RundownProtect; /* 22C */
668 EX_PUSH_LOCK ThreadLock; /* 230 */
669 ULONG LpcReplyMessageId; /* 234 */
670 ULONG ReadClusterSize; /* 238 */
671 ACCESS_MASK GrantedAccess; /* 23C */
672 union
673 {
674 struct
675 {
676 ULONG Terminated:1;
677 ULONG DeadThread:1;
678 ULONG HideFromDebugger:1;
679 ULONG ActiveImpersonationInfo:1;
680 ULONG SystemThread:1;
681 ULONG HardErrorsAreDisabled:1;
682 ULONG BreakOnTermination:1;
683 ULONG SkipCreationMsg:1;
684 ULONG SkipTerminationMsg:1;
685 };
686 ULONG CrossThreadFlags; /* 240 */
687 };
688 union
689 {
690 struct
691 {
692 ULONG ActiveExWorker:1;
693 ULONG ExWorkerCanWaitUser:1;
694 ULONG MemoryMaker:1;
695 ULONG KeyedEventInUse:1;
696 };
697 ULONG SameThreadPassiveFlags; /* 244 */
698 };
699 union
700 {
701 struct
702 {
703 ULONG LpcReceivedMsgIdValid:1;
704 ULONG LpcExitThreadCalled:1;
705 ULONG AddressSpaceOwner:1;
706 ULONG OwnsProcessWorkingSetExclusive:1;
707 ULONG OwnsProcessWorkingSetShared:1;
708 ULONG OwnsSystemWorkingSetExclusive:1;
709 ULONG OwnsSystemWorkingSetShared:1;
710 ULONG OwnsSessionWorkingSetExclusive:1;
711 ULONG OwnsSessionWorkingSetShared:1;
712 ULONG ApcNeeded:1;
713 };
714 ULONG SameThreadApcFlags; /* 248 */
715 };
716 UCHAR ForwardClusterOnly; /* 24C */
717 UCHAR DisablePageFaultClustering; /* 24D */
718 UCHAR ActiveFaultCount; /* 24E */
719 } ETHREAD;
720
721 #if defined(_NTOSKRNL_)
722 #include <internal/mm.h>
723 #endif
724
725 //
726 // Executive Process (EPROCESS)
727 //
728 typedef struct _EPROCESS
729 {
730 KPROCESS Pcb; /* 000 */
731 EX_PUSH_LOCK ProcessLock; /* 078 */
732 LARGE_INTEGER CreateTime; /* 080 */
733 LARGE_INTEGER ExitTime; /* 088 */
734 EX_RUNDOWN_REF RundownProtect; /* 090 */
735 HANDLE UniqueProcessId; /* 094 */
736 LIST_ENTRY ActiveProcessLinks; /* 098 */
737 ULONG QuotaUsage[3]; /* 0A0 */
738 ULONG QuotaPeak[3]; /* 0AC */
739 ULONG CommitCharge; /* 0B8 */
740 ULONG PeakVirtualSize; /* 0BC */
741 ULONG VirtualSize; /* 0C0 */
742 LIST_ENTRY SessionProcessLinks; /* 0C4 */
743 PVOID DebugPort; /* 0CC */
744 PVOID ExceptionPort; /* 0D0 */
745 PHANDLE_TABLE ObjectTable; /* 0D4 */
746 EX_FAST_REF Token; /* 0D8 */
747 ULONG WorkingSetPage; /* 0DC */
748 KGUARDED_MUTEX AddressCreationLock; /* 0E0 */
749 KSPIN_LOCK HyperSpaceLock; /* 100 */
750 PETHREAD ForkInProgress; /* 104 */
751 ULONG HardwareTrigger; /* 108 */
752 MM_AVL_TABLE PhysicalVadroot; /* 10C */
753 PVOID CloneRoot; /* 110 */
754 ULONG NumberOfPrivatePages; /* 114 */
755 ULONG NumberOfLockedPages; /* 118 */
756 PVOID *Win32Process; /* 11C */
757 struct _EJOB *Job; /* 120 */
758 PVOID SectionObject; /* 124 */
759 PVOID SectionBaseAddress; /* 128 */
760 PEPROCESS_QUOTA_BLOCK QuotaBlock; /* 12C */
761 PPAGEFAULT_HISTORY WorkingSetWatch; /* 130 */
762 PVOID Win32WindowStation; /* 134 */
763 HANDLE InheritedFromUniqueProcessId; /* 138 */
764 PVOID LdtInformation; /* 13C */
765 PVOID VadFreeHint; /* 140 */
766 PVOID VdmObjects; /* 144 */
767 PVOID DeviceMap; /* 148 */
768 PVOID Spare0[3]; /* 14C */
769 union
770 {
771 HARDWARE_PTE_X86 PagedirectoryPte; /* 158 */
772 ULONGLONG Filler; /* 158 */
773 };
774 ULONG Session; /* 160 */
775 CHAR ImageFileName[16]; /* 164 */
776 LIST_ENTRY JobLinks; /* 174 */
777 PVOID LockedPagesList; /* 17C */
778 LIST_ENTRY ThreadListHead; /* 184 */
779 PVOID SecurityPort; /* 188 */
780 PVOID PaeTop; /* 18C */
781 ULONG ActiveThreads; /* 190 */
782 ACCESS_MASK GrantedAccess; /* 194 */
783 ULONG DefaultHardErrorProcessing; /* 198 */
784 NTSTATUS LastThreadExitStatus; /* 19C */
785 struct _PEB* Peb; /* 1A0 */
786 EX_FAST_REF PrefetchTrace; /* 1A4 */
787 LARGE_INTEGER ReadOperationCount; /* 1A8 */
788 LARGE_INTEGER WriteOperationCount; /* 1B0 */
789 LARGE_INTEGER OtherOperationCount; /* 1B8 */
790 LARGE_INTEGER ReadTransferCount; /* 1C0 */
791 LARGE_INTEGER WriteTransferCount; /* 1C8 */
792 LARGE_INTEGER OtherTransferCount; /* 1D0 */
793 ULONG CommitChargeLimit; /* 1D8 */
794 ULONG CommitChargePeak; /* 1DC */
795 PVOID AweInfo; /* 1E0 */
796 SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo; /* 1E4 */
797 MMSUPPORT Vm; /* 1E8 */
798 LIST_ENTRY MmProcessLinks; /* 230 */
799 ULONG ModifiedPageCount; /* 238 */
800 ULONG JobStatus; /* 23C */
801 union
802 {
803 struct
804 {
805 ULONG CreateReported:1;
806 ULONG NoDebugInherit:1;
807 ULONG ProcessExiting:1;
808 ULONG ProcessDelete:1;
809 ULONG Wow64SplitPages:1;
810 ULONG VmDeleted:1;
811 ULONG OutswapEnabled:1;
812 ULONG Outswapped:1;
813 ULONG ForkFailed:1;
814 ULONG Wow64VaSpace4Gb:1;
815 ULONG AddressSpaceInitialized:2;
816 ULONG SetTimerResolution:1;
817 ULONG BreakOnTermination:1;
818 ULONG SessionCreationUnderway:1;
819 ULONG WriteWatch:1;
820 ULONG ProcessInSession:1;
821 ULONG OverrideAddressSpace:1;
822 ULONG HasAddressSpace:1;
823 ULONG LaunchPrefetched:1;
824 ULONG InjectInpageErrors:1;
825 ULONG VmTopDown:1;
826 ULONG ImageNotifyDone:1;
827 ULONG PdeUpdateNeeded:1;
828 ULONG VdmAllowed:1;
829 ULONG SmapAllowed:1;
830 ULONG CreateFailed:1;
831 ULONG DefaultIoPriority:3;
832 ULONG Spare1:1;
833 ULONG Spare2:1;
834 };
835 ULONG Flags; /* 240 */
836 };
837
838 NTSTATUS ExitStatus; /* 244 */
839 USHORT NextPageColor; /* 248 */
840 union
841 {
842 struct
843 {
844 UCHAR SubSystemMinorVersion; /* 24A */
845 UCHAR SubSystemMajorVersion; /* 24B */
846 };
847 USHORT SubSystemVersion; /* 24A */
848 };
849 UCHAR PriorityClass; /* 24C */
850 MM_AVL_TABLE VadRoot; /* 250 */
851 ULONG Cookie; /* 270 */
852
853 #ifdef _REACTOS_
854 /* FIXME: WILL BE DEPRECATED WITH PUSHLOCK SUPPORT IN 0.3.0*/
855 KEVENT LockEvent; /* 274 */
856 ULONG LockCount; /* 284 */
857 struct _KTHREAD *LockOwner; /* 288 */
858
859 /* FIXME: MOVE TO AVL TREES */
860 MADDRESS_SPACE AddressSpace; /* 28C */
861 #endif
862 } EPROCESS;
863 #include <poppack.h>
864
865 //
866 // Job Token Filter Data
867 //
868 #include <pshpack1.h>
869 typedef struct _PS_JOB_TOKEN_FILTER
870 {
871 ULONG CapturedSidCount;
872 PSID_AND_ATTRIBUTES CapturedSids;
873 ULONG CapturedSidsLength;
874 ULONG CapturedGroupCount;
875 PSID_AND_ATTRIBUTES CapturedGroups;
876 ULONG CapturedGroupsLength;
877 ULONG CapturedPrivilegeCount;
878 PLUID_AND_ATTRIBUTES CapturedPrivileges;
879 ULONG CapturedPrivilegesLength;
880 } PS_JOB_TOKEN_FILTER, *PPS_JOB_TOKEN_FILTER;
881
882 //
883 // Executive Job (EJOB)
884 //
885 typedef struct _EJOB
886 {
887 KEVENT Event;
888 LIST_ENTRY JobLinks;
889 LIST_ENTRY ProcessListHead;
890 ERESOURCE JobLock;
891 LARGE_INTEGER TotalUserTime;
892 LARGE_INTEGER TotalKernelTime;
893 LARGE_INTEGER ThisPeriodTotalUserTime;
894 LARGE_INTEGER ThisPeriodTotalKernelTime;
895 ULONG TotalPageFaultCount;
896 ULONG TotalProcesses;
897 ULONG ActiveProcesses;
898 ULONG TotalTerminatedProcesses;
899 LARGE_INTEGER PerProcessUserTimeLimit;
900 LARGE_INTEGER PerJobUserTimeLimit;
901 ULONG LimitFlags;
902 ULONG MinimumWorkingSetSize;
903 ULONG MaximumWorkingSetSize;
904 ULONG ActiveProcessLimit;
905 ULONG Affinity;
906 UCHAR PriorityClass;
907 ULONG UIRestrictionsClass;
908 ULONG SecurityLimitFlags;
909 PVOID Token;
910 PPS_JOB_TOKEN_FILTER Filter;
911 ULONG EndOfJobTimeAction;
912 PVOID CompletionPort;
913 PVOID CompletionKey;
914 ULONG SessionId;
915 ULONG SchedulingClass;
916 ULONGLONG ReadOperationCount;
917 ULONGLONG WriteOperationCount;
918 ULONGLONG OtherOperationCount;
919 ULONGLONG ReadTransferCount;
920 ULONGLONG WriteTransferCount;
921 ULONGLONG OtherTransferCount;
922 IO_COUNTERS IoInfo;
923 ULONG ProcessMemoryLimit;
924 ULONG JobMemoryLimit;
925 ULONG PeakProcessMemoryUsed;
926 ULONG PeakJobMemoryUsed;
927 ULONG CurrentJobMemoryUsed;
928 KGUARDED_MUTEX MemoryLimitsLock;
929 ULONG MemberLevel;
930 ULONG JobFlags;
931 } EJOB, *PEJOB;
932 #include <poppack.h>
933
934 //
935 // Win32K Callback Registration Data
936 //
937 typedef struct _W32_CALLOUT_DATA
938 {
939 PW32_PROCESS_CALLBACK W32ProcessCallout;
940 PW32_THREAD_CALLBACK W32ThreadCallout;
941 PVOID UserGlobalAtomTableCallout;
942 PVOID UserPowerEventCallout;
943 PVOID UserPowerStateCallout;
944 PVOID UserJobCallout;
945 PVOID NtGdiUserFlushUserBatch;
946 OB_OPEN_METHOD DesktopOpen;
947 PVOID DesktopUnmap;
948 OB_DELETE_METHOD DesktopDelete;
949 OB_OKAYTOCLOSE_METHOD WinstaOkayToClose;
950 OB_DELETE_METHOD WinStaDelete;
951 OB_PARSE_METHOD WinStaParse;
952 OB_OPEN_METHOD WinStaOpen;
953 #ifdef _REACTOS_
954 /* FIXME: REACTOS ONLY */
955 OB_FIND_METHOD WinStaFind;
956 OB_OPEN_METHOD WinStaCreate;
957 OB_CREATE_METHOD DesktopCreate;
958 #endif
959 } W32_CALLOUT_DATA, *PW32_CALLOUT_DATA;
960
961 #endif // !NTOS_MODE_USER
962
963 #endif // _PSTYPES_H