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