2 * PROJECT: ReactOS Native Headers
3 * FILE: include/ndk/ketypes.h
4 * PURPOSE: Definitions for Kernel Types not defined in DDK/IFS
5 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
12 /* DEPENDENCIES **************************************************************/
19 * Architecture-specific types
20 * NB: Although KPROCESS is Arch-Specific,
21 * only some members are different and we will use #ifdef
22 * directly in the structure to avoid dependency-hell
24 #include "arch/ketypes.h"
26 /* CONSTANTS *****************************************************************/
27 #define SSDT_MAX_ENTRIES 4
28 #define PROCESSOR_FEATURE_MAX 64
30 #define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
32 #define THREAD_WAIT_OBJECTS 4
34 /* EXPORTED DATA *************************************************************/
35 extern CHAR NTOSAPI KeNumberProcessors
;
36 extern LOADER_PARAMETER_BLOCK NTOSAPI KeLoaderBlock
;
37 extern ULONG NTOSAPI KeDcacheFlushCount
;
38 extern ULONG NTOSAPI KeIcacheFlushCount
;
39 extern KAFFINITY NTOSAPI KeActiveProcessors
;
40 extern ULONG NTOSAPI KiDmaIoCoherency
; /* RISC Architectures only */
41 extern ULONG NTOSAPI KeMaximumIncrement
;
42 extern ULONG NTOSAPI KeMinimumIncrement
;
43 extern ULONG NTOSAPI NtBuildNumber
;
44 extern SSDT_ENTRY NTOSAPI KeServiceDescriptorTable
[SSDT_MAX_ENTRIES
];
45 extern SSDT_ENTRY NTOSAPI KeServiceDescriptorTableShadow
[SSDT_MAX_ENTRIES
];
47 /* ENUMERATIONS **************************************************************/
49 /* TYPES *********************************************************************/
51 typedef struct _CONFIGURATION_COMPONENT_DATA
53 struct _CONFIGURATION_COMPONENT_DATA
*Parent
;
54 struct _CONFIGURATION_COMPONENT_DATA
*Child
;
55 struct _CONFIGURATION_COMPONENT_DATA
*Sibling
;
56 CONFIGURATION_COMPONENT Component
;
57 } CONFIGURATION_COMPONENT_DATA
, *PCONFIGURATION_COMPONENT_DATA
;
59 typedef enum _KAPC_ENVIRONMENT
61 OriginalApcEnvironment
,
62 AttachedApcEnvironment
,
66 /* We don't want to force NTIFS usage only for a single structure */
68 typedef struct _KAPC_STATE
70 LIST_ENTRY ApcListHead
[2];
72 BOOLEAN KernelApcInProgress
;
73 BOOLEAN KernelApcPending
;
74 BOOLEAN UserApcPending
;
75 } KAPC_STATE
, *PKAPC_STATE
, *RESTRICTED_POINTER PRKAPC_STATE
;
80 SLIST_HEADER DeadStackList
;
81 SLIST_HEADER PfnDereferenceSListHead
;
89 struct _SINGLE_LIST_ENTRY
*PfnDeferredList
;
92 typedef struct _KPROFILE
101 KPROFILE_SOURCE Source
;
104 struct _KPROCESS
*Process
;
105 } KPROFILE
, *PKPROFILE
;
107 typedef struct _KINTERRUPT
111 LIST_ENTRY InterruptListEntry
;
112 PKSERVICE_ROUTINE ServiceRoutine
;
113 PVOID ServiceContext
;
116 PKSPIN_LOCK ActualLock
;
117 PVOID DispatchAddress
;
120 KIRQL SynchronizeIrql
;
121 BOOLEAN FloatingSave
;
125 KINTERRUPT_MODE Mode
;
128 ULONG DispatchCode
[106];
129 } KINTERRUPT
, *PKINTERRUPT
;
131 typedef struct _KEVENT_PAIR
137 } KEVENT_PAIR
, *PKEVENT_PAIR
;
139 typedef struct _KEXECUTE_OPTIONS
141 UCHAR ExecuteDisable
:1;
142 UCHAR ExecuteEnable
:1;
143 UCHAR DisableThunkEmulation
:1;
145 UCHAR ExecuteDispatchEnable
:1;
146 UCHAR ImageDispatchEnable
:1;
148 } KEXECUTE_OPTIONS
, *PKEXECUTE_OPTIONS
;
150 typedef enum _KOBJECTS
152 EventNotificationObject
= 0,
153 EventSynchronizationObject
= 1,
160 TimerNotificationObject
= 8,
161 TimerSynchronizationObject
= 9,
172 DeviceQueueObject
= 20,
173 EventPairObject
= 21,
174 InterruptObject
= 22,
176 ThreadedDpcObject
= 24,
177 MaximumKernelObject
= 25
180 #include <pshpack1.h>
182 typedef struct _KTHREAD
184 DISPATCHER_HEADER DispatcherHeader
; /* 00 */
185 LIST_ENTRY MutantListHead
; /* 10 */
186 PVOID InitialStack
; /* 18 */
187 ULONG_PTR StackLimit
; /* 1C */
188 struct _TEB
*Teb
; /* 20 */
189 PVOID TlsArray
; /* 24 */
190 PVOID KernelStack
; /* 28 */
191 UCHAR DebugActive
; /* 2C */
192 UCHAR State
; /* 2D */
193 BOOLEAN Alerted
[2]; /* 2E */
195 UCHAR NpxState
; /* 31 */
196 CHAR Saturation
; /* 32 */
197 CHAR Priority
; /* 33 */
198 KAPC_STATE ApcState
; /* 34 */
199 ULONG ContextSwitches
; /* 4C */
200 LONG WaitStatus
; /* 50 */
201 KIRQL WaitIrql
; /* 54 */
202 CHAR WaitMode
; /* 55 */
203 UCHAR WaitNext
; /* 56 */
204 UCHAR WaitReason
; /* 57 */
207 PKWAIT_BLOCK WaitBlockList
; /* 58 */
208 PKGATE GateObject
; /* 58 */
210 LIST_ENTRY WaitListEntry
; /* 5C */
211 ULONG WaitTime
; /* 64 */
212 CHAR BasePriority
; /* 68 */
213 UCHAR DecrementCount
; /* 69 */
214 UCHAR PriorityDecrement
; /* 6A */
215 CHAR Quantum
; /* 6B */
216 KWAIT_BLOCK WaitBlock
[4]; /* 6C */
217 PVOID LegoData
; /* CC */
222 USHORT KernelApcDisable
;
223 USHORT SpecialApcDisable
;
225 ULONG CombinedApcDisable
; /* D0 */
227 KAFFINITY UserAffinity
; /* D4 */
228 UCHAR SystemAffinityActive
;/* D8 */
229 UCHAR PowerState
; /* D9 */
230 UCHAR NpxIrql
; /* DA */
231 UCHAR Pad
[1]; /* DB */
232 PVOID ServiceTable
; /* DC */
233 struct _KQUEUE
*Queue
; /* E0 */
234 KSPIN_LOCK ApcQueueLock
; /* E4 */
235 KTIMER Timer
; /* E8 */
236 LIST_ENTRY QueueListEntry
; /* 110 */
237 KAFFINITY Affinity
; /* 118 */
238 UCHAR Preempted
; /* 11C */
239 UCHAR ProcessReadyQueue
; /* 11D */
240 UCHAR KernelStackResident
; /* 11E */
241 UCHAR NextProcessor
; /* 11F */
242 PVOID CallbackStack
; /* 120 */
243 struct _W32THREAD
*Win32Thread
; /* 124 */
244 struct _KTRAP_FRAME
*TrapFrame
; /* 128 */
245 PKAPC_STATE ApcStatePointer
[2]; /* 12C */
246 UCHAR EnableStackSwap
; /* 134 */
247 UCHAR LargeStack
; /* 135 */
248 UCHAR ResourceIndex
; /* 136 */
249 UCHAR PreviousMode
; /* 137 */
250 ULONG KernelTime
; /* 138 */
251 ULONG UserTime
; /* 13C */
252 KAPC_STATE SavedApcState
; /* 140 */
253 UCHAR Alertable
; /* 158 */
254 UCHAR ApcStateIndex
; /* 159 */
255 UCHAR ApcQueueable
; /* 15A */
256 UCHAR AutoAlignment
; /* 15B */
257 PVOID StackBase
; /* 15C */
258 KAPC SuspendApc
; /* 160 */
259 KSEMAPHORE SuspendSemaphore
; /* 190 */
260 LIST_ENTRY ThreadListEntry
; /* 1A4 */
261 CHAR FreezeCount
; /* 1AC */
262 UCHAR SuspendCount
; /* 1AD */
263 UCHAR IdealProcessor
; /* 1AE */
264 UCHAR DisableBoost
; /* 1AF */
265 UCHAR QuantumReset
; /* 1B0 */
270 typedef struct _KPROCESS
272 DISPATCHER_HEADER Header
; /* 000 */
273 LIST_ENTRY ProfileListHead
; /* 010 */
274 PHYSICAL_ADDRESS DirectoryTableBase
; /* 018 */
276 KGDTENTRY LdtDescriptor
; /* 020 */
277 KIDTENTRY Int21Descriptor
; /* 028 */
278 USHORT IopmOffset
; /* 030 */
279 UCHAR Iopl
; /* 032 */
280 UCHAR Unused
; /* 033 */
282 ULONG ActiveProcessors
; /* 034 */
283 ULONG KernelTime
; /* 038 */
284 ULONG UserTime
; /* 03C */
285 LIST_ENTRY ReadyListHead
; /* 040 */
286 LIST_ENTRY SwapListEntry
; /* 048 */
287 PVOID VdmTrapcHandler
; /* 04C */
288 LIST_ENTRY ThreadListHead
; /* 050 */
289 KSPIN_LOCK ProcessLock
; /* 058 */
290 KAFFINITY Affinity
; /* 05C */
295 ULONG AutoAlignment
:1; /* 060.0 */
296 ULONG DisableBoost
:1; /* 060.1 */
297 ULONG DisableQuantum
:1; /* 060.2 */
298 ULONG ReservedFlags
:29; /* 060.3 */
300 ULONG ProcessFlags
; /* 060 */
302 CHAR BasePriority
; /* 064 */
303 CHAR QuantumReset
; /* 065 */
304 UCHAR State
; /* 066 */
305 UCHAR ThreadSeed
; /* 067 */
306 UCHAR PowerState
; /* 068 */
307 UCHAR IdealNode
; /* 069 */
308 UCHAR Visited
; /* 06A */
309 KEXECUTE_OPTIONS Flags
; /* 06B */
310 ULONG StackCount
; /* 06C */
311 LIST_ENTRY ProcessListEntry
; /* 070 */
314 typedef enum _KTHREAD_STATE
324 } KTHREAD_STATE
, *PKTHREAD_STATE
;