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