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 two structures */
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
;
77 typedef struct _KQUEUE
79 DISPATCHER_HEADER Header
;
80 LIST_ENTRY EntryListHead
;
83 LIST_ENTRY ThreadListHead
;
84 } KQUEUE
, *PKQUEUE
, *RESTRICTED_POINTER PRKQUEUE
;
89 SLIST_HEADER DeadStackList
;
90 SLIST_HEADER PfnDereferenceSListHead
;
98 struct _SINGLE_LIST_ENTRY
*PfnDeferredList
;
101 typedef struct _KPROFILE
105 LIST_ENTRY ListEntry
;
110 KPROFILE_SOURCE Source
;
113 struct _KPROCESS
*Process
;
114 } KPROFILE
, *PKPROFILE
;
116 typedef struct _KINTERRUPT
120 LIST_ENTRY InterruptListEntry
;
121 PKSERVICE_ROUTINE ServiceRoutine
;
122 PVOID ServiceContext
;
125 PKSPIN_LOCK ActualLock
;
126 PVOID DispatchAddress
;
129 KIRQL SynchronizeIrql
;
130 BOOLEAN FloatingSave
;
134 KINTERRUPT_MODE Mode
;
137 ULONG DispatchCode
[106];
138 } KINTERRUPT
, *PKINTERRUPT
;
140 typedef struct _KEVENT_PAIR
146 } KEVENT_PAIR
, *PKEVENT_PAIR
;
148 typedef struct _KEXECUTE_OPTIONS
150 UCHAR ExecuteDisable
:1;
151 UCHAR ExecuteEnable
:1;
152 UCHAR DisableThunkEmulation
:1;
154 UCHAR ExecuteDispatchEnable
:1;
155 UCHAR ImageDispatchEnable
:1;
157 } KEXECUTE_OPTIONS
, *PKEXECUTE_OPTIONS
;
159 typedef enum _KOBJECTS
161 EventNotificationObject
= 0,
162 EventSynchronizationObject
= 1,
169 TimerNotificationObject
= 8,
170 TimerSynchronizationObject
= 9,
181 DeviceQueueObject
= 20,
182 EventPairObject
= 21,
183 InterruptObject
= 22,
185 ThreadedDpcObject
= 24,
186 MaximumKernelObject
= 25
189 #include <pshpack1.h>
191 typedef struct _KTHREAD
193 DISPATCHER_HEADER DispatcherHeader
; /* 00 */
194 LIST_ENTRY MutantListHead
; /* 10 */
195 PVOID InitialStack
; /* 18 */
196 ULONG_PTR StackLimit
; /* 1C */
197 struct _TEB
*Teb
; /* 20 */
198 PVOID TlsArray
; /* 24 */
199 PVOID KernelStack
; /* 28 */
200 UCHAR DebugActive
; /* 2C */
201 UCHAR State
; /* 2D */
202 BOOLEAN Alerted
[2]; /* 2E */
204 UCHAR NpxState
; /* 31 */
205 CHAR Saturation
; /* 32 */
206 CHAR Priority
; /* 33 */
207 KAPC_STATE ApcState
; /* 34 */
208 ULONG ContextSwitches
; /* 4C */
209 LONG WaitStatus
; /* 50 */
210 KIRQL WaitIrql
; /* 54 */
211 CHAR WaitMode
; /* 55 */
212 UCHAR WaitNext
; /* 56 */
213 UCHAR WaitReason
; /* 57 */
216 PKWAIT_BLOCK WaitBlockList
; /* 58 */
217 PKGATE GateObject
; /* 58 */
219 LIST_ENTRY WaitListEntry
; /* 5C */
220 ULONG WaitTime
; /* 64 */
221 CHAR BasePriority
; /* 68 */
222 UCHAR DecrementCount
; /* 69 */
223 UCHAR PriorityDecrement
; /* 6A */
224 CHAR Quantum
; /* 6B */
225 KWAIT_BLOCK WaitBlock
[4]; /* 6C */
226 PVOID LegoData
; /* CC */
231 USHORT KernelApcDisable
;
232 USHORT SpecialApcDisable
;
234 ULONG CombinedApcDisable
; /* D0 */
236 KAFFINITY UserAffinity
; /* D4 */
237 UCHAR SystemAffinityActive
;/* D8 */
238 UCHAR PowerState
; /* D9 */
239 UCHAR NpxIrql
; /* DA */
240 UCHAR Pad
[1]; /* DB */
241 PVOID ServiceTable
; /* DC */
242 struct _KQUEUE
*Queue
; /* E0 */
243 KSPIN_LOCK ApcQueueLock
; /* E4 */
244 KTIMER Timer
; /* E8 */
245 LIST_ENTRY QueueListEntry
; /* 110 */
246 KAFFINITY Affinity
; /* 118 */
247 UCHAR Preempted
; /* 11C */
248 UCHAR ProcessReadyQueue
; /* 11D */
249 UCHAR KernelStackResident
; /* 11E */
250 UCHAR NextProcessor
; /* 11F */
251 PVOID CallbackStack
; /* 120 */
252 struct _W32THREAD
*Win32Thread
; /* 124 */
253 struct _KTRAP_FRAME
*TrapFrame
; /* 128 */
254 PKAPC_STATE ApcStatePointer
[2]; /* 12C */
255 UCHAR EnableStackSwap
; /* 134 */
256 UCHAR LargeStack
; /* 135 */
257 UCHAR ResourceIndex
; /* 136 */
258 UCHAR PreviousMode
; /* 137 */
259 ULONG KernelTime
; /* 138 */
260 ULONG UserTime
; /* 13C */
261 KAPC_STATE SavedApcState
; /* 140 */
262 UCHAR Alertable
; /* 158 */
263 UCHAR ApcStateIndex
; /* 159 */
264 UCHAR ApcQueueable
; /* 15A */
265 UCHAR AutoAlignment
; /* 15B */
266 PVOID StackBase
; /* 15C */
267 KAPC SuspendApc
; /* 160 */
268 KSEMAPHORE SuspendSemaphore
; /* 190 */
269 LIST_ENTRY ThreadListEntry
; /* 1A4 */
270 CHAR FreezeCount
; /* 1AC */
271 UCHAR SuspendCount
; /* 1AD */
272 UCHAR IdealProcessor
; /* 1AE */
273 UCHAR DisableBoost
; /* 1AF */
274 UCHAR QuantumReset
; /* 1B0 */
279 typedef struct _KPROCESS
281 DISPATCHER_HEADER Header
; /* 000 */
282 LIST_ENTRY ProfileListHead
; /* 010 */
283 PHYSICAL_ADDRESS DirectoryTableBase
; /* 018 */
285 KGDTENTRY LdtDescriptor
; /* 020 */
286 KIDTENTRY Int21Descriptor
; /* 028 */
287 USHORT IopmOffset
; /* 030 */
288 UCHAR Iopl
; /* 032 */
289 UCHAR Unused
; /* 033 */
291 ULONG ActiveProcessors
; /* 034 */
292 ULONG KernelTime
; /* 038 */
293 ULONG UserTime
; /* 03C */
294 LIST_ENTRY ReadyListHead
; /* 040 */
295 LIST_ENTRY SwapListEntry
; /* 048 */
296 PVOID VdmTrapcHandler
; /* 04C */
297 LIST_ENTRY ThreadListHead
; /* 050 */
298 KSPIN_LOCK ProcessLock
; /* 058 */
299 KAFFINITY Affinity
; /* 05C */
304 ULONG AutoAlignment
:1; /* 060.0 */
305 ULONG DisableBoost
:1; /* 060.1 */
306 ULONG DisableQuantum
:1; /* 060.2 */
307 ULONG ReservedFlags
:29; /* 060.3 */
309 ULONG ProcessFlags
; /* 060 */
311 CHAR BasePriority
; /* 064 */
312 CHAR QuantumReset
; /* 065 */
313 UCHAR State
; /* 066 */
314 UCHAR ThreadSeed
; /* 067 */
315 UCHAR PowerState
; /* 068 */
316 UCHAR IdealNode
; /* 069 */
317 UCHAR Visited
; /* 06A */
318 KEXECUTE_OPTIONS Flags
; /* 06B */
319 ULONG StackCount
; /* 06C */
320 LIST_ENTRY ProcessListEntry
; /* 070 */
323 typedef enum _KTHREAD_STATE
333 } KTHREAD_STATE
, *PKTHREAD_STATE
;