- Fix up some stuff in Kernel Gates support.
[reactos.git] / reactos / include / ndk / ketypes.h
1 /*++ NDK Version: 0098
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 lpctypes.h
8
9 Abstract:
10
11 Type definitions for the Loader.
12
13 Author:
14
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16
17 --*/
18
19 #ifndef _KETYPES_H
20 #define _KETYPES_H
21
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #ifndef NTOS_MODE_USER
27 #include <haltypes.h>
28 #include <potypes.h>
29 #include <ifssupp.h>
30 #endif
31
32 //
33 // Context Record Flags
34 //
35 #define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
36
37 //
38 // Maximum System Descriptor Table Entries
39 //
40 #define SSDT_MAX_ENTRIES 2
41
42 //
43 // Object Type Mask for Kernel Dispatcher Objects
44 //
45 #define KOBJECT_TYPE_MASK 0x7F
46
47 //
48 // Dispatcher Priority increments
49 //
50 #define THREAD_ALERT_INCREMENT 2
51
52 //
53 // User Shared Data in Kernel-Mode
54 //
55 #define KI_USER_SHARED_DATA 0xffdf0000
56
57 //
58 // Physical memory offset of KUSER_SHARED_DATA
59 //
60 #define KI_USER_SHARED_DATA_PHYSICAL 0x41000
61
62 //
63 // Kernel Feature Bits
64 //
65 #define KF_RDTSC 0x00000002
66
67 //
68 // KPCR Access for non-IA64 builds
69 //
70 #define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
71 #define PCR ((volatile KPCR * const)K0IPCR)
72 #define KeGetPcr() PCR
73
74 //
75 // Number of dispatch codes supported by KINTERRUPT
76 //
77 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
78 #define KINTERRUPT_DISPATCH_CODES 135
79 #else
80 #define KINTERRUPT_DISPATCH_CODES 106
81 #endif
82
83 #ifdef NTOS_MODE_USER
84
85 //
86 // KPROCESSOR_MODE Type
87 //
88 typedef CCHAR KPROCESSOR_MODE;
89
90 //
91 // Dereferencable pointer to KUSER_SHARED_DATA in User-Mode
92 //
93 #define SharedUserData ((KUSER_SHARED_DATA *CONST)USER_SHARED_DATA)
94
95 //
96 // Maximum WOW64 Entries in KUSER_SHARED_DATA
97 //
98 #define MAX_WOW64_SHARED_ENTRIES 16
99
100 //
101 // Maximum Processor Features supported in KUSER_SHARED_DATA
102 //
103 #define PROCESSOR_FEATURE_MAX 64
104
105 //
106 // Event Types
107 //
108 typedef enum _EVENT_TYPE
109 {
110 NotificationEvent,
111 SynchronizationEvent
112 } EVENT_TYPE;
113
114 //
115 // Timer Types
116 //
117 typedef enum _TIMER_TYPE
118 {
119 NotificationTimer,
120 SynchronizationTimer
121 } TIMER_TYPE;
122
123 //
124 // Wait Types
125 //
126 typedef enum _WAIT_TYPE
127 {
128 WaitAll,
129 WaitAny
130 } WAIT_TYPE;
131
132 //
133 // Processor Execution Modes
134 //
135 typedef enum _MODE
136 {
137 KernelMode,
138 UserMode,
139 MaximumMode
140 } MODE;
141
142 //
143 // Wait Reasons
144 //
145 typedef enum _KWAIT_REASON
146 {
147 Executive,
148 FreePage,
149 PageIn,
150 PoolAllocation,
151 DelayExecution,
152 Suspended,
153 UserRequest,
154 WrExecutive,
155 WrFreePage,
156 WrPageIn,
157 WrPoolAllocation,
158 WrDelayExecution,
159 WrSuspended,
160 WrUserRequest,
161 WrEventPair,
162 WrQueue,
163 WrLpcReceive,
164 WrLpcReply,
165 WrVirtualMemory,
166 WrPageOut,
167 WrRendezvous,
168 Spare2,
169 WrGuardedMutex,
170 Spare4,
171 Spare5,
172 Spare6,
173 WrKernel,
174 WrResource,
175 WrPushLock,
176 WrMutex,
177 WrQuantumEnd,
178 WrDispatchInt,
179 WrPreempted,
180 WrYieldExecution,
181 MaximumWaitReason
182 } KWAIT_REASON;
183
184 //
185 // Profiling Sources
186 //
187 typedef enum _KPROFILE_SOURCE
188 {
189 ProfileTime,
190 ProfileAlignmentFixup,
191 ProfileTotalIssues,
192 ProfilePipelineDry,
193 ProfileLoadInstructions,
194 ProfilePipelineFrozen,
195 ProfileBranchInstructions,
196 ProfileTotalNonissues,
197 ProfileDcacheMisses,
198 ProfileIcacheMisses,
199 ProfileCacheMisses,
200 ProfileBranchMispredictions,
201 ProfileStoreInstructions,
202 ProfileFpInstructions,
203 ProfileIntegerInstructions,
204 Profile2Issue,
205 Profile3Issue,
206 Profile4Issue,
207 ProfileSpecialInstructions,
208 ProfileTotalCycles,
209 ProfileIcacheIssues,
210 ProfileDcacheAccesses,
211 ProfileMemoryBarrierCycles,
212 ProfileLoadLinkedIssues,
213 ProfileMaximum
214 } KPROFILE_SOURCE;
215
216 //
217 // NT Product and Architecture Types
218 //
219 typedef enum _NT_PRODUCT_TYPE
220 {
221 NtProductWinNt = 1,
222 NtProductLanManNt,
223 NtProductServer
224 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
225
226 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
227 {
228 StandardDesign,
229 NEC98x86,
230 EndAlternatives
231 } ALTERNATIVE_ARCHITECTURE_TYPE;
232
233 #endif
234
235 //
236 // Thread States
237 //
238 typedef enum _KTHREAD_STATE
239 {
240 Initialized,
241 Ready,
242 Running,
243 Standby,
244 Terminated,
245 Waiting,
246 Transition,
247 DeferredReady,
248 #if (NTDDI_VERSION >= NTDDI_WS03)
249 GateWait,
250 #endif
251 } KTHREAD_STATE, *PKTHREAD_STATE;
252
253 //
254 // Process States
255 //
256 typedef enum _KPROCESS_STATE
257 {
258 ProcessInMemory,
259 ProcessOutOfMemory,
260 ProcessInTransition,
261 ProcessInSwap,
262 ProcessOutSwap,
263 } KPROCESS_STATE, *PKPROCESS_STATE;
264
265 //
266 // NtVdmControl Classes
267 //
268 typedef enum _VDMSERVICECLASS
269 {
270 VdmStartExecution = 0,
271 VdmQueueInterrupt = 1,
272 VdmDelayInterrupt = 2,
273 VdmInitialize = 3,
274 VdmFeatures = 4,
275 VdmSetInt21Handler = 5,
276 VdmQueryDir = 6,
277 VdmPrinterDirectIoOpen = 7,
278 VdmPrinterDirectIoClose = 8,
279 VdmPrinterInitialize = 9,
280 VdmSetLdtEntries = 10,
281 VdmSetProcessLdtInfo = 11,
282 VdmAdlibEmulation = 12,
283 VdmPMCliControl = 13,
284 VdmQueryVdmProcess = 14,
285 } VDMSERVICECLASS;
286
287 #ifdef NTOS_MODE_USER
288
289 //
290 // APC Normal Routine
291 //
292 typedef VOID
293 (NTAPI *PKNORMAL_ROUTINE)(
294 IN PVOID NormalContext,
295 IN PVOID SystemArgument1,
296 IN PVOID SystemArgument2
297 );
298
299 //
300 // Timer Routine
301 //
302 typedef VOID
303 (NTAPI *PTIMER_APC_ROUTINE)(
304 IN PVOID TimerContext,
305 IN ULONG TimerLowValue,
306 IN LONG TimerHighValue
307 );
308
309 //
310 // System Time Structure
311 //
312 typedef struct _KSYSTEM_TIME
313 {
314 ULONG LowPart;
315 LONG High1Time;
316 LONG High2Time;
317 } KSYSTEM_TIME, *PKSYSTEM_TIME;
318
319 //
320 // Shared Kernel User Data
321 //
322 typedef struct _KUSER_SHARED_DATA
323 {
324 ULONG TickCountLowDeprecated;
325 ULONG TickCountMultiplier;
326 volatile KSYSTEM_TIME InterruptTime;
327 volatile KSYSTEM_TIME SystemTime;
328 volatile KSYSTEM_TIME TimeZoneBias;
329 USHORT ImageNumberLow;
330 USHORT ImageNumberHigh;
331 WCHAR NtSystemRoot[260];
332 ULONG MaxStackTraceDepth;
333 ULONG CryptoExponent;
334 ULONG TimeZoneId;
335 ULONG LargePageMinimum;
336 ULONG Reserved2[7];
337 NT_PRODUCT_TYPE NtProductType;
338 BOOLEAN ProductTypeIsValid;
339 ULONG NtMajorVersion;
340 ULONG NtMinorVersion;
341 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
342 ULONG Reserved1;
343 ULONG Reserved3;
344 volatile ULONG TimeSlip;
345 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
346 LARGE_INTEGER SystemExpirationDate;
347 ULONG SuiteMask;
348 BOOLEAN KdDebuggerEnabled;
349 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
350 UCHAR NXSupportPolicy;
351 #endif
352 volatile ULONG ActiveConsoleId;
353 volatile ULONG DismountCount;
354 ULONG ComPlusPackage;
355 ULONG LastSystemRITEventTickCount;
356 ULONG NumberOfPhysicalPages;
357 BOOLEAN SafeBootMode;
358 ULONG TraceLogging;
359 ULONG Fill0;
360 ULONGLONG TestRetInstruction;
361 ULONG SystemCall;
362 ULONG SystemCallReturn;
363 ULONGLONG SystemCallPad[3];
364 union {
365 volatile KSYSTEM_TIME TickCount;
366 volatile ULONG64 TickCountQuad;
367 };
368 ULONG Cookie;
369 #if (NTDDI_VERSION >= NTDDI_WS03)
370 LONGLONG ConsoleSessionForegroundProcessId;
371 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
372 #endif
373 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
374 USHORT UserModeGlobalLogger[8];
375 ULONG HeapTracingPid[2];
376 ULONG CritSecTracingPid[2];
377 union
378 {
379 ULONG SharedDataFlags;
380 struct
381 {
382 ULONG DbgErrorPortPresent:1;
383 ULONG DbgElevationEnabled:1;
384 ULONG DbgVirtEnabled:1;
385 ULONG DbgInstallerDetectEnabled:1;
386 ULONG SpareBits:28;
387 };
388 };
389 ULONG ImageFileExecutionOptions;
390 KAFFINITY ActiveProcessorAffinity;
391 #endif
392 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
393
394 //
395 // VDM Structures
396 //
397 #include "pshpack1.h"
398 typedef struct _VdmVirtualIca
399 {
400 LONG ica_count[8];
401 LONG ica_int_line;
402 LONG ica_cpu_int;
403 USHORT ica_base;
404 USHORT ica_hipiri;
405 USHORT ica_mode;
406 UCHAR ica_master;
407 UCHAR ica_irr;
408 UCHAR ica_isr;
409 UCHAR ica_imr;
410 UCHAR ica_ssr;
411 } VDMVIRTUALICA, *PVDMVIRTUALICA;
412 #include "poppack.h"
413
414 typedef struct _VdmIcaUserData
415 {
416 PVOID pIcaLock;
417 PVDMVIRTUALICA pIcaMaster;
418 PVDMVIRTUALICA pIcaSlave;
419 PULONG pDelayIrq;
420 PULONG pUndelayIrq;
421 PULONG pDelayIret;
422 PULONG pIretHooked;
423 PULONG pAddrIretBopTable;
424 PHANDLE phWowIdleEvent;
425 PLARGE_INTEGER pIcaTimeout;
426 PHANDLE phMainThreadSuspended;
427 } VDMICAUSERDATA, *PVDMICAUSERDATA;
428
429 typedef struct _VDM_INITIALIZE_DATA
430 {
431 PVOID TrapcHandler;
432 PVDMICAUSERDATA IcaUserData;
433 } VDM_INITIALIZE_DATA, *PVDM_INITIALIZE_DATA;
434
435 #else
436
437 //
438 // System Thread Start Routine
439 //
440 typedef
441 VOID
442 (NTAPI *PKSYSTEM_ROUTINE)(
443 PKSTART_ROUTINE StartRoutine,
444 PVOID StartContext
445 );
446
447 //
448 // APC Environment Types
449 //
450 typedef enum _KAPC_ENVIRONMENT
451 {
452 OriginalApcEnvironment,
453 AttachedApcEnvironment,
454 CurrentApcEnvironment
455 } KAPC_ENVIRONMENT;
456
457 //
458 // CPU Cache Types
459 //
460 typedef enum _PROCESSOR_CACHE_TYPE
461 {
462 CacheUnified,
463 CacheInstruction,
464 CacheData,
465 CacheTrace,
466 } PROCESSOR_CACHE_TYPE;
467
468 //
469 // PRCB DPC Data
470 //
471 typedef struct _KDPC_DATA
472 {
473 LIST_ENTRY DpcListHead;
474 ULONG DpcLock;
475 ULONG DpcQueueDepth;
476 ULONG DpcCount;
477 } KDPC_DATA, *PKDPC_DATA;
478
479 //
480 // Per-Processor Lookaside List
481 //
482 typedef struct _PP_LOOKASIDE_LIST
483 {
484 struct _GENERAL_LOOKASIDE *P;
485 struct _GENERAL_LOOKASIDE *L;
486 } PP_LOOKASIDE_LIST, *PPP_LOOKASIDE_LIST;
487
488 //
489 // CPU Cache Descriptor
490 //
491 typedef struct _CACHE_DESCRIPTOR
492 {
493 UCHAR Level;
494 UCHAR Associativity;
495 USHORT LineSize;
496 ULONG Size;
497 PROCESSOR_CACHE_TYPE Type;
498 } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
499
500 //
501 // Architectural Types
502 //
503 #include <arch/ketypes.h>
504
505 //
506 // Kernel Memory Node
507 //
508 #include <pshpack1.h>
509 typedef struct _KNODE
510 {
511 SLIST_HEADER DeadStackList;
512 SLIST_HEADER PfnDereferenceSListHead;
513 KAFFINITY ProcessorMask;
514 ULONG Color;
515 UCHAR Seed;
516 UCHAR NodeNumber;
517 ULONG Flags;
518 ULONG MmShiftedColor;
519 ULONG FreeCount[2];
520 struct _SINGLE_LIST_ENTRY *PfnDeferredList;
521 } KNODE, *PKNODE;
522 #include <poppack.h>
523
524 //
525 // Kernel Profile Object
526 //
527 typedef struct _KPROFILE
528 {
529 CSHORT Type;
530 CSHORT Size;
531 LIST_ENTRY ProfileListEntry;
532 struct _KPROCESS *Process;
533 PVOID RangeBase;
534 PVOID RangeLimit;
535 ULONG BucketShift;
536 PVOID Buffer;
537 ULONG Segment;
538 KAFFINITY Affinity;
539 KPROFILE_SOURCE Source;
540 BOOLEAN Started;
541 } KPROFILE, *PKPROFILE;
542
543 //
544 // Kernel Interrupt Object
545 //
546 typedef struct _KINTERRUPT
547 {
548 CSHORT Type;
549 CSHORT Size;
550 LIST_ENTRY InterruptListEntry;
551 PKSERVICE_ROUTINE ServiceRoutine;
552 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
553 PKSERVICE_ROUTINE MessageServiceRoutine;
554 ULONG MessageIndex;
555 #endif
556 PVOID ServiceContext;
557 KSPIN_LOCK SpinLock;
558 ULONG TickCount;
559 PKSPIN_LOCK ActualLock;
560 PVOID DispatchAddress;
561 ULONG Vector;
562 KIRQL Irql;
563 KIRQL SynchronizeIrql;
564 BOOLEAN FloatingSave;
565 BOOLEAN Connected;
566 CHAR Number;
567 UCHAR ShareVector;
568 KINTERRUPT_MODE Mode;
569 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
570 KINTERRUPT_POLARITY Polarity;
571 #endif
572 ULONG ServiceCount;
573 ULONG DispatchCount;
574 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
575 ULONGLONG Rsvd1;
576 #endif
577 ULONG DispatchCode[KINTERRUPT_DISPATCH_CODES];
578 } KINTERRUPT, *PKINTERRUPT;
579
580 //
581 // Kernel Event Pair Object
582 //
583 typedef struct _KEVENT_PAIR
584 {
585 CSHORT Type;
586 CSHORT Size;
587 KEVENT LowEvent;
588 KEVENT HighEvent;
589 } KEVENT_PAIR, *PKEVENT_PAIR;
590
591 //
592 // Kernel No Execute Options
593 //
594 typedef struct _KEXECUTE_OPTIONS
595 {
596 UCHAR ExecuteDisable:1;
597 UCHAR ExecuteEnable:1;
598 UCHAR DisableThunkEmulation:1;
599 UCHAR Permanent:1;
600 UCHAR ExecuteDispatchEnable:1;
601 UCHAR ImageDispatchEnable:1;
602 UCHAR Spare:2;
603 } KEXECUTE_OPTIONS, *PKEXECUTE_OPTIONS;
604
605 //
606 // Kernel Object Types
607 //
608 typedef enum _KOBJECTS
609 {
610 EventNotificationObject = 0,
611 EventSynchronizationObject = 1,
612 MutantObject = 2,
613 ProcessObject = 3,
614 QueueObject = 4,
615 SemaphoreObject = 5,
616 ThreadObject = 6,
617 GateObject = 7,
618 TimerNotificationObject = 8,
619 TimerSynchronizationObject = 9,
620 Spare2Object = 10,
621 Spare3Object = 11,
622 Spare4Object = 12,
623 Spare5Object = 13,
624 Spare6Object = 14,
625 Spare7Object = 15,
626 Spare8Object = 16,
627 Spare9Object = 17,
628 ApcObject = 18,
629 DpcObject = 19,
630 DeviceQueueObject = 20,
631 EventPairObject = 21,
632 InterruptObject = 22,
633 ProfileObject = 23,
634 ThreadedDpcObject = 24,
635 MaximumKernelObject = 25
636 } KOBJECTS;
637
638 //
639 // Kernel Thread (KTHREAD)
640 //
641 #include <pshpack1.h>
642 typedef struct _KTHREAD
643 {
644 DISPATCHER_HEADER DispatcherHeader;
645 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
646 ULONGLONG CycleTime;
647 ULONG HighCycleTime;
648 #else
649 LIST_ENTRY MutantListHead;
650 #endif
651 PVOID InitialStack;
652 ULONG_PTR StackLimit;
653 PVOID KernelStack;
654 KSPIN_LOCK ThreadLock;
655 union
656 {
657 KAPC_STATE ApcState;
658 struct
659 {
660 UCHAR ApcStateFill[23];
661 UCHAR ApcQueueable;
662 };
663 };
664 UCHAR NextProcessor;
665 UCHAR DeferredProcessor;
666 UCHAR AdjustReason;
667 UCHAR AdjustIncrement;
668 KSPIN_LOCK ApcQueueLock;
669 ULONG ContextSwitches;
670 UCHAR State;
671 UCHAR NpxState;
672 UCHAR WaitIrql;
673 UCHAR WaitMode;
674 LONG WaitStatus;
675 union
676 {
677 PKWAIT_BLOCK WaitBlockList;
678 PKGATE GateObject;
679 };
680 UCHAR Alertable;
681 UCHAR WaitNext;
682 UCHAR WaitReason;
683 UCHAR Priority;
684 UCHAR EnableStackSwap;
685 UCHAR SwapBusy;
686 UCHAR Alerted[2];
687 union
688 {
689 LIST_ENTRY WaitListEntry;
690 SINGLE_LIST_ENTRY SwapListEntry;
691 };
692 PKQUEUE Queue;
693 ULONG WaitTime;
694 union
695 {
696 struct
697 {
698 USHORT KernelApcDisable;
699 USHORT SpecialApcDisable;
700 };
701 ULONG CombinedApcDisable;
702 };
703 struct _TEB *Teb;
704 union
705 {
706 KTIMER Timer;
707 UCHAR TimerFill[40];
708 };
709 union
710 {
711 struct
712 {
713 LONG AutoAlignment:1;
714 LONG DisableBoost:1;
715 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
716 LONG EtwStackTrace1ApcInserted:1;
717 LONG EtwStackTrace2ApcInserted:1;
718 LONG CycleChargePending:1;
719 LONG ReservedFlags:27;
720 #else
721 LONG ReservedFlags:30;
722 #endif
723 };
724 LONG ThreadFlags;
725 };
726 PVOID Padding;
727 union
728 {
729 KWAIT_BLOCK WaitBlock[4];
730 union
731 {
732 struct
733 {
734 UCHAR WaitBlockFill0[23];
735 UCHAR SystemAffinityActive;
736 };
737 struct
738 {
739 UCHAR WaitBlockFill1[47];
740 UCHAR PreviousMode;
741 };
742 struct
743 {
744 UCHAR WaitBlockFill2[71];
745 UCHAR ResourceIndex;
746 };
747 struct
748 {
749 UCHAR WaitBlockFill3[95];
750 UCHAR LargeStack;
751 };
752 };
753 };
754 LIST_ENTRY QueueListEntry;
755 PKTRAP_FRAME TrapFrame;
756 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
757 PVOID FirstArgument;
758 #endif
759 PVOID CallbackStack;
760 PVOID ServiceTable;
761 UCHAR ApcStateIndex;
762 UCHAR IdealProcessor;
763 UCHAR Preempted;
764 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
765 UCHAR CalloutActive;
766 #else
767 UCHAR ProcessReadyQueue;
768 #endif
769 UCHAR KernelStackResident;
770 CHAR BasePriority;
771 CHAR PriorityDecrement;
772 CHAR Saturation;
773 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
774 ULONG SystemCallNumber;
775 union
776 {
777 struct
778 {
779 ULONG Reserved0:1;
780 ULONG ReadyTransition:1;
781 ULONG ProcessReadyQueue:1;
782 ULONG Reserved2:1;
783 ULONG Reserved3:28;
784 };
785 LONG MiscFlags;
786 };
787 #endif
788 KAFFINITY UserAffinity;
789 struct _KPROCESS *Process;
790 KAFFINITY Affinity;
791 PKAPC_STATE ApcStatePointer[2];
792 union
793 {
794 KAPC_STATE SavedApcState;
795 union
796 {
797 UCHAR SavedApcStateFill[23];
798 CHAR FreezeCount;
799 };
800 };
801 CHAR SuspendCount;
802 UCHAR UserIdealProcessor;
803 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
804 union
805 {
806 struct
807 {
808 UCHAR ReservedBits0:1;
809 UCHAR SegmentsPresent:1;
810 UCHAR Reservedbits1:1;
811 };
812 UCHAR NestedStateFlags;
813 };
814 #else
815 UCHAR CalloutActive;
816 #endif
817 UCHAR Iopl;
818 PVOID Win32Thread;
819 PVOID StackBase;
820 union
821 {
822 KAPC SuspendApc;
823 struct
824 {
825 UCHAR SuspendApcFill0[1];
826 CHAR Quantum;
827 };
828 struct
829 {
830 UCHAR SuspendApcFill1[3];
831 UCHAR QuantumReset;
832 };
833 struct
834 {
835 UCHAR SuspendApcFill2[4];
836 ULONG KernelTime;
837 };
838 struct
839 {
840 UCHAR SuspendApcFill3[36];
841 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
842 PKPRCB WaitPrcb;
843 #else
844 PVOID TlsArray;
845 #endif
846 };
847 struct
848 {
849 UCHAR SuspendApcFill4[40];
850 PVOID LegoData;
851 };
852 struct
853 {
854 UCHAR SuspendApcFill5[47];
855 UCHAR PowerState;
856 };
857 };
858 ULONG UserTime;
859 union
860 {
861 KSEMAPHORE SuspendSemaphore;
862 UCHAR SuspendSemaphorefill[20];
863 };
864 ULONG SListFaultCount;
865 LIST_ENTRY ThreadListEntry;
866 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
867 LIST_ENTRY MutantListHead;
868 #endif
869 PVOID SListFaultAddress;
870 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
871 PVOID MdlForLockedteb;
872 #endif
873 } KTHREAD;
874 #include <poppack.h>
875
876 //
877 // Kernel Process (KPROCESS)
878 //
879 typedef struct _KPROCESS
880 {
881 DISPATCHER_HEADER Header;
882 LIST_ENTRY ProfileListHead;
883 PHYSICAL_ADDRESS DirectoryTableBase;
884 #if defined(_M_IX86)
885 KGDTENTRY LdtDescriptor;
886 KIDTENTRY Int21Descriptor;
887 USHORT IopmOffset;
888 UCHAR Iopl;
889 UCHAR Unused;
890 #endif
891 ULONG ActiveProcessors;
892 ULONG KernelTime;
893 ULONG UserTime;
894 LIST_ENTRY ReadyListHead;
895 SINGLE_LIST_ENTRY SwapListEntry;
896 PVOID VdmTrapcHandler;
897 LIST_ENTRY ThreadListHead;
898 KSPIN_LOCK ProcessLock;
899 KAFFINITY Affinity;
900 union
901 {
902 struct
903 {
904 ULONG AutoAlignment:1;
905 ULONG DisableBoost:1;
906 ULONG DisableQuantum:1;
907 ULONG ReservedFlags:29;
908 };
909 ULONG ProcessFlags;
910 };
911 CHAR BasePriority;
912 CHAR QuantumReset;
913 UCHAR State;
914 UCHAR ThreadSeed;
915 UCHAR PowerState;
916 UCHAR IdealNode;
917 UCHAR Visited;
918 union
919 {
920 KEXECUTE_OPTIONS Flags;
921 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
922 UCHAR ExecuteOptions;
923 #endif
924 };
925 ULONG StackCount;
926 LIST_ENTRY ProcessListEntry;
927 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
928 ULONGLONG CycleTime;
929 #endif
930 } KPROCESS, *PKPROCESS;
931
932 //
933 // System Service Table Descriptor
934 //
935 typedef struct _KSERVICE_TABLE_DESCRIPTOR
936 {
937 PULONG_PTR Base;
938 PULONG Count;
939 ULONG Limit;
940 #if defined(_IA64_)
941 LONG TableBaseGpOffset;
942 #endif
943 PUCHAR Number;
944 } KSERVICE_TABLE_DESCRIPTOR, *PKSERVICE_TABLE_DESCRIPTOR;
945
946 //
947 // Exported Loader Parameter Block
948 //
949 #ifndef _REACTOS_
950 extern struct _LOADER_PARAMETER_BLOCK NTSYSAPI *KeLoaderBlock;
951 #else
952 extern struct _ROS_LOADER_PARAMETER_BLOCK NTSYSAPI KeLoaderBlock;
953 #endif
954
955 //
956 // Exported Hardware Data
957 //
958 extern KAFFINITY NTSYSAPI KeActiveProcessors;
959 extern CHAR NTSYSAPI KeNumberProcessors;
960 extern ULONG NTSYSAPI KiDmaIoCoherency;
961 extern ULONG NTSYSAPI KeMaximumIncrement;
962 extern ULONG NTSYSAPI KeMinimumIncrement;
963 extern ULONG NTSYSAPI KeDcacheFlushCount;
964 extern ULONG NTSYSAPI KeIcacheFlushCount;
965
966 //
967 // Exported System Service Descriptor Tables
968 //
969 extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTable[SSDT_MAX_ENTRIES];
970 extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES];
971
972 #endif // !NTOS_MODE_USER
973
974 #endif // _KETYPES_H