1 #ifndef __INCLUDE_DDK_PSTYPES_H
2 #define __INCLUDE_DDK_PSTYPES_H
4 #include <kernel32/atom.h>
5 #include <internal/hal.h>
7 #ifndef TLS_MINIMUM_AVAILABLE
8 #define TLS_MINIMUM_AVAILABLE (64)
11 #define MAX_PATH (260)
14 typedef NTSTATUS (*PKSTART_ROUTINE
)(PVOID StartContext
);
16 typedef struct _STACK_INFORMATION
20 } STACK_INFORMATION
, *PSTACK_INFORMATION
;
22 typedef struct linux_sigcontext
{
45 } TRAP_FRAME
, *PTRAP_FRAME
;
47 typedef ULONG THREADINFOCLASS
;
49 typedef struct _STARTUPINFOW
{
51 WCHAR WindowTitle
[MAX_PATH
];
52 WCHAR ImageFile
[MAX_PATH
];
53 WCHAR CommandLine
[MAX_PATH
];
54 WCHAR DllPath
[MAX_PATH
];
55 LPWSTR Reserved
[MAX_PATH
];
56 LPWSTR Desktop
[MAX_PATH
];
57 LPWSTR Title
[MAX_PATH
];
64 DWORD dwFillAttribute
;
68 unsigned char * lpReserved2
;
72 } PROCESSINFOW
, *PPROCESSINFOW
;
78 UCHAR InInitializationOrderModuleList
;
79 PVOID InLoadOrderModuleList
;
80 PVOID InMemoryOrderModuleList
;
84 typedef struct _NT_PEB
86 UCHAR InheritedAddressSpace
;
87 UCHAR ReadImageFileExecOptions
;
89 LONG ImageBaseAddress
;
92 WORD NumberOfProcessors
;
95 PPROCESSINFOW StartupInfo
;
97 ATOMTABLE LocalAtomTable
;
98 LPCRITICAL_SECTION CriticalSection
;
99 DWORD CriticalSectionTimeout
;
106 typedef struct _CLIENT_ID
108 HANDLE UniqueProcess
;
110 } CLIENT_ID
, *PCLIENT_ID
;
112 typedef struct _NT_TIB
{
113 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
121 PVOID ArbitraryUserPointer
;
122 struct _NT_TIB
*Self
;
125 typedef struct _NT_TEB
130 PVOID TlsData
[TLS_MINIMUM_AVAILABLE
];
134 NTSTATUS LastStatusValue
;
139 typedef struct _KTHREAD
141 DISPATCHER_HEADER DispatcherHeader
;
145 STACK_INFORMATION StackInformation
;
146 PVOID ServiceDescriptorTable
; // points to KeServiceDescriptorTable
148 KPRIORITY CurrentPriority
;
149 KPRIORITY BasePriority
;
151 UCHAR ThreadState
; //Thread state is a typeless enum, otherwise it should be const integer
154 PTRAP_FRAME TrapFrame
;
156 KWAIT_BLOCK WaitBlock
[4];
157 struct _KMUTANT
* MutantList
;
159 UCHAR KernelApcDisable
;
161 KDEVICE_QUEUE DeviceQueue
;
166 * NOTE: I have temporarily added this to give somewhere to store
167 * cpu state when the thread isn't running
169 hal_thread_state Context
;
172 } KTHREAD
, *PKTHREAD
;
175 // According to documentation the stack should have a commited [ 1 page ] and
176 // a reserved part [ 1 M ] but can be specified otherwise in the image file.
178 typedef struct _INITIAL_TEB
{
182 PVOID StackCommitMax
;
184 } INITIAL_TEB
, *PINITIAL_TEB
;
191 // TopLevelIrp can be one of the following values:
192 // FIXME I belong somewhere else
194 #define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
195 #define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
196 #define FSRTL_MOD_WRITE_TOP_LEVEL_IRP (0x03)
197 #define FSRTL_FAST_IO_TOP_LEVEL_IRP (0x04)
198 #define FSRTL_MAX_TOP_LEVEL_IRP_FLAG (0x04)
200 typedef struct _TOP_LEVEL_IRP
203 ULONG TopLevelIrpConst
;
206 typedef struct _ETHREAD
{
211 LIST_ENTRY PostBlockList
;
212 LIST_ENTRY TerminationPortList
;
213 ULONG ActiveTimerListLock
;
214 PVOID ActiveTimerListHead
;
216 PLARGE_INTEGER LpcReplySemaphore
;
217 PVOID LpcReplyMessage
;
218 PLARGE_INTEGER LpcReplyMessageId
;
219 PVOID ImpersonationInfo
;
220 LIST_ENTRY IrpList
; //
221 TOP_LEVEL_IRP TopLevelIrp
;
222 ULONG ReadClusterSize
;
223 UCHAR ForwardClusterOnly
;
224 UCHAR DisablePageFaultClustering
;
227 ACCESS_MASK GrantedAccess
;
228 struct _EPROCESS
* ThreadsProcess
;
229 PKSTART_ROUTINE StartAddress
;
230 LPTHREAD_START_ROUTINE Win32StartAddress
; // Should Specify a win32 start func
231 UCHAR LpcExitThreadCalled
;
232 UCHAR HardErrorsAreDisabled
;
236 * Added by David Welch (welch@cwcom.net)
238 struct _EPROCESS
* OldProcess
;
240 } ETHREAD
, *PETHREAD
;
243 typedef struct _KPROCESS
245 DISPATCHER_HEADER DispatcherHeader
;
246 PVOID PageTableDirectory
; // FIXME: I shoud point to a PTD
250 LIST_ENTRY InMemoryList
;
251 LIST_ENTRY SwappedOutList
;
255 KPRIORITY BasePriority
;
256 ULONG DefaultThreadQuantum
;
262 * Added by David Welch (welch@mcmail.com)
264 LIST_ENTRY MemoryAreaList
;
265 HANDLE_TABLE HandleTable
;
266 } KPROCESS
, *PKPROCESS
;
268 typedef struct _EPROCESS
271 } EPROCESS
, *PEPROCESS
;
273 #define PROCESS_STATE_TERMINATED (1)
274 #define PROCESS_STATE_ACTIVE (2)
276 #endif /* __INCLUDE_DDK_PSTYPES_H */