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