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