[NDK]
[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 // A system call ID is formatted as such:
34 // .________________________________________________________________.
35 // | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
36 // |--------------|-------------------------------------------------|
37 // | TABLE NUMBER | TABLE OFFSET |
38 // \----------------------------------------------------------------/
39 //
40 // The table number is then used as an index into the service descriptor table.
41 #define TABLE_NUMBER_BITS 1
42 #define TABLE_OFFSET_BITS 12
43
44 //
45 // There are 2 tables (kernel and shadow, used by Win32K)
46 //
47 #define NUMBER_SERVICE_TABLES 2
48 #define NTOS_SERVICE_INDEX 0
49 #define WIN32K_SERVICE_INDEX 1
50
51 //
52 // NB. From assembly code, the table number must be computed as an offset into
53 // the service descriptor table.
54 //
55 // Each entry into the table is 16 bytes long on 32-bit architectures, and
56 // 32 bytes long on 64-bit architectures.
57 //
58 // Thus, Table Number 1 is offset 16 (0x10) on x86, and offset 32 (0x20) on
59 // x64.
60 //
61 #ifdef _WIN64
62 #define BITS_PER_ENTRY 5 // (1 << 5) = 32 bytes
63 #else
64 #define BITS_PER_ENTRY 4 // (1 << 4) = 16 bytes
65 #endif
66
67 //
68 // We want the table number, but leave some extra bits to we can have the offset
69 // into the descriptor table.
70 //
71 #define SERVICE_TABLE_SHIFT (12 - BITS_PER_ENTRY)
72
73 //
74 // Now the table number (as an offset) is corrupted with part of the table offset
75 // This mask will remove the extra unwanted bits, and give us the offset into the
76 // descriptor table proper.
77 //
78 #define SERVICE_TABLE_MASK (((1 << TABLE_NUMBER_BITS) - 1) << BITS_PER_ENTRY)
79
80 //
81 // To get the table offset (ie: the service call number), just keep the 12 bits
82 //
83 #define SERVICE_NUMBER_MASK ((1 << TABLE_OFFSET_BITS) - 1)
84
85 //
86 // We'll often need to check if this is a graphics call. This is done by comparing
87 // the table number offset with the known Win32K table number offset.
88 // This is usually index 1, so table number offset 0x10 (x86) or 0x20 (x64)
89 //
90 #define SERVICE_TABLE_TEST (WIN32K_SERVICE_INDEX << BITS_PER_ENTRY)
91
92 //
93 // Context Record Flags
94 //
95 #define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
96
97 //
98 // Maximum System Descriptor Table Entries
99 //
100 #define SSDT_MAX_ENTRIES 2
101
102 //
103 // Processor Architectures
104 //
105 #define PROCESSOR_ARCHITECTURE_INTEL 0
106 #define PROCESSOR_ARCHITECTURE_MIPS 1
107 #define PROCESSOR_ARCHITECTURE_ALPHA 2
108 #define PROCESSOR_ARCHITECTURE_PPC 3
109 #define PROCESSOR_ARCHITECTURE_SHX 4
110 #define PROCESSOR_ARCHITECTURE_ARM 5
111 #define PROCESSOR_ARCHITECTURE_IA64 6
112 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
113 #define PROCESSOR_ARCHITECTURE_MSIL 8
114 #define PROCESSOR_ARCHITECTURE_AMD64 9
115 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
116
117 //
118 // Object Type Mask for Kernel Dispatcher Objects
119 //
120 #define KOBJECT_TYPE_MASK 0x7F
121 #define KOBJECT_LOCK_BIT 0x80
122
123 //
124 // Dispatcher Priority increments
125 //
126 #define THREAD_ALERT_INCREMENT 2
127
128 //
129 // Physical memory offset of KUSER_SHARED_DATA
130 //
131 #define KI_USER_SHARED_DATA_PHYSICAL 0x41000
132
133 //
134 // Quantum values and decrements
135 //
136 #define MAX_QUANTUM 0x7F
137 #define WAIT_QUANTUM_DECREMENT 1
138 #define CLOCK_QUANTUM_DECREMENT 3
139
140 //
141 // Kernel Feature Bits
142 //
143 #define KF_V86_VIS 0x00000001
144 #define KF_RDTSC 0x00000002
145 #define KF_CR4 0x00000004
146 #define KF_CMOV 0x00000008
147 #define KF_GLOBAL_PAGE 0x00000010
148 #define KF_LARGE_PAGE 0x00000020
149 #define KF_MTRR 0x00000040
150 #define KF_CMPXCHG8B 0x00000080
151 #define KF_MMX 0x00000100
152 #define KF_WORKING_PTE 0x00000200
153 #define KF_PAT 0x00000400
154 #define KF_FXSR 0x00000800
155 #define KF_FAST_SYSCALL 0x00001000
156 #define KF_XMMI 0x00002000
157 #define KF_3DNOW 0x00004000
158 #define KF_AMDK6MTRR 0x00008000
159 #define KF_XMMI64 0x00010000
160 #define KF_DTS 0x00020000
161 #define KF_NX_BIT 0x20000000
162 #define KF_NX_DISABLED 0x40000000
163 #define KF_NX_ENABLED 0x80000000
164
165 //
166 // Internal Exception Codes
167 //
168 #define KI_EXCEPTION_INTERNAL 0x10000000
169 #define KI_EXCEPTION_ACCESS_VIOLATION (KI_EXCEPTION_INTERNAL | 0x04)
170
171 #ifndef NTOS_MODE_USER
172 //
173 // Number of dispatch codes supported by KINTERRUPT
174 //
175 #ifdef _M_AMD64
176 #define DISPATCH_LENGTH 4
177 #elif (NTDDI_VERSION >= NTDDI_LONGHORN)
178 #define DISPATCH_LENGTH 135
179 #else
180 #define DISPATCH_LENGTH 106
181 #endif
182
183 #else
184
185 //
186 // KPROCESSOR_MODE Type
187 //
188 typedef CCHAR KPROCESSOR_MODE;
189
190 //
191 // Dereferencable pointer to KUSER_SHARED_DATA in User-Mode
192 //
193 #define SharedUserData ((KUSER_SHARED_DATA *)USER_SHARED_DATA)
194
195 //
196 // Maximum WOW64 Entries in KUSER_SHARED_DATA
197 //
198 #define MAX_WOW64_SHARED_ENTRIES 16
199
200 //
201 // Maximum Processor Features supported in KUSER_SHARED_DATA
202 //
203 #define PROCESSOR_FEATURE_MAX 64
204
205 //
206 // Event Types
207 //
208 typedef enum _EVENT_TYPE
209 {
210 NotificationEvent,
211 SynchronizationEvent
212 } EVENT_TYPE;
213
214 //
215 // Timer Types
216 //
217 typedef enum _TIMER_TYPE
218 {
219 NotificationTimer,
220 SynchronizationTimer
221 } TIMER_TYPE;
222
223 //
224 // Wait Types
225 //
226 typedef enum _WAIT_TYPE
227 {
228 WaitAll,
229 WaitAny
230 } WAIT_TYPE;
231
232 //
233 // Processor Execution Modes
234 //
235 typedef enum _MODE
236 {
237 KernelMode,
238 UserMode,
239 MaximumMode
240 } MODE;
241
242 //
243 // Wait Reasons
244 //
245 typedef enum _KWAIT_REASON
246 {
247 Executive,
248 FreePage,
249 PageIn,
250 PoolAllocation,
251 DelayExecution,
252 Suspended,
253 UserRequest,
254 WrExecutive,
255 WrFreePage,
256 WrPageIn,
257 WrPoolAllocation,
258 WrDelayExecution,
259 WrSuspended,
260 WrUserRequest,
261 WrEventPair,
262 WrQueue,
263 WrLpcReceive,
264 WrLpcReply,
265 WrVirtualMemory,
266 WrPageOut,
267 WrRendezvous,
268 Spare2,
269 WrGuardedMutex,
270 Spare4,
271 Spare5,
272 Spare6,
273 WrKernel,
274 WrResource,
275 WrPushLock,
276 WrMutex,
277 WrQuantumEnd,
278 WrDispatchInt,
279 WrPreempted,
280 WrYieldExecution,
281 MaximumWaitReason
282 } KWAIT_REASON;
283
284 //
285 // Profiling Sources
286 //
287 typedef enum _KPROFILE_SOURCE
288 {
289 ProfileTime,
290 ProfileAlignmentFixup,
291 ProfileTotalIssues,
292 ProfilePipelineDry,
293 ProfileLoadInstructions,
294 ProfilePipelineFrozen,
295 ProfileBranchInstructions,
296 ProfileTotalNonissues,
297 ProfileDcacheMisses,
298 ProfileIcacheMisses,
299 ProfileCacheMisses,
300 ProfileBranchMispredictions,
301 ProfileStoreInstructions,
302 ProfileFpInstructions,
303 ProfileIntegerInstructions,
304 Profile2Issue,
305 Profile3Issue,
306 Profile4Issue,
307 ProfileSpecialInstructions,
308 ProfileTotalCycles,
309 ProfileIcacheIssues,
310 ProfileDcacheAccesses,
311 ProfileMemoryBarrierCycles,
312 ProfileLoadLinkedIssues,
313 ProfileMaximum
314 } KPROFILE_SOURCE;
315
316 //
317 // NT Product and Architecture Types
318 //
319 typedef enum _NT_PRODUCT_TYPE
320 {
321 NtProductWinNt = 1,
322 NtProductLanManNt,
323 NtProductServer
324 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
325
326 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
327 {
328 StandardDesign,
329 NEC98x86,
330 EndAlternatives
331 } ALTERNATIVE_ARCHITECTURE_TYPE;
332
333 #endif
334
335 //
336 // Thread States
337 //
338 typedef enum _KTHREAD_STATE
339 {
340 Initialized,
341 Ready,
342 Running,
343 Standby,
344 Terminated,
345 Waiting,
346 Transition,
347 DeferredReady,
348 #if (NTDDI_VERSION >= NTDDI_WS03)
349 GateWait
350 #endif
351 } KTHREAD_STATE, *PKTHREAD_STATE;
352
353 //
354 // Kernel Object Types
355 //
356 typedef enum _KOBJECTS
357 {
358 EventNotificationObject = 0,
359 EventSynchronizationObject = 1,
360 MutantObject = 2,
361 ProcessObject = 3,
362 QueueObject = 4,
363 SemaphoreObject = 5,
364 ThreadObject = 6,
365 GateObject = 7,
366 TimerNotificationObject = 8,
367 TimerSynchronizationObject = 9,
368 Spare2Object = 10,
369 Spare3Object = 11,
370 Spare4Object = 12,
371 Spare5Object = 13,
372 Spare6Object = 14,
373 Spare7Object = 15,
374 Spare8Object = 16,
375 Spare9Object = 17,
376 ApcObject = 18,
377 DpcObject = 19,
378 DeviceQueueObject = 20,
379 EventPairObject = 21,
380 InterruptObject = 22,
381 ProfileObject = 23,
382 ThreadedDpcObject = 24,
383 MaximumKernelObject = 25
384 } KOBJECTS;
385
386 //
387 // Adjust reasons
388 //
389 typedef enum _ADJUST_REASON
390 {
391 AdjustNone = 0,
392 AdjustUnwait = 1,
393 AdjustBoost = 2
394 } ADJUST_REASON;
395
396 //
397 // Continue Status
398 //
399 typedef enum _KCONTINUE_STATUS
400 {
401 ContinueError = 0,
402 ContinueSuccess,
403 ContinueProcessorReselected,
404 ContinueNextProcessor
405 } KCONTINUE_STATUS;
406
407 //
408 // Process States
409 //
410 typedef enum _KPROCESS_STATE
411 {
412 ProcessInMemory,
413 ProcessOutOfMemory,
414 ProcessInTransition,
415 ProcessInSwap,
416 ProcessOutSwap,
417 } KPROCESS_STATE, *PKPROCESS_STATE;
418
419 //
420 // NtVdmControl Classes
421 //
422 typedef enum _VDMSERVICECLASS
423 {
424 VdmStartExecution = 0,
425 VdmQueueInterrupt = 1,
426 VdmDelayInterrupt = 2,
427 VdmInitialize = 3,
428 VdmFeatures = 4,
429 VdmSetInt21Handler = 5,
430 VdmQueryDir = 6,
431 VdmPrinterDirectIoOpen = 7,
432 VdmPrinterDirectIoClose = 8,
433 VdmPrinterInitialize = 9,
434 VdmSetLdtEntries = 10,
435 VdmSetProcessLdtInfo = 11,
436 VdmAdlibEmulation = 12,
437 VdmPMCliControl = 13,
438 VdmQueryVdmProcess = 14,
439 } VDMSERVICECLASS;
440
441 #ifdef NTOS_MODE_USER
442
443 //
444 // APC Normal Routine
445 //
446 typedef VOID
447 (NTAPI *PKNORMAL_ROUTINE)(
448 _In_ PVOID NormalContext,
449 _In_ PVOID SystemArgument1,
450 _In_ PVOID SystemArgument2
451 );
452
453 //
454 // Timer Routine
455 //
456 typedef VOID
457 (NTAPI *PTIMER_APC_ROUTINE)(
458 _In_ PVOID TimerContext,
459 _In_ ULONG TimerLowValue,
460 _In_ LONG TimerHighValue
461 );
462
463 //
464 // System Time Structure
465 //
466 typedef struct _KSYSTEM_TIME
467 {
468 ULONG LowPart;
469 LONG High1Time;
470 LONG High2Time;
471 } KSYSTEM_TIME, *PKSYSTEM_TIME;
472
473 //
474 // Shared Kernel User Data
475 //
476 typedef struct _KUSER_SHARED_DATA
477 {
478 ULONG TickCountLowDeprecated;
479 ULONG TickCountMultiplier;
480 volatile KSYSTEM_TIME InterruptTime;
481 volatile KSYSTEM_TIME SystemTime;
482 volatile KSYSTEM_TIME TimeZoneBias;
483 USHORT ImageNumberLow;
484 USHORT ImageNumberHigh;
485 WCHAR NtSystemRoot[260];
486 ULONG MaxStackTraceDepth;
487 ULONG CryptoExponent;
488 ULONG TimeZoneId;
489 ULONG LargePageMinimum;
490 ULONG Reserved2[7];
491 NT_PRODUCT_TYPE NtProductType;
492 BOOLEAN ProductTypeIsValid;
493 ULONG NtMajorVersion;
494 ULONG NtMinorVersion;
495 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
496 ULONG Reserved1;
497 ULONG Reserved3;
498 volatile ULONG TimeSlip;
499 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
500 LARGE_INTEGER SystemExpirationDate;
501 ULONG SuiteMask;
502 BOOLEAN KdDebuggerEnabled;
503 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
504 UCHAR NXSupportPolicy;
505 #endif
506 volatile ULONG ActiveConsoleId;
507 volatile ULONG DismountCount;
508 ULONG ComPlusPackage;
509 ULONG LastSystemRITEventTickCount;
510 ULONG NumberOfPhysicalPages;
511 BOOLEAN SafeBootMode;
512 ULONG TraceLogging;
513 ULONG Fill0;
514 ULONGLONG TestRetInstruction;
515 ULONG SystemCall;
516 ULONG SystemCallReturn;
517 ULONGLONG SystemCallPad[3];
518 union {
519 volatile KSYSTEM_TIME TickCount;
520 volatile ULONG64 TickCountQuad;
521 };
522 ULONG Cookie;
523 #if (NTDDI_VERSION >= NTDDI_WS03)
524 LONGLONG ConsoleSessionForegroundProcessId;
525 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
526 #endif
527 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
528 USHORT UserModeGlobalLogger[8];
529 ULONG HeapTracingPid[2];
530 ULONG CritSecTracingPid[2];
531 union
532 {
533 ULONG SharedDataFlags;
534 struct
535 {
536 ULONG DbgErrorPortPresent:1;
537 ULONG DbgElevationEnabled:1;
538 ULONG DbgVirtEnabled:1;
539 ULONG DbgInstallerDetectEnabled:1;
540 ULONG SpareBits:28;
541 };
542 };
543 ULONG ImageFileExecutionOptions;
544 KAFFINITY ActiveProcessorAffinity;
545 #endif
546 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
547
548 //
549 // VDM Structures
550 //
551 #include "pshpack1.h"
552 typedef struct _VdmVirtualIca
553 {
554 LONG ica_count[8];
555 LONG ica_int_line;
556 LONG ica_cpu_int;
557 USHORT ica_base;
558 USHORT ica_hipiri;
559 USHORT ica_mode;
560 UCHAR ica_master;
561 UCHAR ica_irr;
562 UCHAR ica_isr;
563 UCHAR ica_imr;
564 UCHAR ica_ssr;
565 } VDMVIRTUALICA, *PVDMVIRTUALICA;
566 #include "poppack.h"
567
568 typedef struct _VdmIcaUserData
569 {
570 PVOID pIcaLock;
571 PVDMVIRTUALICA pIcaMaster;
572 PVDMVIRTUALICA pIcaSlave;
573 PULONG pDelayIrq;
574 PULONG pUndelayIrq;
575 PULONG pDelayIret;
576 PULONG pIretHooked;
577 PULONG pAddrIretBopTable;
578 PHANDLE phWowIdleEvent;
579 PLARGE_INTEGER pIcaTimeout;
580 PHANDLE phMainThreadSuspended;
581 } VDMICAUSERDATA, *PVDMICAUSERDATA;
582
583 typedef struct _VDM_INITIALIZE_DATA
584 {
585 PVOID TrapcHandler;
586 PVDMICAUSERDATA IcaUserData;
587 } VDM_INITIALIZE_DATA, *PVDM_INITIALIZE_DATA;
588
589 #else
590
591 //
592 // System Thread Start Routine
593 //
594 typedef
595 VOID
596 (NTAPI *PKSYSTEM_ROUTINE)(
597 PKSTART_ROUTINE StartRoutine,
598 PVOID StartContext
599 );
600
601 #ifndef _NTSYSTEM_
602 typedef VOID
603 (NTAPI *PKNORMAL_ROUTINE)(
604 IN PVOID NormalContext OPTIONAL,
605 IN PVOID SystemArgument1 OPTIONAL,
606 IN PVOID SystemArgument2 OPTIONAL);
607
608 typedef VOID
609 (NTAPI *PKRUNDOWN_ROUTINE)(
610 IN struct _KAPC *Apc);
611
612 typedef VOID
613 (NTAPI *PKKERNEL_ROUTINE)(
614 IN struct _KAPC *Apc,
615 IN OUT PKNORMAL_ROUTINE *NormalRoutine OPTIONAL,
616 IN OUT PVOID *NormalContext OPTIONAL,
617 IN OUT PVOID *SystemArgument1 OPTIONAL,
618 IN OUT PVOID *SystemArgument2 OPTIONAL);
619 #endif
620
621 //
622 // APC Environment Types
623 //
624 typedef enum _KAPC_ENVIRONMENT
625 {
626 OriginalApcEnvironment,
627 AttachedApcEnvironment,
628 CurrentApcEnvironment,
629 InsertApcEnvironment
630 } KAPC_ENVIRONMENT;
631
632 typedef struct _KTIMER_TABLE_ENTRY
633 {
634 #if (NTDDI_VERSION >= NTDDI_LONGHORN) || defined(_M_ARM) || defined(_M_AMD64)
635 KSPIN_LOCK Lock;
636 #endif
637 LIST_ENTRY Entry;
638 ULARGE_INTEGER Time;
639 } KTIMER_TABLE_ENTRY, *PKTIMER_TABLE_ENTRY;
640
641 typedef struct _KTIMER_TABLE
642 {
643 PKTIMER TimerExpiry[64];
644 KTIMER_TABLE_ENTRY TimerEntries[256];
645 } KTIMER_TABLE, *PKTIMER_TABLE;
646
647 typedef struct _KDPC_LIST
648 {
649 SINGLE_LIST_ENTRY ListHead;
650 SINGLE_LIST_ENTRY* LastEntry;
651 } KDPC_LIST, *PKDPC_LIST;
652
653 typedef struct _SYNCH_COUNTERS
654 {
655 ULONG SpinLockAcquireCount;
656 ULONG SpinLockContentionCount;
657 ULONG SpinLockSpinCount;
658 ULONG IpiSendRequestBroadcastCount;
659 ULONG IpiSendRequestRoutineCount;
660 ULONG IpiSendSoftwareInterruptCount;
661 ULONG ExInitializeResourceCount;
662 ULONG ExReInitializeResourceCount;
663 ULONG ExDeleteResourceCount;
664 ULONG ExecutiveResourceAcquiresCount;
665 ULONG ExecutiveResourceContentionsCount;
666 ULONG ExecutiveResourceReleaseExclusiveCount;
667 ULONG ExecutiveResourceReleaseSharedCount;
668 ULONG ExecutiveResourceConvertsCount;
669 ULONG ExAcqResExclusiveAttempts;
670 ULONG ExAcqResExclusiveAcquiresExclusive;
671 ULONG ExAcqResExclusiveAcquiresExclusiveRecursive;
672 ULONG ExAcqResExclusiveWaits;
673 ULONG ExAcqResExclusiveNotAcquires;
674 ULONG ExAcqResSharedAttempts;
675 ULONG ExAcqResSharedAcquiresExclusive;
676 ULONG ExAcqResSharedAcquiresShared;
677 ULONG ExAcqResSharedAcquiresSharedRecursive;
678 ULONG ExAcqResSharedWaits;
679 ULONG ExAcqResSharedNotAcquires;
680 ULONG ExAcqResSharedStarveExclusiveAttempts;
681 ULONG ExAcqResSharedStarveExclusiveAcquiresExclusive;
682 ULONG ExAcqResSharedStarveExclusiveAcquiresShared;
683 ULONG ExAcqResSharedStarveExclusiveAcquiresSharedRecursive;
684 ULONG ExAcqResSharedStarveExclusiveWaits;
685 ULONG ExAcqResSharedStarveExclusiveNotAcquires;
686 ULONG ExAcqResSharedWaitForExclusiveAttempts;
687 ULONG ExAcqResSharedWaitForExclusiveAcquiresExclusive;
688 ULONG ExAcqResSharedWaitForExclusiveAcquiresShared;
689 ULONG ExAcqResSharedWaitForExclusiveAcquiresSharedRecursive;
690 ULONG ExAcqResSharedWaitForExclusiveWaits;
691 ULONG ExAcqResSharedWaitForExclusiveNotAcquires;
692 ULONG ExSetResOwnerPointerExclusive;
693 ULONG ExSetResOwnerPointerSharedNew;
694 ULONG ExSetResOwnerPointerSharedOld;
695 ULONG ExTryToAcqExclusiveAttempts;
696 ULONG ExTryToAcqExclusiveAcquires;
697 ULONG ExBoostExclusiveOwner;
698 ULONG ExBoostSharedOwners;
699 ULONG ExEtwSynchTrackingNotificationsCount;
700 ULONG ExEtwSynchTrackingNotificationsAccountedCount;
701 } SYNCH_COUNTERS, *PSYNCH_COUNTERS;
702
703 //
704 // PRCB DPC Data
705 //
706 typedef struct _KDPC_DATA
707 {
708 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
709 KDPC_LIST DpcList;
710 #else
711 LIST_ENTRY DpcListHead;
712 #endif
713 ULONG_PTR DpcLock;
714 #if defined(_M_AMD64) || defined(_M_ARM)
715 volatile LONG DpcQueueDepth;
716 #else
717 volatile ULONG DpcQueueDepth;
718 #endif
719 ULONG DpcCount;
720 #if (NTDDI_VERSION >= NTDDI_LONGHORN) || defined(_M_ARM)
721 PKDPC ActiveDpc;
722 #endif
723 } KDPC_DATA, *PKDPC_DATA;
724
725 //
726 // Per-Processor Lookaside List
727 //
728 typedef struct _PP_LOOKASIDE_LIST
729 {
730 struct _GENERAL_LOOKASIDE *P;
731 struct _GENERAL_LOOKASIDE *L;
732 } PP_LOOKASIDE_LIST, *PPP_LOOKASIDE_LIST;
733
734 //
735 // Architectural Types
736 //
737 #include <arch/ketypes.h>
738
739 //
740 // Kernel Memory Node
741 //
742 #include <pshpack1.h>
743 typedef struct _KNODE
744 {
745 SLIST_HEADER DeadStackList;
746 SLIST_HEADER PfnDereferenceSListHead;
747 KAFFINITY ProcessorMask;
748 ULONG Color;
749 UCHAR Seed;
750 UCHAR NodeNumber;
751 ULONG Flags;
752 ULONG MmShiftedColor;
753 ULONG FreeCount[2];
754 struct _SINGLE_LIST_ENTRY *PfnDeferredList;
755 } KNODE, *PKNODE;
756 #include <poppack.h>
757
758 //
759 // Kernel Profile Object
760 //
761 typedef struct _KPROFILE
762 {
763 CSHORT Type;
764 CSHORT Size;
765 LIST_ENTRY ProfileListEntry;
766 struct _KPROCESS *Process;
767 PVOID RangeBase;
768 PVOID RangeLimit;
769 ULONG BucketShift;
770 PVOID Buffer;
771 ULONG_PTR Segment;
772 KAFFINITY Affinity;
773 KPROFILE_SOURCE Source;
774 BOOLEAN Started;
775 } KPROFILE, *PKPROFILE;
776
777 //
778 // Kernel Interrupt Object
779 //
780 typedef struct _KINTERRUPT
781 {
782 CSHORT Type;
783 CSHORT Size;
784 LIST_ENTRY InterruptListEntry;
785 PKSERVICE_ROUTINE ServiceRoutine;
786 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
787 PKSERVICE_ROUTINE MessageServiceRoutine;
788 ULONG MessageIndex;
789 #endif
790 PVOID ServiceContext;
791 KSPIN_LOCK SpinLock;
792 ULONG TickCount;
793 PKSPIN_LOCK ActualLock;
794 PKINTERRUPT_ROUTINE DispatchAddress;
795 ULONG Vector;
796 KIRQL Irql;
797 KIRQL SynchronizeIrql;
798 BOOLEAN FloatingSave;
799 BOOLEAN Connected;
800 CCHAR Number;
801 BOOLEAN ShareVector;
802 KINTERRUPT_MODE Mode;
803 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
804 KINTERRUPT_POLARITY Polarity;
805 #endif
806 ULONG ServiceCount;
807 ULONG DispatchCount;
808 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
809 ULONGLONG Rsvd1;
810 #endif
811 #ifdef _M_AMD64
812 PKTRAP_FRAME TrapFrame;
813 PVOID Reserved;
814 #endif
815 ULONG DispatchCode[DISPATCH_LENGTH];
816 } KINTERRUPT;
817
818 //
819 // Kernel Event Pair Object
820 //
821 typedef struct _KEVENT_PAIR
822 {
823 CSHORT Type;
824 CSHORT Size;
825 KEVENT LowEvent;
826 KEVENT HighEvent;
827 } KEVENT_PAIR, *PKEVENT_PAIR;
828
829 //
830 // Kernel No Execute Options
831 //
832 typedef struct _KEXECUTE_OPTIONS
833 {
834 UCHAR ExecuteDisable:1;
835 UCHAR ExecuteEnable:1;
836 UCHAR DisableThunkEmulation:1;
837 UCHAR Permanent:1;
838 UCHAR ExecuteDispatchEnable:1;
839 UCHAR ImageDispatchEnable:1;
840 UCHAR Spare:2;
841 } KEXECUTE_OPTIONS, *PKEXECUTE_OPTIONS;
842
843 #if (NTDDI_VERSION >= NTDDI_WIN7)
844 typedef union _KWAIT_STATUS_REGISTER
845 {
846 UCHAR Flags;
847 struct
848 {
849 UCHAR State:2;
850 UCHAR Affinity:1;
851 UCHAR Priority:1;
852 UCHAR Apc:1;
853 UCHAR UserApc:1;
854 UCHAR Alert:1;
855 UCHAR Unused:1;
856 };
857 } KWAIT_STATUS_REGISTER, *PKWAIT_STATUS_REGISTER;
858
859 typedef struct _COUNTER_READING
860 {
861 enum _HARDWARE_COUNTER_TYPE Type;
862 ULONG Index;
863 ULONG64 Start;
864 ULONG64 Total;
865 }COUNTER_READING, *PCOUNTER_READING;
866
867 typedef struct _KTHREAD_COUNTERS
868 {
869 ULONG64 WaitReasonBitMap;
870 struct _THREAD_PERFORMANCE_DATA* UserData;
871 ULONG Flags;
872 ULONG ContextSwitches;
873 ULONG64 CycleTimeBias;
874 ULONG64 HardwareCounters;
875 COUNTER_READING HwCounter[16];
876 }KTHREAD_COUNTERS, *PKTHREAD_COUNTERS;
877 #endif
878
879 //
880 // Kernel Thread (KTHREAD)
881 //
882 typedef struct _KTHREAD
883 {
884 DISPATCHER_HEADER Header;
885 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
886 ULONGLONG CycleTime;
887 #ifndef _WIN64 // [
888 ULONG HighCycleTime;
889 #endif // ]
890 ULONGLONG QuantumTarget;
891 #else // ][
892 LIST_ENTRY MutantListHead;
893 #endif // ]
894 PVOID InitialStack;
895 ULONG_PTR StackLimit; // FIXME: PVOID
896 PVOID KernelStack;
897 KSPIN_LOCK ThreadLock;
898 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
899 KWAIT_STATUS_REGISTER WaitRegister;
900 BOOLEAN Running;
901 BOOLEAN Alerted[2];
902 union
903 {
904 struct
905 {
906 ULONG KernelStackResident:1;
907 ULONG ReadyTransition:1;
908 ULONG ProcessReadyQueue:1;
909 ULONG WaitNext:1;
910 ULONG SystemAffinityActive:1;
911 ULONG Alertable:1;
912 ULONG GdiFlushActive:1;
913 ULONG UserStackWalkActive:1;
914 ULONG ApcInterruptRequest:1;
915 ULONG ForceDeferSchedule:1;
916 ULONG QuantumEndMigrate:1;
917 ULONG UmsDirectedSwitchEnable:1;
918 ULONG TimerActive:1;
919 ULONG Reserved:19;
920 };
921 LONG MiscFlags;
922 };
923 #endif // ]
924 union
925 {
926 KAPC_STATE ApcState;
927 struct
928 {
929 UCHAR ApcStateFill[FIELD_OFFSET(KAPC_STATE, UserApcPending) + 1];
930 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
931 SCHAR Priority;
932 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
933 /* On x86, the following members "fall out" of the union */
934 volatile ULONG NextProcessor;
935 volatile ULONG DeferredProcessor;
936 #else // ][
937 /* On x86, the following members "fall out" of the union */
938 volatile USHORT NextProcessor;
939 volatile USHORT DeferredProcessor;
940 #endif // ]
941 #else // ][
942 UCHAR ApcQueueable;
943 /* On x86, the following members "fall out" of the union */
944 volatile UCHAR NextProcessor;
945 volatile UCHAR DeferredProcessor;
946 UCHAR AdjustReason;
947 SCHAR AdjustIncrement;
948 #endif // ]
949 };
950 };
951 KSPIN_LOCK ApcQueueLock;
952 #ifndef _M_AMD64 // [
953 ULONG ContextSwitches;
954 volatile UCHAR State;
955 UCHAR NpxState;
956 KIRQL WaitIrql;
957 KPROCESSOR_MODE WaitMode;
958 #endif // ]
959 LONG_PTR WaitStatus;
960 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
961 PKWAIT_BLOCK WaitBlockList;
962 #else // ][
963 union
964 {
965 PKWAIT_BLOCK WaitBlockList;
966 PKGATE GateObject;
967 };
968 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
969 union
970 {
971 struct
972 {
973 ULONG KernelStackResident:1;
974 ULONG ReadyTransition:1;
975 ULONG ProcessReadyQueue:1;
976 ULONG WaitNext:1;
977 ULONG SystemAffinityActive:1;
978 ULONG Alertable:1;
979 ULONG GdiFlushActive:1;
980 ULONG Reserved:25;
981 };
982 LONG MiscFlags;
983 };
984 #else // ][
985 BOOLEAN Alertable;
986 BOOLEAN WaitNext;
987 #endif // ]
988 UCHAR WaitReason;
989 #if (NTDDI_VERSION < NTDDI_LONGHORN)
990 SCHAR Priority;
991 BOOLEAN EnableStackSwap;
992 #endif // ]
993 volatile UCHAR SwapBusy;
994 BOOLEAN Alerted[MaximumMode];
995 #endif // ]
996 union
997 {
998 LIST_ENTRY WaitListEntry;
999 SINGLE_LIST_ENTRY SwapListEntry;
1000 };
1001 PKQUEUE Queue;
1002 #ifndef _M_AMD64 // [
1003 ULONG WaitTime;
1004 union
1005 {
1006 struct
1007 {
1008 SHORT KernelApcDisable;
1009 SHORT SpecialApcDisable;
1010 };
1011 ULONG CombinedApcDisable;
1012 };
1013 #endif // ]
1014 struct _TEB *Teb;
1015
1016 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1017 KTIMER Timer;
1018 #else // ][
1019 union
1020 {
1021 KTIMER Timer;
1022 struct
1023 {
1024 UCHAR TimerFill[FIELD_OFFSET(KTIMER, Period) + sizeof(LONG)];
1025 #if !defined(_WIN64) // [
1026 };
1027 };
1028 #endif // ]
1029 #endif // ]
1030 union
1031 {
1032 struct
1033 {
1034 ULONG AutoAlignment:1;
1035 ULONG DisableBoost:1;
1036 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1037 ULONG EtwStackTraceApc1Inserted:1;
1038 ULONG EtwStackTraceApc2Inserted:1;
1039 ULONG CycleChargePending:1;
1040 ULONG CalloutActive:1;
1041 ULONG ApcQueueable:1;
1042 ULONG EnableStackSwap:1;
1043 ULONG GuiThread:1;
1044 ULONG ReservedFlags:23;
1045 #else // ][
1046 LONG ReservedFlags:30;
1047 #endif // ]
1048 };
1049 LONG ThreadFlags;
1050 };
1051 #if defined(_WIN64) && (NTDDI_VERSION < NTDDI_WIN7) // [
1052 };
1053 };
1054 #endif // ]
1055 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1056 #if defined(_WIN64) // [
1057 ULONG Spare0;
1058 #else // ][
1059 PVOID ServiceTable;
1060 #endif // ]
1061 #endif // ]
1062 union
1063 {
1064 DECLSPEC_ALIGN(8) KWAIT_BLOCK WaitBlock[THREAD_WAIT_OBJECTS + 1];
1065 #if (NTDDI_VERSION < NTDDI_WIN7) // [
1066 struct
1067 {
1068 UCHAR WaitBlockFill0[FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 32bit = 23, 64bit = 43
1069 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1070 UCHAR IdealProcessor;
1071 #else // ][
1072 BOOLEAN SystemAffinityActive;
1073 #endif // ]
1074 };
1075 struct
1076 {
1077 UCHAR WaitBlockFill1[1 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 47 / 91
1078 CCHAR PreviousMode;
1079 };
1080 struct
1081 {
1082 UCHAR WaitBlockFill2[2 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 71 / 139
1083 UCHAR ResourceIndex;
1084 };
1085 struct
1086 {
1087 UCHAR WaitBlockFill3[3 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareByte)]; // 95 / 187
1088 UCHAR LargeStack;
1089 };
1090 #endif // ]
1091 #ifdef _M_AMD64 // [
1092 struct
1093 {
1094 UCHAR WaitBlockFill4[FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
1095 ULONG ContextSwitches;
1096 };
1097 struct
1098 {
1099 UCHAR WaitBlockFill5[1 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
1100 UCHAR State;
1101 UCHAR NpxState;
1102 UCHAR WaitIrql;
1103 CHAR WaitMode;
1104 };
1105 struct
1106 {
1107 UCHAR WaitBlockFill6[2 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
1108 ULONG WaitTime;
1109 };
1110 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1111 struct
1112 {
1113 UCHAR WaitBlockFill7[168];
1114 PVOID TebMappedLowVa;
1115 struct _UMS_CONTROL_BLOCK* Ucb;
1116 };
1117 #endif // ]
1118 struct
1119 {
1120 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1121 UCHAR WaitBlockFill8[188];
1122 #else // ][
1123 UCHAR WaitBlockFill7[3 * sizeof(KWAIT_BLOCK) + FIELD_OFFSET(KWAIT_BLOCK, SpareLong)];
1124 #endif // ]
1125 union
1126 {
1127 struct
1128 {
1129 SHORT KernelApcDisable;
1130 SHORT SpecialApcDisable;
1131 };
1132 ULONG CombinedApcDisable;
1133 };
1134 };
1135 #endif // ]
1136 };
1137 LIST_ENTRY QueueListEntry;
1138 PKTRAP_FRAME TrapFrame;
1139 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1140 PVOID FirstArgument;
1141 union // 2 elements, 0x8 bytes (sizeof)
1142 {
1143 PVOID CallbackStack;
1144 ULONG_PTR CallbackDepth;
1145 };
1146 #else // ][
1147 PVOID CallbackStack;
1148 #endif // ]
1149 #if (NTDDI_VERSION < NTDDI_LONGHORN) || ((NTDDI_VERSION < NTDDI_WIN7) && !defined(_WIN64)) // [
1150 PVOID ServiceTable;
1151 #endif // ]
1152 #if (NTDDI_VERSION < NTDDI_LONGHORN) && defined(_WIN64) // [
1153 ULONG KernelLimit;
1154 #endif // ]
1155 UCHAR ApcStateIndex;
1156 #if (NTDDI_VERSION < NTDDI_LONGHORN) // [
1157 UCHAR IdealProcessor;
1158 BOOLEAN Preempted;
1159 BOOLEAN ProcessReadyQueue;
1160 #ifdef _WIN64 // [
1161 PVOID Win32kTable;
1162 ULONG Win32kLimit;
1163 #endif // ]
1164 BOOLEAN KernelStackResident;
1165 #endif // ]
1166 SCHAR BasePriority;
1167 SCHAR PriorityDecrement;
1168 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1169 BOOLEAN Preempted;
1170 UCHAR AdjustReason;
1171 CHAR AdjustIncrement;
1172 #if (NTDDI_VERSION >= NTDDI_WIN7)
1173 UCHAR PreviousMode;
1174 #else
1175 UCHAR Spare01;
1176 #endif
1177 #endif // ]
1178 CHAR Saturation;
1179 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1180 ULONG SystemCallNumber;
1181 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1182 ULONG FreezeCount;
1183 #else // ][
1184 ULONG Spare02;
1185 #endif // ]
1186 #endif // ]
1187 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1188 GROUP_AFFINITY UserAffinity;
1189 struct _KPROCESS *Process;
1190 GROUP_AFFINITY Affinity;
1191 ULONG IdealProcessor;
1192 ULONG UserIdealProcessor;
1193 #else // ][
1194 KAFFINITY UserAffinity;
1195 struct _KPROCESS *Process;
1196 KAFFINITY Affinity;
1197 #endif // ]
1198 PKAPC_STATE ApcStatePointer[2];
1199 union
1200 {
1201 KAPC_STATE SavedApcState;
1202 struct
1203 {
1204 UCHAR SavedApcStateFill[FIELD_OFFSET(KAPC_STATE, UserApcPending) + 1];
1205 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1206 UCHAR WaitReason;
1207 #else // ][
1208 CCHAR FreezeCount;
1209 #endif // ]
1210 #ifndef _WIN64 // [
1211 };
1212 };
1213 #endif // ]
1214 CCHAR SuspendCount;
1215 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1216 CCHAR Spare1;
1217 #else // ][
1218 UCHAR UserIdealProcessor;
1219 #endif // ]
1220 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1221 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
1222 UCHAR Spare03;
1223 #else // ][
1224 UCHAR CalloutActive;
1225 #endif // ]
1226 #ifdef _WIN64 // [
1227 UCHAR CodePatchInProgress;
1228 };
1229 };
1230 #endif // ]
1231 #if defined(_M_IX86) // [
1232 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1233 UCHAR OtherPlatformFill;
1234 #else // ][
1235 UCHAR Iopl;
1236 #endif // ]
1237 #endif // ]
1238 PVOID Win32Thread;
1239 PVOID StackBase;
1240 union
1241 {
1242 KAPC SuspendApc;
1243 struct
1244 {
1245 UCHAR SuspendApcFill0[1];
1246 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1247 UCHAR ResourceIndex;
1248 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
1249 CHAR Spare04;
1250 #else // ][
1251 SCHAR Quantum;
1252 #endif // ]
1253 };
1254 struct
1255 {
1256 UCHAR SuspendApcFill1[3];
1257 UCHAR QuantumReset;
1258 };
1259 struct
1260 {
1261 UCHAR SuspendApcFill2[4];
1262 ULONG KernelTime;
1263 };
1264 struct
1265 {
1266 UCHAR SuspendApcFill3[FIELD_OFFSET(KAPC, SystemArgument1)];
1267 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1268 PKPRCB WaitPrcb;
1269 #else
1270 PVOID TlsArray;
1271 #endif
1272 };
1273 struct
1274 {
1275 UCHAR SuspendApcFill4[FIELD_OFFSET(KAPC, SystemArgument2)]; // 40 / 72
1276 PVOID LegoData;
1277 };
1278 struct
1279 {
1280 UCHAR SuspendApcFill5[FIELD_OFFSET(KAPC, Inserted) + 1]; // 47 / 83
1281 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1282 UCHAR LargeStack;
1283 #else // ][
1284 UCHAR PowerState;
1285 #endif // ]
1286 #ifdef _WIN64 // [
1287 ULONG UserTime;
1288 #endif // ]
1289 };
1290 };
1291 #ifndef _WIN64 // [
1292 ULONG UserTime;
1293 #endif // ]
1294 union
1295 {
1296 KSEMAPHORE SuspendSemaphore;
1297 struct
1298 {
1299 UCHAR SuspendSemaphorefill[FIELD_OFFSET(KSEMAPHORE, Limit) + 4]; // 20 / 28
1300 #ifdef _WIN64 // [
1301 ULONG SListFaultCount;
1302 #endif // ]
1303 };
1304 };
1305 #ifndef _WIN64 // [
1306 ULONG SListFaultCount;
1307 #endif // ]
1308 LIST_ENTRY ThreadListEntry;
1309 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1310 LIST_ENTRY MutantListHead;
1311 #endif // ]
1312 PVOID SListFaultAddress;
1313 #ifdef _M_AMD64 // [
1314 LONG64 ReadOperationCount;
1315 LONG64 WriteOperationCount;
1316 LONG64 OtherOperationCount;
1317 LONG64 ReadTransferCount;
1318 LONG64 WriteTransferCount;
1319 LONG64 OtherTransferCount;
1320 #endif // ]
1321 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1322 PKTHREAD_COUNTERS ThreadCounters;
1323 PXSTATE_SAVE XStateSave;
1324 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
1325 PVOID MdlForLockedTeb;
1326 #endif // ]
1327 } KTHREAD;
1328
1329 #define ASSERT_THREAD(object) \
1330 ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == ThreadObject))
1331
1332 //
1333 // Kernel Process (KPROCESS)
1334 //
1335 typedef struct _KPROCESS
1336 {
1337 DISPATCHER_HEADER Header;
1338 LIST_ENTRY ProfileListHead;
1339 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1340 ULONG_PTR DirectoryTableBase;
1341 ULONG Unused0;
1342 #else
1343 ULONG_PTR DirectoryTableBase[2];
1344 #endif
1345 #if defined(_M_IX86)
1346 KGDTENTRY LdtDescriptor;
1347 KIDTENTRY Int21Descriptor;
1348 #endif
1349 USHORT IopmOffset;
1350 #if defined(_M_IX86)
1351 UCHAR Iopl;
1352 UCHAR Unused;
1353 #endif
1354 volatile ULONG ActiveProcessors;
1355 ULONG KernelTime;
1356 ULONG UserTime;
1357 LIST_ENTRY ReadyListHead;
1358 SINGLE_LIST_ENTRY SwapListEntry;
1359 PVOID VdmTrapcHandler;
1360 LIST_ENTRY ThreadListHead;
1361 KSPIN_LOCK ProcessLock;
1362 KAFFINITY Affinity;
1363 union
1364 {
1365 struct
1366 {
1367 LONG AutoAlignment:1;
1368 LONG DisableBoost:1;
1369 LONG DisableQuantum:1;
1370 LONG ReservedFlags:29;
1371 };
1372 LONG ProcessFlags;
1373 };
1374 SCHAR BasePriority;
1375 SCHAR QuantumReset;
1376 UCHAR State;
1377 UCHAR ThreadSeed;
1378 UCHAR PowerState;
1379 UCHAR IdealNode;
1380 UCHAR Visited;
1381 union
1382 {
1383 KEXECUTE_OPTIONS Flags;
1384 UCHAR ExecuteOptions;
1385 };
1386 ULONG StackCount;
1387 LIST_ENTRY ProcessListEntry;
1388 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1389 ULONGLONG CycleTime;
1390 #endif // ]
1391 } KPROCESS;
1392
1393 #define ASSERT_PROCESS(object) \
1394 ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == ProcessObject))
1395
1396 //
1397 // System Service Table Descriptor
1398 //
1399 typedef struct _KSERVICE_TABLE_DESCRIPTOR
1400 {
1401 PULONG_PTR Base;
1402 PULONG Count;
1403 ULONG Limit;
1404 #if defined(_IA64_)
1405 LONG TableBaseGpOffset;
1406 #endif
1407 PUCHAR Number;
1408 } KSERVICE_TABLE_DESCRIPTOR, *PKSERVICE_TABLE_DESCRIPTOR;
1409
1410 //
1411 // Exported Loader Parameter Block
1412 //
1413 extern struct _LOADER_PARAMETER_BLOCK NTSYSAPI *KeLoaderBlock;
1414
1415 //
1416 // Exported Hardware Data
1417 //
1418 extern KAFFINITY NTSYSAPI KeActiveProcessors;
1419 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1420 extern volatile CCHAR NTSYSAPI KeNumberProcessors;
1421 #else
1422 #if (NTDDI_VERSION >= NTDDI_WINXP)
1423 extern CCHAR NTSYSAPI KeNumberProcessors;
1424 #else
1425 //extern PCCHAR KeNumberProcessors;
1426 extern NTSYSAPI CCHAR KeNumberProcessors; //FIXME: Note to Alex: I won't fix this atm, since I prefer to discuss this with you first.
1427 #endif
1428 #endif
1429 extern ULONG NTSYSAPI KiDmaIoCoherency;
1430 extern ULONG NTSYSAPI KeMaximumIncrement;
1431 extern ULONG NTSYSAPI KeMinimumIncrement;
1432 extern ULONG NTSYSAPI KeDcacheFlushCount;
1433 extern ULONG NTSYSAPI KeIcacheFlushCount;
1434 extern ULONG_PTR NTSYSAPI KiBugCheckData[];
1435 extern BOOLEAN NTSYSAPI KiEnableTimerWatchdog;
1436
1437 //
1438 // Exported System Service Descriptor Tables
1439 //
1440 extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTable[SSDT_MAX_ENTRIES];
1441 extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES];
1442
1443 #endif // !NTOS_MODE_USER
1444
1445 #endif // _KETYPES_H