- New ERESOURCE implementation: fixes the return value of some functions (VOID vs...
[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; /* 000 */
604 PVOID Padding; /* 1B4 */
605 LARGE_INTEGER CreateTime; /* 1B8 */
606 union
607 {
608 LARGE_INTEGER ExitTime; /* 1C0 */
609 LIST_ENTRY LpcReplyChain; /* 1C0 */
610 LIST_ENTRY KeyedWaitChain; /* 1C0 */
611 };
612 union
613 {
614 NTSTATUS ExitStatus; /* 1C8 */
615 PVOID OfsChain; /* 1C8 */
616 };
617 LIST_ENTRY PostBlockList; /* 1CC */
618 union
619 {
620 struct _TERMINATION_PORT *TerminationPort; /* 1D4 */
621 struct _ETHREAD *ReaperLink; /* 1D4 */
622 PVOID KeyedWaitValue; /* 1D4 */
623 };
624 KSPIN_LOCK ActiveTimerListLock; /* 1D8 */
625 LIST_ENTRY ActiveTimerListHead; /* 1DC */
626 CLIENT_ID Cid; /* 1E4 */
627 union
628 {
629 KSEMAPHORE LpcReplySemaphore; /* 1EC */
630 KSEMAPHORE KeyedReplySemaphore; /* 1EC */
631 };
632 union
633 {
634 PVOID LpcReplyMessage; /* 200 */
635 PVOID LpcWaitingOnPort; /* 200 */
636 };
637 PPS_IMPERSONATION_INFORMATION ImpersonationInfo; /* 204 */
638 LIST_ENTRY IrpList; /* 208 */
639 ULONG TopLevelIrp; /* 210 */
640 PDEVICE_OBJECT DeviceToVerify; /* 214 */
641 struct _EPROCESS *ThreadsProcess; /* 218 */
642 PKSTART_ROUTINE StartAddress; /* 21C */
643 union
644 {
645 PVOID Win32StartAddress; /* 220 */
646 ULONG LpcReceivedMessageId; /* 220 */
647 };
648 LIST_ENTRY ThreadListEntry; /* 224 */
649 EX_RUNDOWN_REF RundownProtect; /* 22C */
650 EX_PUSH_LOCK ThreadLock; /* 230 */
651 ULONG LpcReplyMessageId; /* 234 */
652 ULONG ReadClusterSize; /* 238 */
653 ACCESS_MASK GrantedAccess; /* 23C */
654 union
655 {
656 struct
657 {
658 ULONG Terminated:1;
659 ULONG DeadThread:1;
660 ULONG HideFromDebugger:1;
661 ULONG ActiveImpersonationInfo:1;
662 ULONG SystemThread:1;
663 ULONG HardErrorsAreDisabled:1;
664 ULONG BreakOnTermination:1;
665 ULONG SkipCreationMsg:1;
666 ULONG SkipTerminationMsg:1;
667 };
668 ULONG CrossThreadFlags; /* 240 */
669 };
670 union
671 {
672 struct
673 {
674 ULONG ActiveExWorker:1;
675 ULONG ExWorkerCanWaitUser:1;
676 ULONG MemoryMaker:1;
677 ULONG KeyedEventInUse:1;
678 };
679 ULONG SameThreadPassiveFlags; /* 244 */
680 };
681 union
682 {
683 struct
684 {
685 ULONG LpcReceivedMsgIdValid:1;
686 ULONG LpcExitThreadCalled:1;
687 ULONG AddressSpaceOwner:1;
688 ULONG OwnsProcessWorkingSetExclusive:1;
689 ULONG OwnsProcessWorkingSetShared:1;
690 ULONG OwnsSystemWorkingSetExclusive:1;
691 ULONG OwnsSystemWorkingSetShared:1;
692 ULONG OwnsSessionWorkingSetExclusive:1;
693 ULONG OwnsSessionWorkingSetShared:1;
694 ULONG ApcNeeded:1;
695 };
696 ULONG SameThreadApcFlags; /* 248 */
697 };
698 UCHAR ForwardClusterOnly; /* 24C */
699 UCHAR DisablePageFaultClustering; /* 24D */
700 UCHAR ActiveFaultCount; /* 24E */
701 } ETHREAD;
702
703 #if defined(_NTOSKRNL_)
704 #include <internal/mm.h>
705 #endif
706
707 //
708 // Executive Process (EPROCESS)
709 //
710 typedef struct _EPROCESS
711 {
712 KPROCESS Pcb; /* 000 */
713 EX_PUSH_LOCK ProcessLock; /* 078 */
714 LARGE_INTEGER CreateTime; /* 080 */
715 LARGE_INTEGER ExitTime; /* 088 */
716 EX_RUNDOWN_REF RundownProtect; /* 090 */
717 HANDLE UniqueProcessId; /* 094 */
718 LIST_ENTRY ActiveProcessLinks; /* 098 */
719 ULONG QuotaUsage[3]; /* 0A0 */
720 ULONG QuotaPeak[3]; /* 0AC */
721 ULONG CommitCharge; /* 0B8 */
722 ULONG PeakVirtualSize; /* 0BC */
723 ULONG VirtualSize; /* 0C0 */
724 LIST_ENTRY SessionProcessLinks; /* 0C4 */
725 PVOID DebugPort; /* 0CC */
726 PVOID ExceptionPort; /* 0D0 */
727 PHANDLE_TABLE ObjectTable; /* 0D4 */
728 EX_FAST_REF Token; /* 0D8 */
729 ULONG WorkingSetPage; /* 0DC */
730 KGUARDED_MUTEX AddressCreationLock; /* 0E0 */
731 KSPIN_LOCK HyperSpaceLock; /* 100 */
732 PETHREAD ForkInProgress; /* 104 */
733 ULONG HardwareTrigger; /* 108 */
734 MM_AVL_TABLE PhysicalVadroot; /* 10C */
735 PVOID CloneRoot; /* 110 */
736 ULONG NumberOfPrivatePages; /* 114 */
737 ULONG NumberOfLockedPages; /* 118 */
738 PVOID *Win32Process; /* 11C */
739 struct _EJOB *Job; /* 120 */
740 PVOID SectionObject; /* 124 */
741 PVOID SectionBaseAddress; /* 128 */
742 PEPROCESS_QUOTA_BLOCK QuotaBlock; /* 12C */
743 PPAGEFAULT_HISTORY WorkingSetWatch; /* 130 */
744 PVOID Win32WindowStation; /* 134 */
745 HANDLE InheritedFromUniqueProcessId; /* 138 */
746 PVOID LdtInformation; /* 13C */
747 PVOID VadFreeHint; /* 140 */
748 PVOID VdmObjects; /* 144 */
749 PVOID DeviceMap; /* 148 */
750 PVOID Spare0[3]; /* 14C */
751 union
752 {
753 HARDWARE_PTE_X86 PagedirectoryPte; /* 158 */
754 ULONGLONG Filler; /* 158 */
755 };
756 ULONG Session; /* 160 */
757 CHAR ImageFileName[16]; /* 164 */
758 LIST_ENTRY JobLinks; /* 174 */
759 PVOID LockedPagesList; /* 17C */
760 LIST_ENTRY ThreadListHead; /* 184 */
761 PVOID SecurityPort; /* 188 */
762 PVOID PaeTop; /* 18C */
763 ULONG ActiveThreads; /* 190 */
764 ACCESS_MASK GrantedAccess; /* 194 */
765 ULONG DefaultHardErrorProcessing; /* 198 */
766 NTSTATUS LastThreadExitStatus; /* 19C */
767 struct _PEB* Peb; /* 1A0 */
768 EX_FAST_REF PrefetchTrace; /* 1A4 */
769 LARGE_INTEGER ReadOperationCount; /* 1A8 */
770 LARGE_INTEGER WriteOperationCount; /* 1B0 */
771 LARGE_INTEGER OtherOperationCount; /* 1B8 */
772 LARGE_INTEGER ReadTransferCount; /* 1C0 */
773 LARGE_INTEGER WriteTransferCount; /* 1C8 */
774 LARGE_INTEGER OtherTransferCount; /* 1D0 */
775 ULONG CommitChargeLimit; /* 1D8 */
776 ULONG CommitChargePeak; /* 1DC */
777 PVOID AweInfo; /* 1E0 */
778 SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo; /* 1E4 */
779 MMSUPPORT Vm; /* 1E8 */
780 LIST_ENTRY MmProcessLinks; /* 230 */
781 ULONG ModifiedPageCount; /* 238 */
782 ULONG JobStatus; /* 23C */
783 union
784 {
785 struct
786 {
787 ULONG CreateReported:1;
788 ULONG NoDebugInherit:1;
789 ULONG ProcessExiting:1;
790 ULONG ProcessDelete:1;
791 ULONG Wow64SplitPages:1;
792 ULONG VmDeleted:1;
793 ULONG OutswapEnabled:1;
794 ULONG Outswapped:1;
795 ULONG ForkFailed:1;
796 ULONG Wow64VaSpace4Gb:1;
797 ULONG AddressSpaceInitialized:2;
798 ULONG SetTimerResolution:1;
799 ULONG BreakOnTermination:1;
800 ULONG SessionCreationUnderway:1;
801 ULONG WriteWatch:1;
802 ULONG ProcessInSession:1;
803 ULONG OverrideAddressSpace:1;
804 ULONG HasAddressSpace:1;
805 ULONG LaunchPrefetched:1;
806 ULONG InjectInpageErrors:1;
807 ULONG VmTopDown:1;
808 ULONG ImageNotifyDone:1;
809 ULONG PdeUpdateNeeded:1;
810 ULONG VdmAllowed:1;
811 ULONG SmapAllowed:1;
812 ULONG CreateFailed:1;
813 ULONG DefaultIoPriority:3;
814 ULONG Spare1:1;
815 ULONG Spare2:1;
816 };
817 ULONG Flags; /* 240 */
818 };
819
820 NTSTATUS ExitStatus; /* 244 */
821 USHORT NextPageColor; /* 248 */
822 union
823 {
824 struct
825 {
826 UCHAR SubSystemMinorVersion; /* 24A */
827 UCHAR SubSystemMajorVersion; /* 24B */
828 };
829 USHORT SubSystemVersion; /* 24A */
830 };
831 UCHAR PriorityClass; /* 24C */
832 MM_AVL_TABLE VadRoot; /* 250 */
833 ULONG Cookie; /* 270 */
834
835 #ifdef _REACTOS_
836 /* FIXME: WILL BE DEPRECATED WITH PUSHLOCK SUPPORT IN 0.3.0*/
837 KEVENT LockEvent; /* 274 */
838 ULONG LockCount; /* 284 */
839 struct _KTHREAD *LockOwner; /* 288 */
840
841 /* FIXME: MOVE TO AVL TREES */
842 MADDRESS_SPACE AddressSpace; /* 28C */
843 #endif
844 } EPROCESS;
845 #include <poppack.h>
846
847 //
848 // Job Token Filter Data
849 //
850 #include <pshpack1.h>
851 typedef struct _PS_JOB_TOKEN_FILTER
852 {
853 ULONG CapturedSidCount;
854 PSID_AND_ATTRIBUTES CapturedSids;
855 ULONG CapturedSidsLength;
856 ULONG CapturedGroupCount;
857 PSID_AND_ATTRIBUTES CapturedGroups;
858 ULONG CapturedGroupsLength;
859 ULONG CapturedPrivilegeCount;
860 PLUID_AND_ATTRIBUTES CapturedPrivileges;
861 ULONG CapturedPrivilegesLength;
862 } PS_JOB_TOKEN_FILTER, *PPS_JOB_TOKEN_FILTER;
863
864 //
865 // Executive Job (EJOB)
866 //
867 typedef struct _EJOB
868 {
869 KEVENT Event;
870 LIST_ENTRY JobLinks;
871 LIST_ENTRY ProcessListHead;
872 ERESOURCE JobLock;
873 LARGE_INTEGER TotalUserTime;
874 LARGE_INTEGER TotalKernelTime;
875 LARGE_INTEGER ThisPeriodTotalUserTime;
876 LARGE_INTEGER ThisPeriodTotalKernelTime;
877 ULONG TotalPageFaultCount;
878 ULONG TotalProcesses;
879 ULONG ActiveProcesses;
880 ULONG TotalTerminatedProcesses;
881 LARGE_INTEGER PerProcessUserTimeLimit;
882 LARGE_INTEGER PerJobUserTimeLimit;
883 ULONG LimitFlags;
884 ULONG MinimumWorkingSetSize;
885 ULONG MaximumWorkingSetSize;
886 ULONG ActiveProcessLimit;
887 ULONG Affinity;
888 UCHAR PriorityClass;
889 ULONG UIRestrictionsClass;
890 ULONG SecurityLimitFlags;
891 PVOID Token;
892 PPS_JOB_TOKEN_FILTER Filter;
893 ULONG EndOfJobTimeAction;
894 PVOID CompletionPort;
895 PVOID CompletionKey;
896 ULONG SessionId;
897 ULONG SchedulingClass;
898 ULONGLONG ReadOperationCount;
899 ULONGLONG WriteOperationCount;
900 ULONGLONG OtherOperationCount;
901 ULONGLONG ReadTransferCount;
902 ULONGLONG WriteTransferCount;
903 ULONGLONG OtherTransferCount;
904 IO_COUNTERS IoInfo;
905 ULONG ProcessMemoryLimit;
906 ULONG JobMemoryLimit;
907 ULONG PeakProcessMemoryUsed;
908 ULONG PeakJobMemoryUsed;
909 ULONG CurrentJobMemoryUsed;
910 KGUARDED_MUTEX MemoryLimitsLock;
911 ULONG MemberLevel;
912 ULONG JobFlags;
913 } EJOB, *PEJOB;
914 #include <poppack.h>
915
916 //
917 // Win32K Callback Registration Data
918 //
919 typedef struct _W32_CALLOUT_DATA
920 {
921 PW32_PROCESS_CALLBACK W32ProcessCallout;
922 PW32_THREAD_CALLBACK W32ThreadCallout;
923 PVOID UserGlobalAtomTableCallout;
924 PVOID UserPowerEventCallout;
925 PVOID UserPowerStateCallout;
926 PVOID UserJobCallout;
927 PVOID NtGdiUserFlushUserBatch;
928 OB_OPEN_METHOD DesktopOpen;
929 PVOID DesktopUnmap;
930 OB_DELETE_METHOD DesktopDelete;
931 OB_OKAYTOCLOSE_METHOD WinstaOkayToClose;
932 OB_DELETE_METHOD WinStaDelete;
933 OB_PARSE_METHOD WinStaParse;
934 OB_OPEN_METHOD WinStaOpen;
935 #ifdef _REACTOS_
936 /* FIXME: REACTOS ONLY */
937 OB_FIND_METHOD WinStaFind;
938 OB_OPEN_METHOD WinStaCreate;
939 OB_CREATE_METHOD DesktopCreate;
940 #endif
941 } W32_CALLOUT_DATA, *PW32_CALLOUT_DATA;
942
943 #endif // !NTOS_MODE_USER
944
945 #endif // _PSTYPES_H