3 Copyright (c) Alex Ionescu. All rights reserved.
11 Type definitions for the Loader.
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
26 #ifndef NTOS_MODE_USER
33 // Context Record Flags
35 #define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
38 // Maximum System Descriptor Table Entries
40 #define SSDT_MAX_ENTRIES 2
43 // Processor Architectures
45 #define PROCESSOR_ARCHITECTURE_INTEL 0
46 #define PROCESSOR_ARCHITECTURE_MIPS 1
47 #define PROCESSOR_ARCHITECTURE_ALPHA 2
48 #define PROCESSOR_ARCHITECTURE_PPC 3
49 #define PROCESSOR_ARCHITECTURE_SHX 4
50 #define PROCESSOR_ARCHITECTURE_ARM 5
51 #define PROCESSOR_ARCHITECTURE_IA64 6
52 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
53 #define PROCESSOR_ARCHITECTURE_MSIL 8
54 #define PROCESSOR_ARCHITECTURE_AMD64 9
55 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
58 // Object Type Mask for Kernel Dispatcher Objects
60 #define KOBJECT_TYPE_MASK 0x7F
61 #define KOBJECT_LOCK_BIT 0x80
64 // Dispatcher Priority increments
66 #define THREAD_ALERT_INCREMENT 2
69 // Physical memory offset of KUSER_SHARED_DATA
71 #define KI_USER_SHARED_DATA_PHYSICAL 0x41000
74 // Quantum values and decrements
76 #define MAX_QUANTUM 0x7F
77 #define WAIT_QUANTUM_DECREMENT 1
78 #define CLOCK_QUANTUM_DECREMENT 3
81 // Kernel Feature Bits
83 #define KF_V86_VIS 0x00000001
84 #define KF_RDTSC 0x00000002
85 #define KF_CR4 0x00000004
86 #define KF_CMOV 0x00000008
87 #define KF_GLOBAL_PAGE 0x00000010
88 #define KF_LARGE_PAGE 0x00000020
89 #define KF_MTRR 0x00000040
90 #define KF_CMPXCHG8B 0x00000080
91 #define KF_MMX 0x00000100
92 #define KF_WORKING_PTE 0x00000200
93 #define KF_PAT 0x00000400
94 #define KF_FXSR 0x00000800
95 #define KF_FAST_SYSCALL 0x00001000
96 #define KF_XMMI 0x00002000
97 #define KF_3DNOW 0x00004000
98 #define KF_AMDK6MTRR 0x00008000
99 #define KF_XMMI64 0x00010000
100 #define KF_DTS 0x00020000
101 #define KF_NX_BIT 0x20000000
102 #define KF_NX_DISABLED 0x40000000
103 #define KF_NX_ENABLED 0x80000000
106 // Internal Exception Codes
108 #define KI_EXCEPTION_INTERNAL 0x10000000
109 #define KI_EXCEPTION_ACCESS_VIOLATION (KI_EXCEPTION_INTERNAL | 0x04)
111 #ifndef NTOS_MODE_USER
113 // Number of dispatch codes supported by KINTERRUPT
116 #define DISPATCH_LENGTH 4
117 #elif (NTDDI_VERSION >= NTDDI_LONGHORN)
118 #define DISPATCH_LENGTH 135
120 #define DISPATCH_LENGTH 106
126 // KPROCESSOR_MODE Type
128 typedef CCHAR KPROCESSOR_MODE
;
131 // Dereferencable pointer to KUSER_SHARED_DATA in User-Mode
133 #define SharedUserData ((KUSER_SHARED_DATA *)USER_SHARED_DATA)
136 // Maximum WOW64 Entries in KUSER_SHARED_DATA
138 #define MAX_WOW64_SHARED_ENTRIES 16
141 // Maximum Processor Features supported in KUSER_SHARED_DATA
143 #define PROCESSOR_FEATURE_MAX 64
148 typedef enum _EVENT_TYPE
157 typedef enum _TIMER_TYPE
166 typedef enum _WAIT_TYPE
173 // Processor Execution Modes
185 typedef enum _KWAIT_REASON
227 typedef enum _KPROFILE_SOURCE
230 ProfileAlignmentFixup
,
233 ProfileLoadInstructions
,
234 ProfilePipelineFrozen
,
235 ProfileBranchInstructions
,
236 ProfileTotalNonissues
,
240 ProfileBranchMispredictions
,
241 ProfileStoreInstructions
,
242 ProfileFpInstructions
,
243 ProfileIntegerInstructions
,
247 ProfileSpecialInstructions
,
250 ProfileDcacheAccesses
,
251 ProfileMemoryBarrierCycles
,
252 ProfileLoadLinkedIssues
,
257 // NT Product and Architecture Types
259 typedef enum _NT_PRODUCT_TYPE
264 } NT_PRODUCT_TYPE
, *PNT_PRODUCT_TYPE
;
266 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
271 } ALTERNATIVE_ARCHITECTURE_TYPE
;
278 typedef enum _KTHREAD_STATE
288 #if (NTDDI_VERSION >= NTDDI_WS03)
291 } KTHREAD_STATE
, *PKTHREAD_STATE
;
294 // Kernel Object Types
296 typedef enum _KOBJECTS
298 EventNotificationObject
= 0,
299 EventSynchronizationObject
= 1,
306 TimerNotificationObject
= 8,
307 TimerSynchronizationObject
= 9,
318 DeviceQueueObject
= 20,
319 EventPairObject
= 21,
320 InterruptObject
= 22,
322 ThreadedDpcObject
= 24,
323 MaximumKernelObject
= 25
329 typedef enum _ADJUST_REASON
339 typedef enum _KCONTINUE_STATUS
343 ContinueProcessorReselected
,
344 ContinueNextProcessor
350 typedef enum _KPROCESS_STATE
357 } KPROCESS_STATE
, *PKPROCESS_STATE
;
360 // NtVdmControl Classes
362 typedef enum _VDMSERVICECLASS
364 VdmStartExecution
= 0,
365 VdmQueueInterrupt
= 1,
366 VdmDelayInterrupt
= 2,
369 VdmSetInt21Handler
= 5,
371 VdmPrinterDirectIoOpen
= 7,
372 VdmPrinterDirectIoClose
= 8,
373 VdmPrinterInitialize
= 9,
374 VdmSetLdtEntries
= 10,
375 VdmSetProcessLdtInfo
= 11,
376 VdmAdlibEmulation
= 12,
377 VdmPMCliControl
= 13,
378 VdmQueryVdmProcess
= 14,
381 #ifdef NTOS_MODE_USER
384 // APC Normal Routine
387 (NTAPI
*PKNORMAL_ROUTINE
)(
388 _In_ PVOID NormalContext
,
389 _In_ PVOID SystemArgument1
,
390 _In_ PVOID SystemArgument2
397 (NTAPI
*PTIMER_APC_ROUTINE
)(
398 _In_ PVOID TimerContext
,
399 _In_ ULONG TimerLowValue
,
400 _In_ LONG TimerHighValue
404 // System Time Structure
406 typedef struct _KSYSTEM_TIME
411 } KSYSTEM_TIME
, *PKSYSTEM_TIME
;
414 // Shared Kernel User Data
416 typedef struct _KUSER_SHARED_DATA
418 ULONG TickCountLowDeprecated
;
419 ULONG TickCountMultiplier
;
420 volatile KSYSTEM_TIME InterruptTime
;
421 volatile KSYSTEM_TIME SystemTime
;
422 volatile KSYSTEM_TIME TimeZoneBias
;
423 USHORT ImageNumberLow
;
424 USHORT ImageNumberHigh
;
425 WCHAR NtSystemRoot
[260];
426 ULONG MaxStackTraceDepth
;
427 ULONG CryptoExponent
;
429 ULONG LargePageMinimum
;
431 NT_PRODUCT_TYPE NtProductType
;
432 BOOLEAN ProductTypeIsValid
;
433 ULONG NtMajorVersion
;
434 ULONG NtMinorVersion
;
435 BOOLEAN ProcessorFeatures
[PROCESSOR_FEATURE_MAX
];
438 volatile ULONG TimeSlip
;
439 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture
;
440 LARGE_INTEGER SystemExpirationDate
;
442 BOOLEAN KdDebuggerEnabled
;
443 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
444 UCHAR NXSupportPolicy
;
446 volatile ULONG ActiveConsoleId
;
447 volatile ULONG DismountCount
;
448 ULONG ComPlusPackage
;
449 ULONG LastSystemRITEventTickCount
;
450 ULONG NumberOfPhysicalPages
;
451 BOOLEAN SafeBootMode
;
454 ULONGLONG TestRetInstruction
;
456 ULONG SystemCallReturn
;
457 ULONGLONG SystemCallPad
[3];
459 volatile KSYSTEM_TIME TickCount
;
460 volatile ULONG64 TickCountQuad
;
463 #if (NTDDI_VERSION >= NTDDI_WS03)
464 LONGLONG ConsoleSessionForegroundProcessId
;
465 ULONG Wow64SharedInformation
[MAX_WOW64_SHARED_ENTRIES
];
467 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
468 USHORT UserModeGlobalLogger
[8];
469 ULONG HeapTracingPid
[2];
470 ULONG CritSecTracingPid
[2];
473 ULONG SharedDataFlags
;
476 ULONG DbgErrorPortPresent
:1;
477 ULONG DbgElevationEnabled
:1;
478 ULONG DbgVirtEnabled
:1;
479 ULONG DbgInstallerDetectEnabled
:1;
483 ULONG ImageFileExecutionOptions
;
484 KAFFINITY ActiveProcessorAffinity
;
486 } KUSER_SHARED_DATA
, *PKUSER_SHARED_DATA
;
491 #include "pshpack1.h"
492 typedef struct _VdmVirtualIca
505 } VDMVIRTUALICA
, *PVDMVIRTUALICA
;
508 typedef struct _VdmIcaUserData
511 PVDMVIRTUALICA pIcaMaster
;
512 PVDMVIRTUALICA pIcaSlave
;
517 PULONG pAddrIretBopTable
;
518 PHANDLE phWowIdleEvent
;
519 PLARGE_INTEGER pIcaTimeout
;
520 PHANDLE phMainThreadSuspended
;
521 } VDMICAUSERDATA
, *PVDMICAUSERDATA
;
523 typedef struct _VDM_INITIALIZE_DATA
526 PVDMICAUSERDATA IcaUserData
;
527 } VDM_INITIALIZE_DATA
, *PVDM_INITIALIZE_DATA
;
532 // System Thread Start Routine
536 (NTAPI
*PKSYSTEM_ROUTINE
)(
537 PKSTART_ROUTINE StartRoutine
,
542 // APC Environment Types
544 typedef enum _KAPC_ENVIRONMENT
546 OriginalApcEnvironment
,
547 AttachedApcEnvironment
,
548 CurrentApcEnvironment
,
555 typedef struct _KDPC_DATA
557 LIST_ENTRY DpcListHead
;
560 volatile LONG DpcQueueDepth
;
562 volatile ULONG DpcQueueDepth
;
565 } KDPC_DATA
, *PKDPC_DATA
;
568 // Per-Processor Lookaside List
570 typedef struct _PP_LOOKASIDE_LIST
572 struct _GENERAL_LOOKASIDE
*P
;
573 struct _GENERAL_LOOKASIDE
*L
;
574 } PP_LOOKASIDE_LIST
, *PPP_LOOKASIDE_LIST
;
577 // Architectural Types
579 #include <arch/ketypes.h>
582 // Kernel Memory Node
584 #include <pshpack1.h>
585 typedef struct _KNODE
587 SLIST_HEADER DeadStackList
;
588 SLIST_HEADER PfnDereferenceSListHead
;
589 KAFFINITY ProcessorMask
;
594 ULONG MmShiftedColor
;
596 struct _SINGLE_LIST_ENTRY
*PfnDeferredList
;
601 // Kernel Profile Object
603 typedef struct _KPROFILE
607 LIST_ENTRY ProfileListEntry
;
608 struct _KPROCESS
*Process
;
615 KPROFILE_SOURCE Source
;
617 } KPROFILE
, *PKPROFILE
;
620 // Kernel Interrupt Object
622 typedef struct _KINTERRUPT
626 LIST_ENTRY InterruptListEntry
;
627 PKSERVICE_ROUTINE ServiceRoutine
;
628 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
629 PKSERVICE_ROUTINE MessageServiceRoutine
;
632 PVOID ServiceContext
;
635 PKSPIN_LOCK ActualLock
;
636 PKINTERRUPT_ROUTINE DispatchAddress
;
639 KIRQL SynchronizeIrql
;
640 BOOLEAN FloatingSave
;
644 KINTERRUPT_MODE Mode
;
645 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
646 KINTERRUPT_POLARITY Polarity
;
650 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
654 PKTRAP_FRAME TrapFrame
;
657 ULONG DispatchCode
[DISPATCH_LENGTH
];
661 // Kernel Event Pair Object
663 typedef struct _KEVENT_PAIR
669 } KEVENT_PAIR
, *PKEVENT_PAIR
;
672 // Kernel No Execute Options
674 typedef struct _KEXECUTE_OPTIONS
676 UCHAR ExecuteDisable
:1;
677 UCHAR ExecuteEnable
:1;
678 UCHAR DisableThunkEmulation
:1;
680 UCHAR ExecuteDispatchEnable
:1;
681 UCHAR ImageDispatchEnable
:1;
683 } KEXECUTE_OPTIONS
, *PKEXECUTE_OPTIONS
;
685 #if (NTDDI_VERSION >= NTDDI_WIN7)
686 typedef union _KWAIT_STATUS_REGISTER
699 } KWAIT_STATUS_REGISTER
, *PKWAIT_STATUS_REGISTER
;
701 typedef struct _COUNTER_READING
703 enum _HARDWARE_COUNTER_TYPE Type
;
707 }COUNTER_READING
, *PCOUNTER_READING
;
709 typedef struct _KTHREAD_COUNTERS
711 ULONG64 WaitReasonBitMap
;
712 struct _THREAD_PERFORMANCE_DATA
* UserData
;
714 ULONG ContextSwitches
;
715 ULONG64 CycleTimeBias
;
716 ULONG64 HardwareCounters
;
717 COUNTER_READING HwCounter
[16];
718 }KTHREAD_COUNTERS
, *PKTHREAD_COUNTERS
;
722 // Kernel Thread (KTHREAD)
724 typedef struct _KTHREAD
726 DISPATCHER_HEADER Header
;
727 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
732 ULONGLONG QuantumTarget
;
734 LIST_ENTRY MutantListHead
;
737 ULONG_PTR StackLimit
; // FIXME: PVOID
739 KSPIN_LOCK ThreadLock
;
740 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
741 KWAIT_STATUS_REGISTER WaitRegister
;
748 ULONG KernelStackResident
:1;
749 ULONG ReadyTransition
:1;
750 ULONG ProcessReadyQueue
:1;
752 ULONG SystemAffinityActive
:1;
754 ULONG GdiFlushActive
:1;
755 ULONG UserStackWalkActive
:1;
756 ULONG ApcInterruptRequest
:1;
757 ULONG ForceDeferSchedule
:1;
758 ULONG QuantumEndMigrate
:1;
759 ULONG UmsDirectedSwitchEnable
:1;
771 UCHAR ApcStateFill
[FIELD_OFFSET(KAPC_STATE
, UserApcPending
) + 1];
772 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
774 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
775 /* On x86, the following members "fall out" of the union */
776 volatile ULONG NextProcessor
;
777 volatile ULONG DeferredProcessor
;
779 /* On x86, the following members "fall out" of the union */
780 volatile USHORT NextProcessor
;
781 volatile USHORT DeferredProcessor
;
785 /* On x86, the following members "fall out" of the union */
786 volatile UCHAR NextProcessor
;
787 volatile UCHAR DeferredProcessor
;
789 SCHAR AdjustIncrement
;
793 KSPIN_LOCK ApcQueueLock
;
794 #ifndef _M_AMD64 // [
795 ULONG ContextSwitches
;
796 volatile UCHAR State
;
799 KPROCESSOR_MODE WaitMode
;
802 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
803 PKWAIT_BLOCK WaitBlockList
;
807 PKWAIT_BLOCK WaitBlockList
;
810 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
815 ULONG KernelStackResident
:1;
816 ULONG ReadyTransition
:1;
817 ULONG ProcessReadyQueue
:1;
819 ULONG SystemAffinityActive
:1;
821 ULONG GdiFlushActive
:1;
831 #if (NTDDI_VERSION < NTDDI_LONGHORN)
833 BOOLEAN EnableStackSwap
;
835 volatile UCHAR SwapBusy
;
836 BOOLEAN Alerted
[MaximumMode
];
840 LIST_ENTRY WaitListEntry
;
841 SINGLE_LIST_ENTRY SwapListEntry
;
844 #ifndef _M_AMD64 // [
850 SHORT KernelApcDisable
;
851 SHORT SpecialApcDisable
;
853 ULONG CombinedApcDisable
;
858 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
866 UCHAR TimerFill
[FIELD_OFFSET(KTIMER
, Period
) + sizeof(LONG
)];
867 #if !defined(_WIN64) // [
876 ULONG AutoAlignment
:1;
877 ULONG DisableBoost
:1;
878 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
879 ULONG EtwStackTraceApc1Inserted
:1;
880 ULONG EtwStackTraceApc2Inserted
:1;
881 ULONG CycleChargePending
:1;
882 ULONG CalloutActive
:1;
883 ULONG ApcQueueable
:1;
884 ULONG EnableStackSwap
:1;
886 ULONG ReservedFlags
:23;
888 LONG ReservedFlags
:30;
893 #if defined(_WIN64) && (NTDDI_VERSION < NTDDI_WIN7) // [
897 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
898 #if defined(_WIN64) // [
906 DECLSPEC_ALIGN(8) KWAIT_BLOCK WaitBlock
[THREAD_WAIT_OBJECTS
+ 1];
907 #if (NTDDI_VERSION < NTDDI_WIN7) // [
910 UCHAR WaitBlockFill0
[FIELD_OFFSET(KWAIT_BLOCK
, SpareByte
)]; // 32bit = 23, 64bit = 43
911 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
912 UCHAR IdealProcessor
;
914 BOOLEAN SystemAffinityActive
;
919 UCHAR WaitBlockFill1
[1 * sizeof(KWAIT_BLOCK
) + FIELD_OFFSET(KWAIT_BLOCK
, SpareByte
)]; // 47 / 91
924 UCHAR WaitBlockFill2
[2 * sizeof(KWAIT_BLOCK
) + FIELD_OFFSET(KWAIT_BLOCK
, SpareByte
)]; // 71 / 139
929 UCHAR WaitBlockFill3
[3 * sizeof(KWAIT_BLOCK
) + FIELD_OFFSET(KWAIT_BLOCK
, SpareByte
)]; // 95 / 187
936 UCHAR WaitBlockFill4
[FIELD_OFFSET(KWAIT_BLOCK
, SpareLong
)];
937 ULONG ContextSwitches
;
941 UCHAR WaitBlockFill5
[1 * sizeof(KWAIT_BLOCK
) + FIELD_OFFSET(KWAIT_BLOCK
, SpareLong
)];
949 UCHAR WaitBlockFill6
[2 * sizeof(KWAIT_BLOCK
) + FIELD_OFFSET(KWAIT_BLOCK
, SpareLong
)];
952 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
955 UCHAR WaitBlockFill7
[168];
956 PVOID TebMappedLowVa
;
957 struct _UMS_CONTROL_BLOCK
* Ucb
;
962 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
963 UCHAR WaitBlockFill8
[188];
965 UCHAR WaitBlockFill7
[3 * sizeof(KWAIT_BLOCK
) + FIELD_OFFSET(KWAIT_BLOCK
, SpareLong
)];
971 SHORT KernelApcDisable
;
972 SHORT SpecialApcDisable
;
974 ULONG CombinedApcDisable
;
979 LIST_ENTRY QueueListEntry
;
980 PKTRAP_FRAME TrapFrame
;
981 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
983 union // 2 elements, 0x8 bytes (sizeof)
986 ULONG_PTR CallbackDepth
;
991 #if (NTDDI_VERSION < NTDDI_LONGHORN) || ((NTDDI_VERSION < NTDDI_WIN7) && !defined(_WIN64)) // [
994 #if (NTDDI_VERSION < NTDDI_LONGHORN) && defined(_WIN64) // [
998 #if (NTDDI_VERSION < NTDDI_LONGHORN) // [
999 UCHAR IdealProcessor
;
1001 BOOLEAN ProcessReadyQueue
;
1006 BOOLEAN KernelStackResident
;
1009 SCHAR PriorityDecrement
;
1010 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1013 CHAR AdjustIncrement
;
1014 #if (NTDDI_VERSION >= NTDDI_WIN7)
1021 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1022 ULONG SystemCallNumber
;
1023 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1029 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1030 GROUP_AFFINITY UserAffinity
;
1031 struct _KPROCESS
*Process
;
1032 GROUP_AFFINITY Affinity
;
1033 ULONG IdealProcessor
;
1034 ULONG UserIdealProcessor
;
1036 KAFFINITY UserAffinity
;
1037 struct _KPROCESS
*Process
;
1040 PKAPC_STATE ApcStatePointer
[2];
1043 KAPC_STATE SavedApcState
;
1046 UCHAR SavedApcStateFill
[FIELD_OFFSET(KAPC_STATE
, UserApcPending
) + 1];
1047 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1057 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1060 UCHAR UserIdealProcessor
;
1062 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1063 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
1066 UCHAR CalloutActive
;
1069 UCHAR CodePatchInProgress
;
1073 #if defined(_M_IX86) // [
1074 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1075 UCHAR OtherPlatformFill
;
1087 UCHAR SuspendApcFill0
[1];
1088 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1089 UCHAR ResourceIndex
;
1090 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
1098 UCHAR SuspendApcFill1
[3];
1103 UCHAR SuspendApcFill2
[4];
1108 UCHAR SuspendApcFill3
[FIELD_OFFSET(KAPC
, SystemArgument1
)];
1109 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1117 UCHAR SuspendApcFill4
[FIELD_OFFSET(KAPC
, SystemArgument2
)]; // 40 / 72
1122 UCHAR SuspendApcFill5
[FIELD_OFFSET(KAPC
, Inserted
) + 1]; // 47 / 83
1123 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1138 KSEMAPHORE SuspendSemaphore
;
1141 UCHAR SuspendSemaphorefill
[FIELD_OFFSET(KSEMAPHORE
, Limit
) + 4]; // 20 / 28
1143 ULONG SListFaultCount
;
1148 ULONG SListFaultCount
;
1150 LIST_ENTRY ThreadListEntry
;
1151 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1152 LIST_ENTRY MutantListHead
;
1154 PVOID SListFaultAddress
;
1155 #ifdef _M_AMD64 // [
1156 LONG64 ReadOperationCount
;
1157 LONG64 WriteOperationCount
;
1158 LONG64 OtherOperationCount
;
1159 LONG64 ReadTransferCount
;
1160 LONG64 WriteTransferCount
;
1161 LONG64 OtherTransferCount
;
1163 #if (NTDDI_VERSION >= NTDDI_WIN7) // [
1164 PKTHREAD_COUNTERS ThreadCounters
;
1165 PXSTATE_SAVE XStateSave
;
1166 #elif (NTDDI_VERSION >= NTDDI_LONGHORN) // ][
1167 PVOID MdlForLockedTeb
;
1171 #define ASSERT_THREAD(object) \
1172 ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == ThreadObject))
1175 // Kernel Process (KPROCESS)
1177 typedef struct _KPROCESS
1179 DISPATCHER_HEADER Header
;
1180 LIST_ENTRY ProfileListHead
;
1181 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1182 ULONG_PTR DirectoryTableBase
;
1185 ULONG_PTR DirectoryTableBase
[2];
1187 #if defined(_M_IX86)
1188 KGDTENTRY LdtDescriptor
;
1189 KIDTENTRY Int21Descriptor
;
1192 #if defined(_M_IX86)
1196 volatile ULONG ActiveProcessors
;
1199 LIST_ENTRY ReadyListHead
;
1200 SINGLE_LIST_ENTRY SwapListEntry
;
1201 PVOID VdmTrapcHandler
;
1202 LIST_ENTRY ThreadListHead
;
1203 KSPIN_LOCK ProcessLock
;
1209 LONG AutoAlignment
:1;
1210 LONG DisableBoost
:1;
1211 LONG DisableQuantum
:1;
1212 LONG ReservedFlags
:29;
1225 KEXECUTE_OPTIONS Flags
;
1226 UCHAR ExecuteOptions
;
1229 LIST_ENTRY ProcessListEntry
;
1230 #if (NTDDI_VERSION >= NTDDI_LONGHORN) // [
1231 ULONGLONG CycleTime
;
1235 #define ASSERT_PROCESS(object) \
1236 ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == ProcessObject))
1239 // System Service Table Descriptor
1241 typedef struct _KSERVICE_TABLE_DESCRIPTOR
1247 LONG TableBaseGpOffset
;
1250 } KSERVICE_TABLE_DESCRIPTOR
, *PKSERVICE_TABLE_DESCRIPTOR
;
1253 // Exported Loader Parameter Block
1255 extern struct _LOADER_PARAMETER_BLOCK NTSYSAPI
*KeLoaderBlock
;
1258 // Exported Hardware Data
1260 extern KAFFINITY NTSYSAPI KeActiveProcessors
;
1261 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1262 extern volatile CCHAR NTSYSAPI KeNumberProcessors
;
1264 #if (NTDDI_VERSION >= NTDDI_WINXP)
1265 extern CCHAR NTSYSAPI KeNumberProcessors
;
1267 //extern PCCHAR KeNumberProcessors;
1268 extern NTSYSAPI CCHAR KeNumberProcessors
; //FIXME: Note to Alex: I won't fix this atm, since I prefer to discuss this with you first.
1271 extern ULONG NTSYSAPI KiDmaIoCoherency
;
1272 extern ULONG NTSYSAPI KeMaximumIncrement
;
1273 extern ULONG NTSYSAPI KeMinimumIncrement
;
1274 extern ULONG NTSYSAPI KeDcacheFlushCount
;
1275 extern ULONG NTSYSAPI KeIcacheFlushCount
;
1276 extern ULONG_PTR NTSYSAPI KiBugCheckData
[];
1277 extern BOOLEAN NTSYSAPI KiEnableTimerWatchdog
;
1280 // Exported System Service Descriptor Tables
1282 extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTable
[SSDT_MAX_ENTRIES
];
1283 extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTableShadow
[SSDT_MAX_ENTRIES
];
1285 #endif // !NTOS_MODE_USER
1287 #endif // _KETYPES_H