Add many more structures to NDK which were incorrectly in the w32api IFS
[reactos.git] / reactos / include / ndk / ketypes.h
1 /*
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)
6 * UPDATE HISTORY:
7 * Created 06/10/04
8 */
9 #ifndef _KETYPES_H
10 #define _KETYPES_H
11
12 /* DEPENDENCIES **************************************************************/
13 #include "haltypes.h"
14 #include "potypes.h"
15 #include "mmtypes.h"
16 #include <arc/arc.h>
17
18 /* CONSTANTS *****************************************************************/
19 #define SSDT_MAX_ENTRIES 4
20 #define PROCESSOR_FEATURE_MAX 64
21
22 #define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
23
24 #define THREAD_WAIT_OBJECTS 4
25
26 /* EXPORTED DATA *************************************************************/
27 extern CHAR NTOSAPI KeNumberProcessors;
28 extern LOADER_PARAMETER_BLOCK NTOSAPI KeLoaderBlock;
29 extern ULONG NTOSAPI KeDcacheFlushCount;
30 extern ULONG NTOSAPI KeIcacheFlushCount;
31 extern KAFFINITY NTOSAPI KeActiveProcessors;
32 extern ULONG NTOSAPI KiDmaIoCoherency; /* RISC Architectures only */
33 extern ULONG NTOSAPI KeMaximumIncrement;
34 extern ULONG NTOSAPI KeMinimumIncrement;
35 extern ULONG NTOSAPI NtBuildNumber;
36 extern SSDT_ENTRY NTOSAPI KeServiceDescriptorTable[SSDT_MAX_ENTRIES];
37 extern SSDT_ENTRY NTOSAPI KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES];
38
39 /* ENUMERATIONS **************************************************************/
40
41 /* TYPES *********************************************************************/
42
43 typedef struct _CONFIGURATION_COMPONENT_DATA
44 {
45 struct _CONFIGURATION_COMPONENT_DATA *Parent;
46 struct _CONFIGURATION_COMPONENT_DATA *Child;
47 struct _CONFIGURATION_COMPONENT_DATA *Sibling;
48 CONFIGURATION_COMPONENT Component;
49 } CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
50
51 typedef enum _KAPC_ENVIRONMENT
52 {
53 OriginalApcEnvironment,
54 AttachedApcEnvironment,
55 CurrentApcEnvironment
56 } KAPC_ENVIRONMENT;
57
58 typedef struct _KDPC_DATA
59 {
60 LIST_ENTRY DpcListHead;
61 ULONG DpcLock;
62 ULONG DpcQueueDepth;
63 ULONG DpcCount;
64 } KDPC_DATA, *PKDPC_DATA;
65
66 /* We don't want to force NTIFS usage only for a single structure */
67 #ifndef _NTIFS_
68 typedef struct _KAPC_STATE
69 {
70 LIST_ENTRY ApcListHead[2];
71 PKPROCESS Process;
72 BOOLEAN KernelApcInProgress;
73 BOOLEAN KernelApcPending;
74 BOOLEAN UserApcPending;
75 } KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE;
76 #endif
77
78 /* FIXME: Most of these should go to i386 directory */
79 typedef struct _FNSAVE_FORMAT
80 {
81 ULONG ControlWord;
82 ULONG StatusWord;
83 ULONG TagWord;
84 ULONG ErrorOffset;
85 ULONG ErrorSelector;
86 ULONG DataOffset;
87 ULONG DataSelector;
88 UCHAR RegisterArea[80];
89 } FNSAVE_FORMAT, *PFNSAVE_FORMAT;
90
91 typedef struct _FXSAVE_FORMAT
92 {
93 USHORT ControlWord;
94 USHORT StatusWord;
95 USHORT TagWord;
96 USHORT ErrorOpcode;
97 ULONG ErrorOffset;
98 ULONG ErrorSelector;
99 ULONG DataOffset;
100 ULONG DataSelector;
101 ULONG MXCsr;
102 ULONG MXCsrMask;
103 UCHAR RegisterArea[128];
104 UCHAR Reserved3[128];
105 UCHAR Reserved4[224];
106 UCHAR Align16Byte[8];
107 } FXSAVE_FORMAT, *PFXSAVE_FORMAT;
108
109 typedef struct _FX_SAVE_AREA
110 {
111 union
112 {
113 FNSAVE_FORMAT FnArea;
114 FXSAVE_FORMAT FxArea;
115 } U;
116 ULONG NpxSavedCpu;
117 ULONG Cr0NpxState;
118 } FX_SAVE_AREA, *PFX_SAVE_AREA;
119
120 typedef struct _KTRAP_FRAME
121 {
122 PVOID DebugEbp;
123 PVOID DebugEip;
124 PVOID DebugArgMark;
125 PVOID DebugPointer;
126 PVOID TempCs;
127 PVOID TempEip;
128 ULONG Dr0;
129 ULONG Dr1;
130 ULONG Dr2;
131 ULONG Dr3;
132 ULONG Dr6;
133 ULONG Dr7;
134 USHORT Gs;
135 USHORT Reserved1;
136 USHORT Es;
137 USHORT Reserved2;
138 USHORT Ds;
139 USHORT Reserved3;
140 ULONG Edx;
141 ULONG Ecx;
142 ULONG Eax;
143 ULONG PreviousMode;
144 PVOID ExceptionList;
145 USHORT Fs;
146 USHORT Reserved4;
147 ULONG Edi;
148 ULONG Esi;
149 ULONG Ebx;
150 ULONG Ebp;
151 ULONG ErrorCode;
152 ULONG Eip;
153 ULONG Cs;
154 ULONG Eflags;
155 ULONG Esp;
156 USHORT Ss;
157 USHORT Reserved5;
158 USHORT V86_Es;
159 USHORT Reserved6;
160 USHORT V86_Ds;
161 USHORT Reserved7;
162 USHORT V86_Fs;
163 USHORT Reserved8;
164 USHORT V86_Gs;
165 USHORT Reserved9;
166 } KTRAP_FRAME, *PKTRAP_FRAME;
167
168 /* FIXME: Win32k uses windows.h! */
169 #ifndef __WIN32K__
170 typedef struct _LDT_ENTRY {
171 WORD LimitLow;
172 WORD BaseLow;
173 union {
174 struct {
175 BYTE BaseMid;
176 BYTE Flags1;
177 BYTE Flags2;
178 BYTE BaseHi;
179 } Bytes;
180 struct {
181 DWORD BaseMid : 8;
182 DWORD Type : 5;
183 DWORD Dpl : 2;
184 DWORD Pres : 1;
185 DWORD LimitHi : 4;
186 DWORD Sys : 1;
187 DWORD Reserved_0 : 1;
188 DWORD Default_Big : 1;
189 DWORD Granularity : 1;
190 DWORD BaseHi : 8;
191 } Bits;
192 } HighWord;
193 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
194 #endif
195
196 typedef struct _KGDTENTRY
197 {
198 USHORT LimitLow;
199 USHORT BaseLow;
200 union {
201 struct {
202 UCHAR BaseMid;
203 UCHAR Flags1;
204 UCHAR Flags2;
205 UCHAR BaseHi;
206 } Bytes;
207 struct {
208 ULONG BaseMid : 8;
209 ULONG Type : 5;
210 ULONG Dpl : 2;
211 ULONG Pres : 1;
212 ULONG LimitHi : 4;
213 ULONG Sys : 1;
214 ULONG Reserved_0 : 1;
215 ULONG Default_Big : 1;
216 ULONG Granularity : 1;
217 ULONG BaseHi : 8;
218 } Bits;
219 } HighWord;
220 } KGDTENTRY, *PKGDTENTRY;
221
222 typedef struct _KIDTENTRY
223 {
224 USHORT Offset;
225 USHORT Selector;
226 USHORT Access;
227 USHORT ExtendedOffset;
228 } KIDTENTRY, *PKIDTENTRY;
229
230 typedef struct _HARDWARE_PTE_X86
231 {
232 ULONG Valid : 1;
233 ULONG Write : 1;
234 ULONG Owner : 1;
235 ULONG WriteThrough : 1;
236 ULONG CacheDisable : 1;
237 ULONG Accessed : 1;
238 ULONG Dirty : 1;
239 ULONG LargePage : 1;
240 ULONG Global : 1;
241 ULONG CopyOnWrite : 1;
242 ULONG Prototype : 1;
243 ULONG reserved : 1;
244 ULONG PageFrameNumber : 20;
245 } HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
246
247 #pragma pack(push,4)
248
249 /* Fixme: Use correct types? */
250 typedef struct _KPROCESSOR_STATE
251 {
252 PCONTEXT ContextFrame;
253 PVOID SpecialRegisters;
254 } KPROCESSOR_STATE;
255
256 /* Processor Control Block */
257 typedef struct _KPRCB
258 {
259 USHORT MinorVersion;
260 USHORT MajorVersion;
261 struct _KTHREAD *CurrentThread;
262 struct _KTHREAD *NextThread;
263 struct _KTHREAD *IdleThread;
264 UCHAR Number;
265 UCHAR Reserved;
266 USHORT BuildType;
267 ULONG SetMember;
268 UCHAR CpuType;
269 UCHAR CpuID;
270 USHORT CpuStep;
271 KPROCESSOR_STATE ProcessorState;
272 ULONG KernelReserved[16];
273 ULONG HalReserved[16];
274 UCHAR PrcbPad0[92];
275 PVOID LockQueue[33]; // Used for Queued Spinlocks
276 struct _KTHREAD *NpxThread;
277 ULONG InterruptCount;
278 ULONG KernelTime;
279 ULONG UserTime;
280 ULONG DpcTime;
281 ULONG DebugDpcTime;
282 ULONG InterruptTime;
283 ULONG AdjustDpcThreshold;
284 ULONG PageColor;
285 UCHAR SkipTick;
286 UCHAR DebuggerSavedIRQL;
287 UCHAR Spare1[6];
288 struct _KNODE *ParentNode;
289 ULONG MultiThreadProcessorSet;
290 struct _KPRCB *MultiThreadSetMaster;
291 ULONG ThreadStartCount[2];
292 ULONG CcFastReadNoWait;
293 ULONG CcFastReadWait;
294 ULONG CcFastReadNotPossible;
295 ULONG CcCopyReadNoWait;
296 ULONG CcCopyReadWait;
297 ULONG CcCopyReadNoWaitMiss;
298 ULONG KeAlignmentFixupCount;
299 ULONG KeContextSwitches;
300 ULONG KeDcacheFlushCount;
301 ULONG KeExceptionDispatchCount;
302 ULONG KeFirstLevelTbFills;
303 ULONG KeFloatingEmulationCount;
304 ULONG KeIcacheFlushCount;
305 ULONG KeSecondLevelTbFills;
306 ULONG KeSystemCalls;
307 ULONG IoReadOperationCount;
308 ULONG IoWriteOperationCount;
309 ULONG IoOtherOperationCount;
310 LARGE_INTEGER IoReadTransferCount;
311 LARGE_INTEGER IoWriteTransferCount;
312 LARGE_INTEGER IoOtherTransferCount;
313 ULONG SpareCounter1[8];
314 PP_LOOKASIDE_LIST PPLookasideList[16];
315 PP_LOOKASIDE_LIST PPNPagedLookasideList[32];
316 PP_LOOKASIDE_LIST PPPagedLookasideList[32];
317 ULONG PacketBarrier;
318 ULONG ReverseStall;
319 PVOID IpiFrame;
320 UCHAR PrcbPad2[52];
321 PVOID CurrentPacket[3];
322 ULONG TargetSet;
323 ULONG_PTR WorkerRoutine;
324 ULONG IpiFrozen;
325 UCHAR PrcbPad3[40];
326 ULONG RequestSummary;
327 struct _KPRCB *SignalDone;
328 UCHAR PrcbPad4[56];
329 struct _KDPC_DATA DpcData[2];
330 PVOID DpcStack;
331 ULONG MaximumDpcQueueDepth;
332 ULONG DpcRequestRate;
333 ULONG MinimumDpcRate;
334 UCHAR DpcInterruptRequested;
335 UCHAR DpcThreadRequested;
336 UCHAR DpcRoutineActive;
337 UCHAR DpcThreadActive;
338 ULONG PrcbLock;
339 ULONG DpcLastCount;
340 ULONG TimerHand;
341 ULONG TimerRequest;
342 PVOID DpcThread;
343 struct _KEVENT *DpcEvent;
344 UCHAR ThreadDpcEnable;
345 BOOLEAN QuantumEnd;
346 UCHAR PrcbPad50;
347 UCHAR IdleSchedule;
348 ULONG DpcSetEventRequest;
349 UCHAR PrcbPad5[18];
350 LONG TickOffset;
351 struct _KDPC* CallDpc;
352 ULONG PrcbPad7[8];
353 LIST_ENTRY WaitListHead;
354 ULONG ReadySummary;
355 ULONG SelectNextLast;
356 LIST_ENTRY DispatcherReadyListHead[32];
357 SINGLE_LIST_ENTRY DeferredReadyListHead;
358 ULONG PrcbPad72[11];
359 PVOID ChainedInterruptList;
360 LONG LookasideIrpFloat;
361 LONG MmPageFaultCount;
362 LONG MmCopyOnWriteCount;
363 LONG MmTransitionCount;
364 LONG MmCacheTransitionCount;
365 LONG MmDemandZeroCount;
366 LONG MmPageReadCount;
367 LONG MmPageReadIoCount;
368 LONG MmCacheReadCount;
369 LONG MmCacheIoCount;
370 LONG MmDirtyPagesWriteCount;
371 LONG MmDirtyWriteIoCount;
372 LONG MmMappedPagesWriteCount;
373 LONG MmMappedWriteIoCount;
374 ULONG SpareFields0[1];
375 CHAR VendorString[13];
376 UCHAR InitialApicId;
377 UCHAR LogicalProcessorsPerPhysicalProcessor;
378 ULONG MHz;
379 ULONG FeatureBits;
380 LARGE_INTEGER UpdateSignature;
381 LARGE_INTEGER IsrTime;
382 LARGE_INTEGER SpareField1;
383 FX_SAVE_AREA NpxSaveArea;
384 PROCESSOR_POWER_STATE PowerState;
385 } KPRCB, *PKPRCB;
386
387 /*
388 * This is the complete, internal KPCR structure
389 */
390 typedef struct _KIPCR {
391 KPCR_TIB Tib; /* 00 */
392 struct _KPCR *Self; /* 1C */
393 struct _KPRCB *Prcb; /* 20 */
394 KIRQL Irql; /* 24 */
395 ULONG IRR; /* 28 */
396 ULONG IrrActive; /* 2C */
397 ULONG IDR; /* 30 */
398 PVOID KdVersionBlock; /* 34 */
399 PUSHORT IDT; /* 38 */
400 PUSHORT GDT; /* 3C */
401 struct _KTSS *TSS; /* 40 */
402 USHORT MajorVersion; /* 44 */
403 USHORT MinorVersion; /* 46 */
404 KAFFINITY SetMember; /* 48 */
405 ULONG StallScaleFactor; /* 4C */
406 UCHAR SparedUnused; /* 50 */
407 UCHAR Number; /* 51 */
408 UCHAR Reserved; /* 52 */
409 UCHAR L2CacheAssociativity; /* 53 */
410 ULONG VdmAlert; /* 54 */
411 ULONG KernelReserved[14]; /* 58 */
412 ULONG L2CacheSize; /* 90 */
413 ULONG HalReserved[16]; /* 94 */
414 ULONG InterruptMode; /* D4 */
415 UCHAR KernelReserved2[0x48]; /* D8 */
416 KPRCB PrcbData; /* 120 */
417 } KIPCR, *PKIPCR;
418
419 #pragma pack(pop)
420
421 #include <pshpack1.h>
422
423 typedef struct _KTSSNOIOPM
424 {
425 USHORT PreviousTask;
426 USHORT Reserved1;
427 ULONG Esp0;
428 USHORT Ss0;
429 USHORT Reserved2;
430 ULONG Esp1;
431 USHORT Ss1;
432 USHORT Reserved3;
433 ULONG Esp2;
434 USHORT Ss2;
435 USHORT Reserved4;
436 ULONG Cr3;
437 ULONG Eip;
438 ULONG Eflags;
439 ULONG Eax;
440 ULONG Ecx;
441 ULONG Edx;
442 ULONG Ebx;
443 ULONG Esp;
444 ULONG Ebp;
445 ULONG Esi;
446 ULONG Edi;
447 USHORT Es;
448 USHORT Reserved5;
449 USHORT Cs;
450 USHORT Reserved6;
451 USHORT Ss;
452 USHORT Reserved7;
453 USHORT Ds;
454 USHORT Reserved8;
455 USHORT Fs;
456 USHORT Reserved9;
457 USHORT Gs;
458 USHORT Reserved10;
459 USHORT Ldt;
460 USHORT Reserved11;
461 USHORT Trap;
462 USHORT IoMapBase;
463 /* no interrupt redirection map */
464 UCHAR IoBitmap[1];
465 } KTSSNOIOPM;
466
467 typedef struct _KTSS
468 {
469 USHORT PreviousTask;
470 USHORT Reserved1;
471 ULONG Esp0;
472 USHORT Ss0;
473 USHORT Reserved2;
474 ULONG Esp1;
475 USHORT Ss1;
476 USHORT Reserved3;
477 ULONG Esp2;
478 USHORT Ss2;
479 USHORT Reserved4;
480 ULONG Cr3;
481 ULONG Eip;
482 ULONG Eflags;
483 ULONG Eax;
484 ULONG Ecx;
485 ULONG Edx;
486 ULONG Ebx;
487 ULONG Esp;
488 ULONG Ebp;
489 ULONG Esi;
490 ULONG Edi;
491 USHORT Es;
492 USHORT Reserved5;
493 USHORT Cs;
494 USHORT Reserved6;
495 USHORT Ss;
496 USHORT Reserved7;
497 USHORT Ds;
498 USHORT Reserved8;
499 USHORT Fs;
500 USHORT Reserved9;
501 USHORT Gs;
502 USHORT Reserved10;
503 USHORT Ldt;
504 USHORT Reserved11;
505 USHORT Trap;
506 USHORT IoMapBase;
507 /* no interrupt redirection map */
508 UCHAR IoBitmap[8193];
509 } KTSS;
510
511 #include <poppack.h>
512
513 /* i386 Doesn't have Exception Frames */
514 typedef struct _KEXCEPTION_FRAME {
515
516 } KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
517
518 typedef struct _KNODE
519 {
520 SLIST_HEADER DeadStackList;
521 SLIST_HEADER PfnDereferenceSListHead;
522 ULONG ProcessorMask;
523 ULONG Color;
524 UCHAR Seed;
525 UCHAR NodeNumber;
526 ULONG Flags;
527 ULONG MmShiftedColor;
528 ULONG FreeCount[2];
529 struct _SINGLE_LIST_ENTRY *PfnDeferredList;
530 } KNODE, *PKNODE;
531
532 typedef struct _KPROFILE
533 {
534 CSHORT Type;
535 CSHORT Size;
536 LIST_ENTRY ListEntry;
537 PVOID RegionStart;
538 PVOID RegionEnd;
539 ULONG BucketShift;
540 PVOID Buffer;
541 CSHORT Source;
542 ULONG Affinity;
543 BOOLEAN Active;
544 struct _KPROCESS *Process;
545 } KPROFILE, *PKPROFILE;
546
547 typedef struct _KINTERRUPT
548 {
549 CSHORT Type;
550 CSHORT Size;
551 LIST_ENTRY InterruptListEntry;
552 PKSERVICE_ROUTINE ServiceRoutine;
553 PVOID ServiceContext;
554 KSPIN_LOCK SpinLock;
555 ULONG TickCount;
556 PKSPIN_LOCK ActualLock;
557 PVOID DispatchAddress;
558 ULONG Vector;
559 KIRQL Irql;
560 KIRQL SynchronizeIrql;
561 BOOLEAN FloatingSave;
562 BOOLEAN Connected;
563 CHAR Number;
564 UCHAR ShareVector;
565 KINTERRUPT_MODE Mode;
566 ULONG ServiceCount;
567 ULONG DispatchCount;
568 ULONG DispatchCode[106];
569 } KINTERRUPT, *PKINTERRUPT;
570
571 typedef struct _KEVENT_PAIR
572 {
573 CSHORT Type;
574 CSHORT Size;
575 KEVENT LowEvent;
576 KEVENT HighEvent;
577 } KEVENT_PAIR, *PKEVENT_PAIR;
578
579 typedef struct _KEXECUTE_OPTIONS
580 {
581 UCHAR ExecuteDisable:1;
582 UCHAR ExecuteEnable:1;
583 UCHAR DisableThunkEmulation:1;
584 UCHAR Permanent:1;
585 UCHAR ExecuteDispatchEnable:1;
586 UCHAR ImageDispatchEnable:1;
587 UCHAR Spare:2;
588 } KEXECUTE_OPTIONS, *PKEXECUTE_OPTIONS;
589
590 typedef enum _KOBJECTS
591 {
592 EventNotificationObject = 0,
593 EventSynchronizationObject = 1,
594 MutantObject = 2,
595 ProcessObject = 3,
596 QueueObject = 4,
597 SemaphoreObject = 5,
598 ThreadObject = 6,
599 GateObject = 7,
600 TimerNotificationObject = 8,
601 TimerSynchronizationObject = 9,
602 Spare2Object = 10,
603 Spare3Object = 11,
604 Spare4Object = 12,
605 Spare5Object = 13,
606 Spare6Object = 14,
607 Spare7Object = 15,
608 Spare8Object = 16,
609 Spare9Object = 17,
610 ApcObject = 18,
611 DpcObject = 19,
612 DeviceQueueObject = 20,
613 EventPairObject = 21,
614 InterruptObject = 22,
615 ProfileObject = 23,
616 ThreadedDpcObject = 24,
617 MaximumKernelObject = 25
618 } KOBJECTS;
619
620 #include <pshpack1.h>
621
622 typedef struct _KTHREAD
623 {
624 /* For waiting on thread exit */
625 DISPATCHER_HEADER DispatcherHeader; /* 00 */
626
627 /* List of mutants owned by the thread */
628 LIST_ENTRY MutantListHead; /* 10 */
629 PVOID InitialStack; /* 18 */
630 ULONG_PTR StackLimit; /* 1C */
631
632 /* Pointer to the thread's environment block in user memory */
633 struct _TEB *Teb; /* 20 */
634
635 /* Pointer to the thread's TLS array */
636 PVOID TlsArray; /* 24 */
637 PVOID KernelStack; /* 28 */
638 UCHAR DebugActive; /* 2C */
639
640 /* Thread state (one of THREAD_STATE_xxx constants below) */
641 UCHAR State; /* 2D */
642 BOOLEAN Alerted[2]; /* 2E */
643 UCHAR Iopl; /* 30 */
644 UCHAR NpxState; /* 31 */
645 CHAR Saturation; /* 32 */
646 CHAR Priority; /* 33 */
647 KAPC_STATE ApcState; /* 34 */
648 ULONG ContextSwitches; /* 4C */
649 LONG WaitStatus; /* 50 */
650 KIRQL WaitIrql; /* 54 */
651 CHAR WaitMode; /* 55 */
652 UCHAR WaitNext; /* 56 */
653 UCHAR WaitReason; /* 57 */
654 union { /* 58 */
655 PKWAIT_BLOCK WaitBlockList; /* 58 */
656 PKGATE GateObject; /* 58 */
657 }; /* 58 */
658 LIST_ENTRY WaitListEntry; /* 5C */
659 ULONG WaitTime; /* 64 */
660 CHAR BasePriority; /* 68 */
661 UCHAR DecrementCount; /* 69 */
662 UCHAR PriorityDecrement; /* 6A */
663 CHAR Quantum; /* 6B */
664 KWAIT_BLOCK WaitBlock[4]; /* 6C */
665 PVOID LegoData; /* CC */
666 union {
667 struct {
668 USHORT KernelApcDisable;
669 USHORT SpecialApcDisable;
670 };
671 ULONG CombinedApcDisable; /* D0 */
672 };
673 KAFFINITY UserAffinity; /* D4 */
674 UCHAR SystemAffinityActive;/* D8 */
675 UCHAR PowerState; /* D9 */
676 UCHAR NpxIrql; /* DA */
677 UCHAR Pad[1]; /* DB */
678 PVOID ServiceTable; /* DC */
679 struct _KQUEUE *Queue; /* E0 */
680 KSPIN_LOCK ApcQueueLock; /* E4 */
681 KTIMER Timer; /* E8 */
682 LIST_ENTRY QueueListEntry; /* 110 */
683 KAFFINITY Affinity; /* 118 */
684 UCHAR Preempted; /* 11C */
685 UCHAR ProcessReadyQueue; /* 11D */
686 UCHAR KernelStackResident; /* 11E */
687 UCHAR NextProcessor; /* 11F */
688 PVOID CallbackStack; /* 120 */
689 struct _W32THREAD *Win32Thread; /* 124 */
690 struct _KTRAP_FRAME *TrapFrame; /* 128 */
691 PKAPC_STATE ApcStatePointer[2]; /* 12C */
692 UCHAR EnableStackSwap; /* 134 */
693 UCHAR LargeStack; /* 135 */
694 UCHAR ResourceIndex; /* 136 */
695 UCHAR PreviousMode; /* 137 */
696 ULONG KernelTime; /* 138 */
697 ULONG UserTime; /* 13C */
698 KAPC_STATE SavedApcState; /* 140 */
699 UCHAR Alertable; /* 158 */
700 UCHAR ApcStateIndex; /* 159 */
701 UCHAR ApcQueueable; /* 15A */
702 UCHAR AutoAlignment; /* 15B */
703 PVOID StackBase; /* 15C */
704 KAPC SuspendApc; /* 160 */
705 KSEMAPHORE SuspendSemaphore; /* 190 */
706 LIST_ENTRY ThreadListEntry; /* 1A4 */
707 CHAR FreezeCount; /* 1AC */
708 UCHAR SuspendCount; /* 1AD */
709 UCHAR IdealProcessor; /* 1AE */
710 UCHAR DisableBoost; /* 1AF */
711 UCHAR QuantumReset; /* 1B0 */
712 } KTHREAD;
713
714 #include <poppack.h>
715
716 /*
717 * NAME: KPROCESS
718 * DESCRIPTION: Internal Kernel Process Structure.
719 * PORTABILITY: Architecture Dependent.
720 * KERNEL VERSION: 5.2
721 * DOCUMENTATION: http://reactos.com/wiki/index.php/KPROCESS
722 */
723 typedef struct _KPROCESS
724 {
725 DISPATCHER_HEADER Header; /* 000 */
726 LIST_ENTRY ProfileListHead; /* 010 */
727 PHYSICAL_ADDRESS DirectoryTableBase; /* 018 */
728 KGDTENTRY LdtDescriptor; /* 020 */
729 KIDTENTRY Int21Descriptor; /* 028 */
730 USHORT IopmOffset; /* 030 */
731 UCHAR Iopl; /* 032 */
732 UCHAR Unused; /* 033 */
733 ULONG ActiveProcessors; /* 034 */
734 ULONG KernelTime; /* 038 */
735 ULONG UserTime; /* 03C */
736 LIST_ENTRY ReadyListHead; /* 040 */
737 LIST_ENTRY SwapListEntry; /* 048 */
738 PVOID VdmTrapcHandler; /* 04C */
739 LIST_ENTRY ThreadListHead; /* 050 */
740 KSPIN_LOCK ProcessLock; /* 058 */
741 KAFFINITY Affinity; /* 05C */
742 union {
743 struct {
744 ULONG AutoAlignment:1; /* 060.0 */
745 ULONG DisableBoost:1; /* 060.1 */
746 ULONG DisableQuantum:1; /* 060.2 */
747 ULONG ReservedFlags:29; /* 060.3 */
748 };
749 ULONG ProcessFlags; /* 060 */
750 };
751 CHAR BasePriority; /* 064 */
752 CHAR QuantumReset; /* 065 */
753 UCHAR State; /* 066 */
754 UCHAR ThreadSeed; /* 067 */
755 UCHAR PowerState; /* 068 */
756 UCHAR IdealNode; /* 069 */
757 UCHAR Visited; /* 06A */
758 KEXECUTE_OPTIONS Flags; /* 06B */
759 ULONG StackCount; /* 06C */
760 LIST_ENTRY ProcessListEntry; /* 070 */
761 } KPROCESS;
762
763 typedef enum _KTHREAD_STATE
764 {
765 Initialized,
766 Ready,
767 Running,
768 Standby,
769 Terminated,
770 Waiting,
771 Transition,
772 DeferredReady,
773 } KTHREAD_STATE, *PKTHREAD_STATE;
774
775 #endif