1 #ifndef __INCLUDE_DDK_PSTYPES_H
2 #define __INCLUDE_DDK_PSTYPES_H
4 #include <kernel32/heap.h>
5 #include <kernel32/atom.h>
6 #include <internal/hal.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
;
50 typedef struct _STARTUPINFOW
{
52 WCHAR WindowTitle
[MAX_PATH
];
53 WCHAR ImageFile
[MAX_PATH
];
54 WCHAR CommandLine
[MAX_PATH
];
55 WCHAR DllPath
[MAX_PATH
];
56 LPWSTR Reserved
[MAX_PATH
];
57 LPWSTR Desktop
[MAX_PATH
];
58 LPWSTR Title
[MAX_PATH
];
65 DWORD dwFillAttribute
;
69 unsigned char * lpReserved2
;
73 } PROCESSINFOW
, *PPROCESSINFOW
;
79 UCHAR InInitializationOrderModuleList
;
80 PVOID InLoadOrderModuleList
;
81 PVOID InMemoryOrderModuleList
;
85 typedef struct _NT_PEB
87 UCHAR InheritedAddressSpace
;
88 UCHAR ReadImageFileExecOptions
;
90 LONG ImageBaseAddress
;
93 WORD NumberOfProcessors
;
96 PPROCESSINFOW StartupInfo
;
98 ATOMTABLE LocalAtomTable
;
99 LPCRITICAL_SECTION CriticalSection
;
100 DWORD CriticalSectionTimeout
;
107 typedef struct _CLIENT_ID
109 HANDLE UniqueProcess
;
111 } CLIENT_ID
, *PCLIENT_ID
;
113 typedef struct _NT_TIB
{
114 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
122 PVOID ArbitraryUserPointer
;
123 struct _NT_TIB
*Self
;
126 typedef struct _NT_TEB
131 PVOID TlsData
[TLS_MINIMUM_AVAILABLE
];
135 NTSTATUS LastStatusValue
;
140 typedef struct _KTHREAD
142 DISPATCHER_HEADER DispatcherHeader
;
146 STACK_INFORMATION StackInformation
;
147 PVOID ServiceDescriptorTable
; // points to KeServiceDescriptorTable
149 KPRIORITY CurrentPriority
;
150 KPRIORITY BasePriority
;
152 UCHAR ThreadState
; //Thread state is a typeless enum, otherwise it should be const integer
155 PTRAP_FRAME TrapFrame
;
157 KWAIT_BLOCK WaitBlock
[4];
158 struct _KMUTANT
* MutantList
;
160 UCHAR KernelApcDisable
;
162 KDEVICE_QUEUE DeviceQueue
;
167 * NOTE: I have temporarily added this to give somewhere to store
168 * cpu state when the thread isn't running
170 hal_thread_state Context
;
173 } KTHREAD
, *PKTHREAD
;
176 // According to documentation the stack should have a commited [ 1 page ] and
177 // a reserved part [ 1 M ] but can be specified otherwise in the image file.
179 typedef struct _INITIAL_TEB
{
183 PVOID StackCommitMax
;
185 } INITIAL_TEB
, *PINITIAL_TEB
;
192 // TopLevelIrp can be one of the following values:
193 // FIXME I belong somewhere else
195 #define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
196 #define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
197 #define FSRTL_MOD_WRITE_TOP_LEVEL_IRP (0x03)
198 #define FSRTL_FAST_IO_TOP_LEVEL_IRP (0x04)
199 #define FSRTL_MAX_TOP_LEVEL_IRP_FLAG (0x04)
201 typedef struct _TOP_LEVEL_IRP
204 ULONG TopLevelIrpConst
;
207 typedef struct _ETHREAD
{
212 LIST_ENTRY PostBlockList
;
213 LIST_ENTRY TerminationPortList
;
214 ULONG ActiveTimerListLock
;
215 PVOID ActiveTimerListHead
;
217 PLARGE_INTEGER LpcReplySemaphore
;
218 PVOID LpcReplyMessage
;
219 PLARGE_INTEGER LpcReplyMessageId
;
220 PVOID ImpersonationInfo
;
221 LIST_ENTRY IrpList
; //
222 TOP_LEVEL_IRP TopLevelIrp
;
223 ULONG ReadClusterSize
;
224 UCHAR ForwardClusterOnly
;
225 UCHAR DisablePageFaultClustering
;
228 ACCESS_MASK GrantedAccess
;
229 struct _EPROCESS
* ThreadsProcess
;
230 PKSTART_ROUTINE StartAddress
;
231 LPTHREAD_START_ROUTINE Win32StartAddress
; // Should Specify a win32 start func
232 UCHAR LpcExitThreadCalled
;
233 UCHAR HardErrorsAreDisabled
;
237 * Added by David Welch (welch@cwcom.net)
239 struct _EPROCESS
* OldProcess
;
241 } ETHREAD
, *PETHREAD
;
244 typedef struct _KPROCESS
246 DISPATCHER_HEADER DispatcherHeader
;
247 PVOID PageTableDirectory
; // FIXME: I shoud point to a PTD
251 LIST_ENTRY InMemoryList
;
252 LIST_ENTRY SwappedOutList
;
256 KPRIORITY BasePriority
;
257 ULONG DefaultThreadQuantum
;
263 * Added by David Welch (welch@mcmail.com)
265 LIST_ENTRY MemoryAreaList
;
266 HANDLE_TABLE HandleTable
;
267 } KPROCESS
, *PKPROCESS
;
269 typedef struct _EPROCESS
272 } EPROCESS
, *PEPROCESS
;
274 #define PROCESS_STATE_TERMINATED (1)
275 #define PROCESS_STATE_ACTIVE (2)
277 #endif /* __INCLUDE_DDK_PSTYPES_H */