1 #ifndef __INCLUDE_DDK_PSTYPES_H
2 #define __INCLUDE_DDK_PSTYPES_H
4 #include <kernel32/atom.h>
5 #include <internal/hal.h>
6 #include <internal/teb.h>
8 #ifndef TLS_MINIMUM_AVAILABLE
9 #define TLS_MINIMUM_AVAILABLE (64)
12 #define MAX_PATH (260)
15 typedef NTSTATUS (*PKSTART_ROUTINE
)(PVOID StartContext
);
17 typedef struct _STACK_INFORMATION
21 } STACK_INFORMATION
, *PSTACK_INFORMATION
;
23 typedef struct linux_sigcontext
{
46 } TRAP_FRAME
, *PTRAP_FRAME
;
48 typedef ULONG THREADINFOCLASS
;
52 typedef struct _KAPC_STATE
54 LIST_ENTRY ApcListHead
[2];
55 struct _KPROCESS
* Process
;
56 ULONG KernelApcInProgress
;
57 ULONG KernelApcPending
;
58 USHORT UserApcPending
;
59 } KAPC_STATE
, *PKAPC_STATE
;
61 typedef struct _KTHREAD
63 DISPATCHER_HEADER DispatcherHeader
; // For waiting for the thread
64 LIST_ENTRY MutantListHead
;
78 ULONG ContextSwitches
;
84 PKWAIT_BLOCK WaitBlockList
;
85 LIST_ENTRY WaitListEntry
;
87 KPRIORITY BasePriority
;
89 UCHAR PriorityDecrement
;
91 KWAIT_BLOCK WaitBlock
[4];
93 LONG KernelApcDisable
;
94 KAFFINITY UserAffinity
;
95 UCHAR SystemAffinityActive
;
98 KSPIN_LOCK ApcQueueLock
;
100 LIST_ENTRY QueueListEntry
;
103 UCHAR ProcessReadyQueue
;
104 UCHAR KernelStackResident
;
109 PVOID ApcStatePointer
; // Is actually eight bytes
110 UCHAR EnableStackSwap
;
116 KAPC_STATE SavedApcState
;
122 KSEMAPHORE SuspendSemaphore
;
123 LIST_ENTRY ThreadListEntry
;
126 UCHAR IdealProcessor
;
128 LIST_ENTRY ProcessThreadListEntry
; // Added by Phillip Susi for list of threads in a process
130 /* Provisionally added by David Welch */
131 hal_thread_state Context
;
132 KDPC TimerDpc
; // Added by Phillip Susi for internal KeAddThreadTimeout() impl.
133 } KTHREAD
, *PKTHREAD
;
135 // According to documentation the stack should have a commited [ 1 page ] and
136 // a reserved part [ 1 M ] but can be specified otherwise in the image file.
138 typedef struct _INITIAL_TEB
143 PVOID StackCommitMax
;
145 } INITIAL_TEB
, *PINITIAL_TEB
;
152 // TopLevelIrp can be one of the following values:
153 // FIXME I belong somewhere else
155 #define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
156 #define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
157 #define FSRTL_MOD_WRITE_TOP_LEVEL_IRP (0x03)
158 #define FSRTL_FAST_IO_TOP_LEVEL_IRP (0x04)
159 #define FSRTL_MAX_TOP_LEVEL_IRP_FLAG (0x04)
161 typedef struct _TOP_LEVEL_IRP
164 ULONG TopLevelIrpConst
;
169 PACCESS_TOKEN Token
; // 0x0
170 UCHAR Unknown1
; // 0x4
171 UCHAR Unknown2
; // 0x5
173 SECURITY_IMPERSONATION_LEVEL Level
; // 0x8
174 } PS_IMPERSONATION_INFO
, *PPS_IMPERSONATION_INFO
;
176 typedef struct _ETHREAD
182 LIST_ENTRY PostBlockList
;
183 LIST_ENTRY TerminationPortList
;
184 KSPIN_LOCK ActiveTimerListLock
;
185 PVOID ActiveTimerListHead
;
187 PLARGE_INTEGER LpcReplySemaphore
;
188 PVOID LpcReplyMessage
;
189 PLARGE_INTEGER LpcReplyMessageId
;
190 PPS_IMPERSONATION_INFO ImpersonationInfo
;
192 TOP_LEVEL_IRP TopLevelIrp
;
193 ULONG ReadClusterSize
;
194 UCHAR ForwardClusterOnly
;
195 UCHAR DisablePageFaultClustering
;
198 ACCESS_MASK GrantedAccess
;
199 struct _EPROCESS
* ThreadsProcess
;
200 PKSTART_ROUTINE StartAddress
;
201 LPTHREAD_START_ROUTINE Win32StartAddress
;
202 UCHAR LpcExitThreadCalled
;
203 UCHAR HardErrorsAreDisabled
;
204 UCHAR LpcReceivedMsgIdValid
;
205 UCHAR ActiveImpersonationInfo
;
206 ULONG PerformanceCountHigh
;
209 * Added by David Welch (welch@cwcom.net)
211 struct _EPROCESS
* OldProcess
;
213 } ETHREAD
, *PETHREAD
;
216 typedef struct _KPROCESS
218 DISPATCHER_HEADER DispatcherHeader
;
219 PVOID PageTableDirectory
; // FIXME: I should point to a PTD
223 LIST_ENTRY InMemoryList
;
224 LIST_ENTRY SwappedOutList
;
228 KPRIORITY BasePriority
;
229 ULONG DefaultThreadQuantum
;
235 * Added by David Welch (welch@mcmail.com)
237 MADDRESS_SPACE AddressSpace
;
238 HANDLE_TABLE HandleTable
;
239 LIST_ENTRY ProcessListEntry
;
241 LIST_ENTRY ThreadListHead
; // Added by Phillip Susi for list of threads in process
243 } KPROCESS
, *PKPROCESS
;
245 typedef struct _EPROCESS
254 ULONG UniqueProcessId
;
255 LIST_ENTRY ActiveProcessLinks
;
256 ULONG QuotaPeakPoolUsage
[2];
257 ULONG QuotaPoolUsage
[2];
260 ULONG PeakPagefileUsage
;
261 ULONG PeakVirtualUsage
;
262 LARGE_INTEGER VirtualSize
;
263 PVOID Vm
; // Actually 48 bytes
264 PVOID LastProtoPteFault
;
269 KMUTEX WorkingSetLock
;
270 PVOID WorkingSetPage
;
271 UCHAR ProcessOutswapEnabled
;
272 UCHAR ProcessOutswapped
;
273 UCHAR AddressSpaceInitialized
;
274 UCHAR AddressSpaceDeleted
;
275 KMUTEX AddressCreationLock
;
276 PVOID ForkInProgress
;
278 PKEVENT VmOperationEvent
;
279 PVOID PageDirectoryPte
;
280 LARGE_INTEGER LastFaultCount
;
284 ULONG NumberOfPrivatePages
;
285 ULONG NumberOfLockedPages
;
286 UCHAR ForkWasSuccessFul
;
287 UCHAR ExitProcessCalled
;
288 UCHAR CreateProcessReported
;
289 HANDLE SectionHandle
;
291 PVOID SectionBaseAddress
;
293 NTSTATUS LastThreadExitStatus
;
294 LARGE_INTEGER WorkingSetWatch
; //
295 ULONG InheritedFromUniqueProcessId
;
296 ACCESS_MASK GrantedAccess
;
297 ULONG DefaultHardErrorProcessing
;
298 PVOID LdtInformation
;
301 KMUTANT ProcessMutant
;
302 CHAR ImageFileName
[16];
303 LARGE_INTEGER VmTrimFaultValue
;
304 PVOID Win32Process
; // Actually 12 bytes
305 PVOID Win32WindowStation
;
306 } EPROCESS
, *PEPROCESS
;
308 #define PROCESS_STATE_TERMINATED (1)
309 #define PROCESS_STATE_ACTIVE (2)
311 #define LOW_PRIORITY (0)
312 #define LOW_REALTIME_PRIORITY (16)
313 #define HIGH_PRIORITY (31)
314 #define MAXIMUM_PRIORITY (32)
317 #endif /* __INCLUDE_DDK_PSTYPES_H */