2006-05-10 17:47:44 +00:00
|
|
|
/*++ NDK Version: 0098
|
2005-11-22 04:57:45 +00:00
|
|
|
|
|
|
|
Copyright (c) Alex Ionescu. All rights reserved.
|
|
|
|
|
|
|
|
Header Name:
|
|
|
|
|
|
|
|
lpctypes.h
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
|
|
|
|
Type definitions for the Loader.
|
|
|
|
|
|
|
|
Author:
|
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
|
2005-11-22 04:57:45 +00:00
|
|
|
|
|
|
|
--*/
|
|
|
|
|
2005-06-18 23:33:40 +00:00
|
|
|
#ifndef _KETYPES_H
|
|
|
|
#define _KETYPES_H
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Dependencies
|
|
|
|
//
|
2005-11-25 00:17:40 +00:00
|
|
|
#include <umtypes.h>
|
2005-08-17 07:06:59 +00:00
|
|
|
#ifndef NTOS_MODE_USER
|
2005-11-25 00:17:40 +00:00
|
|
|
#include <haltypes.h>
|
|
|
|
#include <potypes.h>
|
|
|
|
#include <ifssupp.h>
|
2005-08-17 07:06:59 +00:00
|
|
|
#endif
|
2005-07-05 21:03:46 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Context Record Flags
|
|
|
|
//
|
|
|
|
#define CONTEXT_DEBUGGER (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
|
|
|
|
|
|
|
|
//
|
|
|
|
// Maximum System Descriptor Table Entries
|
|
|
|
//
|
2006-05-10 17:47:44 +00:00
|
|
|
#define SSDT_MAX_ENTRIES 2
|
2005-08-17 07:06:59 +00:00
|
|
|
|
2007-01-18 06:23:14 +00:00
|
|
|
//
|
|
|
|
// Processor Architectures
|
|
|
|
//
|
|
|
|
#define PROCESSOR_ARCHITECTURE_INTEL 0
|
2009-07-12 10:48:23 +00:00
|
|
|
#define PROCESSOR_ARCHITECTURE_MIPS 1
|
|
|
|
#define PROCESSOR_ARCHITECTURE_ALPHA 2
|
|
|
|
#define PROCESSOR_ARCHITECTURE_PPC 3
|
|
|
|
#define PROCESSOR_ARCHITECTURE_SHX 4
|
|
|
|
#define PROCESSOR_ARCHITECTURE_ARM 5
|
|
|
|
#define PROCESSOR_ARCHITECTURE_IA64 6
|
|
|
|
#define PROCESSOR_ARCHITECTURE_ALPHA64 7
|
|
|
|
#define PROCESSOR_ARCHITECTURE_MSIL 8
|
|
|
|
#define PROCESSOR_ARCHITECTURE_AMD64 9
|
|
|
|
#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
|
2007-01-18 06:23:14 +00:00
|
|
|
|
2006-07-11 15:36:44 +00:00
|
|
|
//
|
|
|
|
// Object Type Mask for Kernel Dispatcher Objects
|
|
|
|
//
|
|
|
|
#define KOBJECT_TYPE_MASK 0x7F
|
2006-09-14 05:53:51 +00:00
|
|
|
#define KOBJECT_LOCK_BIT 0x80
|
2006-07-11 15:36:44 +00:00
|
|
|
|
2006-01-10 21:36:42 +00:00
|
|
|
//
|
2006-05-10 17:47:44 +00:00
|
|
|
// Dispatcher Priority increments
|
2006-01-10 21:36:42 +00:00
|
|
|
//
|
2006-05-10 17:47:44 +00:00
|
|
|
#define THREAD_ALERT_INCREMENT 2
|
2006-01-10 21:36:42 +00:00
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
//
|
|
|
|
// Physical memory offset of KUSER_SHARED_DATA
|
|
|
|
//
|
|
|
|
#define KI_USER_SHARED_DATA_PHYSICAL 0x41000
|
|
|
|
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
//
|
|
|
|
// Quantum values and decrements
|
|
|
|
//
|
|
|
|
#define MAX_QUANTUM 0x7F
|
|
|
|
#define WAIT_QUANTUM_DECREMENT 1
|
|
|
|
#define CLOCK_QUANTUM_DECREMENT 3
|
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
//
|
|
|
|
// Kernel Feature Bits
|
|
|
|
//
|
2006-09-01 03:05:30 +00:00
|
|
|
#define KF_V86_VIS 0x00000001
|
2006-05-10 17:47:44 +00:00
|
|
|
#define KF_RDTSC 0x00000002
|
2006-09-01 03:05:30 +00:00
|
|
|
#define KF_CR4 0x00000004
|
|
|
|
#define KF_CMOV 0x00000008
|
|
|
|
#define KF_GLOBAL_PAGE 0x00000010
|
|
|
|
#define KF_LARGE_PAGE 0x00000020
|
|
|
|
#define KF_MTRR 0x00000040
|
|
|
|
#define KF_CMPXCHG8B 0x00000080
|
|
|
|
#define KF_MMX 0x00000100
|
|
|
|
#define KF_WORKING_PTE 0x00000200
|
|
|
|
#define KF_PAT 0x00000400
|
|
|
|
#define KF_FXSR 0x00000800
|
|
|
|
#define KF_FAST_SYSCALL 0x00001000
|
|
|
|
#define KF_XMMI 0x00002000
|
|
|
|
#define KF_3DNOW 0x00004000
|
|
|
|
#define KF_AMDK6MTRR 0x00008000
|
2006-10-04 05:29:30 +00:00
|
|
|
#define KF_XMMI64 0x00010000
|
2007-01-18 06:23:14 +00:00
|
|
|
#define KF_DTS 0x00020000
|
|
|
|
#define KF_NX_BIT 0x20000000
|
|
|
|
#define KF_NX_DISABLED 0x40000000
|
|
|
|
#define KF_NX_ENABLED 0x80000000
|
2006-05-10 17:47:44 +00:00
|
|
|
|
- Fix KiDispatchException to unmask KI_EXCEPTION_INTERNAL when setting the exception code, so that usermode/SEH filters get proper exception codes again.
- Fixes and compatible merges from KD Branch:
- Add stubs for KdSave, KdRestore, KdDebuggerInitialize0, KdSendPacket, KdReceivePacket to kdcom.dll
- Implement and export KeTryToAcquireSpinLockAtDpcLevel.
- Add EXCEPTION_RECORD64 and LIST_ENTRY64, KeTryToAcquireSpinLockAtDpcLevel, BREAKPOINT_COMMAND_STRING, Ke386SetCr2, Ke386SetDr3, Ke386SetDr6.
- Remove non-kernel routines from kdfuncs.h and remove deprecated routines from ke.h.
- Implement KiRestoreProcessorControlState, KeFreezeExecution, KeThawExecution, ExAcquireTimeRefreshLock, ExReleaseTimeRefreshLock.
- Rename ModuleLoadList to PsLoadedModuleList. Add PsNtosImageBase and set value in it.
- Add skeleton wdbgexts.h with what's needed until now, this is a PSDK header.
- Add kddll.h for KDCOM/1394/USB2.DLL prototypes.
- Add windbgkd.h with KD protocol definitions. Used to be an NT5 DDK header, but was removed, so this goes into include\reactos.
- Fix KiDebugService to load EDX from KTRAP_FRAME_EDX, not KTRAP_FRAME_EAX!.
- Fix CommonDispatchException to check for the argument count in ECX, not EAX. Previously we were ignoring parameter counts and never filling out exception records!
- Add KdDebuggerInitialize1 and enable call to it.
- Fix KD_SYMBOLS_INFO definition and DbgLoadImageSymbols prototype.
- Implement DbgUnLoadImageSymbols.
- Fix some small bugs in KeBugCheckWithTf and add various debugger calls/checks where needed.
- Fix bugcheck recursion code which was incorrect.
- Only save/restore CR4 if KeFeatureBits indicates CR4 support exists.
- Export KdDebuggerNotPresent since KDCOM needs it.
- Add KCONTINUE_STATUS.
- Add DBGKD_ANY_CONTROL_SET and X86/IA64/AMD64 control sets.
- Add DBGKD_MANIPULATE_STATE64 and all sub-structures (READ_MEMORY, WRITE_MEMORY, etc).
- Create GCC_ULONG64 type to hack around a bug in GCC which is incapable of creating entries for externals at compile-time for 64-bit pointers.
- Rename NameSpaceRoot to ObpRootDirectoryObject, IopLogListHead to IopErrorLogListHead, BugcheckCallbackListHead to KeBugcheckCallbackListHead, BugcheckReasonCallbackListHead to KeBugcheckReasonCallbackListHead, ObTypeObjectType to ObpTypeObjectType.
- Create ntverp.h and common.ver files. These are the standard files used by the NT/DDK build systems and we should try to support them as well instead of re-defining everything our own way (especially if we want to build ddk-compatible drivers later on).
- Made init.c use version data from ntverp.h instead of hard-coding.
- Defined NT 5.2.3790.1830 as the version we report.
- Fixed up .rc file to be correct and match DDK-sytnax/style.
- For now only the kernel uses this new versionning scheme, but we should change the build system later to use this for every component.
- Fix KiSaveProcessorControlState and KiRestoreProcessorControlSate. The latter doesn't freeze the CPU anymore so it's enabled, and the former doesn't cause WinDBG to panic anymore and display weird data.
- KPROCESSOR_STATE is not 4-byte aligned.
- Use DR_MASK and DR7_OVERRIDE_V in KiUpdateDr7, KiRecordDr7 instead of DR_ACTIVE_MASK.
- Add ExceptionRecord32To64.
- Fix generation of driver name for symbol load.
svn path=/trunk/; revision=25937
2007-03-01 19:51:20 +00:00
|
|
|
//
|
|
|
|
// Internal Exception Codes
|
|
|
|
//
|
|
|
|
#define KI_EXCEPTION_INTERNAL 0x10000000
|
|
|
|
#define KI_EXCEPTION_ACCESS_VIOLATION (KI_EXCEPTION_INTERNAL | 0x04)
|
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
//
|
|
|
|
// Number of dispatch codes supported by KINTERRUPT
|
|
|
|
//
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
#define KINTERRUPT_DISPATCH_CODES 135
|
|
|
|
#else
|
|
|
|
#define KINTERRUPT_DISPATCH_CODES 106
|
|
|
|
#endif
|
2006-01-10 21:36:42 +00:00
|
|
|
|
2005-08-17 07:06:59 +00:00
|
|
|
#ifdef NTOS_MODE_USER
|
2005-06-19 07:03:18 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// KPROCESSOR_MODE Type
|
|
|
|
//
|
|
|
|
typedef CCHAR KPROCESSOR_MODE;
|
2005-06-18 23:33:40 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Dereferencable pointer to KUSER_SHARED_DATA in User-Mode
|
|
|
|
//
|
|
|
|
#define SharedUserData ((KUSER_SHARED_DATA *CONST)USER_SHARED_DATA)
|
|
|
|
|
|
|
|
//
|
|
|
|
// Maximum WOW64 Entries in KUSER_SHARED_DATA
|
|
|
|
//
|
|
|
|
#define MAX_WOW64_SHARED_ENTRIES 16
|
|
|
|
|
|
|
|
//
|
|
|
|
// Maximum Processor Features supported in KUSER_SHARED_DATA
|
|
|
|
//
|
|
|
|
#define PROCESSOR_FEATURE_MAX 64
|
|
|
|
|
|
|
|
//
|
|
|
|
// Event Types
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef enum _EVENT_TYPE
|
|
|
|
{
|
|
|
|
NotificationEvent,
|
|
|
|
SynchronizationEvent
|
|
|
|
} EVENT_TYPE;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Timer Types
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef enum _TIMER_TYPE
|
|
|
|
{
|
|
|
|
NotificationTimer,
|
|
|
|
SynchronizationTimer
|
|
|
|
} TIMER_TYPE;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Wait Types
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef enum _WAIT_TYPE
|
|
|
|
{
|
|
|
|
WaitAll,
|
|
|
|
WaitAny
|
|
|
|
} WAIT_TYPE;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Processor Execution Modes
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef enum _MODE
|
|
|
|
{
|
|
|
|
KernelMode,
|
|
|
|
UserMode,
|
|
|
|
MaximumMode
|
|
|
|
} MODE;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Wait Reasons
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef enum _KWAIT_REASON
|
|
|
|
{
|
|
|
|
Executive,
|
|
|
|
FreePage,
|
|
|
|
PageIn,
|
|
|
|
PoolAllocation,
|
|
|
|
DelayExecution,
|
|
|
|
Suspended,
|
|
|
|
UserRequest,
|
|
|
|
WrExecutive,
|
|
|
|
WrFreePage,
|
|
|
|
WrPageIn,
|
|
|
|
WrPoolAllocation,
|
|
|
|
WrDelayExecution,
|
|
|
|
WrSuspended,
|
|
|
|
WrUserRequest,
|
|
|
|
WrEventPair,
|
|
|
|
WrQueue,
|
|
|
|
WrLpcReceive,
|
|
|
|
WrLpcReply,
|
|
|
|
WrVirtualMemory,
|
|
|
|
WrPageOut,
|
|
|
|
WrRendezvous,
|
|
|
|
Spare2,
|
|
|
|
WrGuardedMutex,
|
|
|
|
Spare4,
|
|
|
|
Spare5,
|
|
|
|
Spare6,
|
|
|
|
WrKernel,
|
|
|
|
WrResource,
|
|
|
|
WrPushLock,
|
|
|
|
WrMutex,
|
|
|
|
WrQuantumEnd,
|
|
|
|
WrDispatchInt,
|
|
|
|
WrPreempted,
|
|
|
|
WrYieldExecution,
|
|
|
|
MaximumWaitReason
|
|
|
|
} KWAIT_REASON;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Profiling Sources
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef enum _KPROFILE_SOURCE
|
|
|
|
{
|
|
|
|
ProfileTime,
|
|
|
|
ProfileAlignmentFixup,
|
|
|
|
ProfileTotalIssues,
|
|
|
|
ProfilePipelineDry,
|
|
|
|
ProfileLoadInstructions,
|
|
|
|
ProfilePipelineFrozen,
|
|
|
|
ProfileBranchInstructions,
|
|
|
|
ProfileTotalNonissues,
|
|
|
|
ProfileDcacheMisses,
|
|
|
|
ProfileIcacheMisses,
|
|
|
|
ProfileCacheMisses,
|
|
|
|
ProfileBranchMispredictions,
|
|
|
|
ProfileStoreInstructions,
|
|
|
|
ProfileFpInstructions,
|
|
|
|
ProfileIntegerInstructions,
|
|
|
|
Profile2Issue,
|
|
|
|
Profile3Issue,
|
|
|
|
Profile4Issue,
|
|
|
|
ProfileSpecialInstructions,
|
|
|
|
ProfileTotalCycles,
|
|
|
|
ProfileIcacheIssues,
|
|
|
|
ProfileDcacheAccesses,
|
|
|
|
ProfileMemoryBarrierCycles,
|
|
|
|
ProfileLoadLinkedIssues,
|
|
|
|
ProfileMaximum
|
|
|
|
} KPROFILE_SOURCE;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// NT Product and Architecture Types
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef enum _NT_PRODUCT_TYPE
|
|
|
|
{
|
|
|
|
NtProductWinNt = 1,
|
|
|
|
NtProductLanManNt,
|
|
|
|
NtProductServer
|
|
|
|
} NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
|
|
|
|
|
|
|
|
typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
|
|
|
|
{
|
|
|
|
StandardDesign,
|
|
|
|
NEC98x86,
|
|
|
|
EndAlternatives
|
|
|
|
} ALTERNATIVE_ARCHITECTURE_TYPE;
|
2005-11-22 04:57:45 +00:00
|
|
|
|
2005-08-17 07:06:59 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Thread States
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef enum _KTHREAD_STATE
|
|
|
|
{
|
|
|
|
Initialized,
|
|
|
|
Ready,
|
|
|
|
Running,
|
|
|
|
Standby,
|
|
|
|
Terminated,
|
|
|
|
Waiting,
|
|
|
|
Transition,
|
|
|
|
DeferredReady,
|
2006-07-11 15:36:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_WS03)
|
2008-01-16 23:19:01 +00:00
|
|
|
GateWait
|
2006-05-10 17:47:44 +00:00
|
|
|
#endif
|
2005-08-17 07:06:59 +00:00
|
|
|
} KTHREAD_STATE, *PKTHREAD_STATE;
|
|
|
|
|
2008-01-16 23:19:01 +00:00
|
|
|
//
|
|
|
|
// Kernel Object Types
|
|
|
|
//
|
|
|
|
typedef enum _KOBJECTS
|
|
|
|
{
|
|
|
|
EventNotificationObject = 0,
|
|
|
|
EventSynchronizationObject = 1,
|
|
|
|
MutantObject = 2,
|
|
|
|
ProcessObject = 3,
|
|
|
|
QueueObject = 4,
|
|
|
|
SemaphoreObject = 5,
|
|
|
|
ThreadObject = 6,
|
|
|
|
GateObject = 7,
|
|
|
|
TimerNotificationObject = 8,
|
|
|
|
TimerSynchronizationObject = 9,
|
|
|
|
Spare2Object = 10,
|
|
|
|
Spare3Object = 11,
|
|
|
|
Spare4Object = 12,
|
|
|
|
Spare5Object = 13,
|
|
|
|
Spare6Object = 14,
|
|
|
|
Spare7Object = 15,
|
|
|
|
Spare8Object = 16,
|
|
|
|
Spare9Object = 17,
|
|
|
|
ApcObject = 18,
|
|
|
|
DpcObject = 19,
|
|
|
|
DeviceQueueObject = 20,
|
|
|
|
EventPairObject = 21,
|
|
|
|
InterruptObject = 22,
|
|
|
|
ProfileObject = 23,
|
|
|
|
ThreadedDpcObject = 24,
|
|
|
|
MaximumKernelObject = 25
|
|
|
|
} KOBJECTS;
|
|
|
|
|
2007-01-16 02:24:19 +00:00
|
|
|
//
|
|
|
|
// Adjust reasons
|
|
|
|
//
|
|
|
|
typedef enum _ADJUST_REASON
|
|
|
|
{
|
|
|
|
AdjustNone = 0,
|
|
|
|
AdjustUnwait = 1,
|
|
|
|
AdjustBoost = 2
|
|
|
|
} ADJUST_REASON;
|
|
|
|
|
2007-02-19 15:02:39 +00:00
|
|
|
//
|
|
|
|
// Continue Status
|
|
|
|
//
|
|
|
|
typedef enum _KCONTINUE_STATUS
|
|
|
|
{
|
|
|
|
ContinueError = 0,
|
|
|
|
ContinueSuccess,
|
|
|
|
ContinueProcessorReselected,
|
|
|
|
ContinueNextProcessor
|
|
|
|
} KCONTINUE_STATUS;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Process States
|
|
|
|
//
|
2005-09-13 23:28:21 +00:00
|
|
|
typedef enum _KPROCESS_STATE
|
|
|
|
{
|
|
|
|
ProcessInMemory,
|
|
|
|
ProcessOutOfMemory,
|
|
|
|
ProcessInTransition,
|
2006-05-10 17:47:44 +00:00
|
|
|
ProcessInSwap,
|
|
|
|
ProcessOutSwap,
|
2005-09-13 23:28:21 +00:00
|
|
|
} KPROCESS_STATE, *PKPROCESS_STATE;
|
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
//
|
|
|
|
// NtVdmControl Classes
|
|
|
|
//
|
|
|
|
typedef enum _VDMSERVICECLASS
|
|
|
|
{
|
|
|
|
VdmStartExecution = 0,
|
|
|
|
VdmQueueInterrupt = 1,
|
|
|
|
VdmDelayInterrupt = 2,
|
|
|
|
VdmInitialize = 3,
|
|
|
|
VdmFeatures = 4,
|
|
|
|
VdmSetInt21Handler = 5,
|
|
|
|
VdmQueryDir = 6,
|
|
|
|
VdmPrinterDirectIoOpen = 7,
|
|
|
|
VdmPrinterDirectIoClose = 8,
|
|
|
|
VdmPrinterInitialize = 9,
|
|
|
|
VdmSetLdtEntries = 10,
|
|
|
|
VdmSetProcessLdtInfo = 11,
|
|
|
|
VdmAdlibEmulation = 12,
|
|
|
|
VdmPMCliControl = 13,
|
|
|
|
VdmQueryVdmProcess = 14,
|
|
|
|
} VDMSERVICECLASS;
|
|
|
|
|
2005-09-05 04:48:20 +00:00
|
|
|
#ifdef NTOS_MODE_USER
|
2005-11-22 04:57:45 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// APC Normal Routine
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef VOID
|
|
|
|
(NTAPI *PKNORMAL_ROUTINE)(
|
2005-11-22 04:57:45 +00:00
|
|
|
IN PVOID NormalContext,
|
|
|
|
IN PVOID SystemArgument1,
|
|
|
|
IN PVOID SystemArgument2
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Timer Routine
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef VOID
|
|
|
|
(NTAPI *PTIMER_APC_ROUTINE)(
|
2005-11-22 04:57:45 +00:00
|
|
|
IN PVOID TimerContext,
|
|
|
|
IN ULONG TimerLowValue,
|
|
|
|
IN LONG TimerHighValue
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// System Time Structure
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef struct _KSYSTEM_TIME
|
|
|
|
{
|
|
|
|
ULONG LowPart;
|
|
|
|
LONG High1Time;
|
|
|
|
LONG High2Time;
|
|
|
|
} KSYSTEM_TIME, *PKSYSTEM_TIME;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Shared Kernel User Data
|
|
|
|
//
|
2005-08-17 07:06:59 +00:00
|
|
|
typedef struct _KUSER_SHARED_DATA
|
|
|
|
{
|
|
|
|
ULONG TickCountLowDeprecated;
|
|
|
|
ULONG TickCountMultiplier;
|
|
|
|
volatile KSYSTEM_TIME InterruptTime;
|
|
|
|
volatile KSYSTEM_TIME SystemTime;
|
|
|
|
volatile KSYSTEM_TIME TimeZoneBias;
|
|
|
|
USHORT ImageNumberLow;
|
|
|
|
USHORT ImageNumberHigh;
|
|
|
|
WCHAR NtSystemRoot[260];
|
|
|
|
ULONG MaxStackTraceDepth;
|
|
|
|
ULONG CryptoExponent;
|
|
|
|
ULONG TimeZoneId;
|
|
|
|
ULONG LargePageMinimum;
|
|
|
|
ULONG Reserved2[7];
|
|
|
|
NT_PRODUCT_TYPE NtProductType;
|
|
|
|
BOOLEAN ProductTypeIsValid;
|
|
|
|
ULONG NtMajorVersion;
|
|
|
|
ULONG NtMinorVersion;
|
|
|
|
BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
|
|
|
|
ULONG Reserved1;
|
|
|
|
ULONG Reserved3;
|
|
|
|
volatile ULONG TimeSlip;
|
|
|
|
ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
|
|
|
|
LARGE_INTEGER SystemExpirationDate;
|
|
|
|
ULONG SuiteMask;
|
|
|
|
BOOLEAN KdDebuggerEnabled;
|
2006-05-10 17:47:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_WINXPSP2)
|
|
|
|
UCHAR NXSupportPolicy;
|
|
|
|
#endif
|
2005-08-17 07:06:59 +00:00
|
|
|
volatile ULONG ActiveConsoleId;
|
|
|
|
volatile ULONG DismountCount;
|
|
|
|
ULONG ComPlusPackage;
|
|
|
|
ULONG LastSystemRITEventTickCount;
|
|
|
|
ULONG NumberOfPhysicalPages;
|
|
|
|
BOOLEAN SafeBootMode;
|
|
|
|
ULONG TraceLogging;
|
2005-11-08 08:56:41 +00:00
|
|
|
ULONG Fill0;
|
|
|
|
ULONGLONG TestRetInstruction;
|
|
|
|
ULONG SystemCall;
|
|
|
|
ULONG SystemCallReturn;
|
|
|
|
ULONGLONG SystemCallPad[3];
|
2005-08-17 07:06:59 +00:00
|
|
|
union {
|
|
|
|
volatile KSYSTEM_TIME TickCount;
|
|
|
|
volatile ULONG64 TickCountQuad;
|
|
|
|
};
|
2005-11-08 08:56:41 +00:00
|
|
|
ULONG Cookie;
|
2006-05-10 17:47:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_WS03)
|
2005-11-08 08:56:41 +00:00
|
|
|
LONGLONG ConsoleSessionForegroundProcessId;
|
|
|
|
ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
|
2006-05-10 17:47:44 +00:00
|
|
|
#endif
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
USHORT UserModeGlobalLogger[8];
|
|
|
|
ULONG HeapTracingPid[2];
|
|
|
|
ULONG CritSecTracingPid[2];
|
|
|
|
union
|
|
|
|
{
|
|
|
|
ULONG SharedDataFlags;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
ULONG DbgErrorPortPresent:1;
|
|
|
|
ULONG DbgElevationEnabled:1;
|
|
|
|
ULONG DbgVirtEnabled:1;
|
|
|
|
ULONG DbgInstallerDetectEnabled:1;
|
|
|
|
ULONG SpareBits:28;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
ULONG ImageFileExecutionOptions;
|
|
|
|
KAFFINITY ActiveProcessorAffinity;
|
|
|
|
#endif
|
2005-08-17 07:06:59 +00:00
|
|
|
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
|
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
//
|
|
|
|
// VDM Structures
|
|
|
|
//
|
|
|
|
#include "pshpack1.h"
|
|
|
|
typedef struct _VdmVirtualIca
|
|
|
|
{
|
|
|
|
LONG ica_count[8];
|
|
|
|
LONG ica_int_line;
|
|
|
|
LONG ica_cpu_int;
|
|
|
|
USHORT ica_base;
|
|
|
|
USHORT ica_hipiri;
|
|
|
|
USHORT ica_mode;
|
|
|
|
UCHAR ica_master;
|
|
|
|
UCHAR ica_irr;
|
|
|
|
UCHAR ica_isr;
|
|
|
|
UCHAR ica_imr;
|
|
|
|
UCHAR ica_ssr;
|
|
|
|
} VDMVIRTUALICA, *PVDMVIRTUALICA;
|
|
|
|
#include "poppack.h"
|
|
|
|
|
|
|
|
typedef struct _VdmIcaUserData
|
|
|
|
{
|
|
|
|
PVOID pIcaLock;
|
|
|
|
PVDMVIRTUALICA pIcaMaster;
|
|
|
|
PVDMVIRTUALICA pIcaSlave;
|
|
|
|
PULONG pDelayIrq;
|
|
|
|
PULONG pUndelayIrq;
|
|
|
|
PULONG pDelayIret;
|
|
|
|
PULONG pIretHooked;
|
|
|
|
PULONG pAddrIretBopTable;
|
|
|
|
PHANDLE phWowIdleEvent;
|
|
|
|
PLARGE_INTEGER pIcaTimeout;
|
|
|
|
PHANDLE phMainThreadSuspended;
|
|
|
|
} VDMICAUSERDATA, *PVDMICAUSERDATA;
|
|
|
|
|
|
|
|
typedef struct _VDM_INITIALIZE_DATA
|
|
|
|
{
|
|
|
|
PVOID TrapcHandler;
|
|
|
|
PVDMICAUSERDATA IcaUserData;
|
|
|
|
} VDM_INITIALIZE_DATA, *PVDM_INITIALIZE_DATA;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
#else
|
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
//
|
|
|
|
// System Thread Start Routine
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
VOID
|
|
|
|
(NTAPI *PKSYSTEM_ROUTINE)(
|
|
|
|
PKSTART_ROUTINE StartRoutine,
|
|
|
|
PVOID StartContext
|
|
|
|
);
|
|
|
|
|
2005-11-26 22:51:59 +00:00
|
|
|
//
|
|
|
|
// APC Environment Types
|
|
|
|
//
|
|
|
|
typedef enum _KAPC_ENVIRONMENT
|
|
|
|
{
|
|
|
|
OriginalApcEnvironment,
|
|
|
|
AttachedApcEnvironment,
|
2006-09-11 02:28:09 +00:00
|
|
|
CurrentApcEnvironment,
|
|
|
|
InsertApcEnvironment
|
2005-11-26 22:51:59 +00:00
|
|
|
} KAPC_ENVIRONMENT;
|
|
|
|
|
2008-12-01 15:12:23 +00:00
|
|
|
//
|
|
|
|
// CPU Cache Types
|
|
|
|
//
|
|
|
|
typedef enum _PROCESSOR_CACHE_TYPE
|
|
|
|
{
|
|
|
|
CacheUnified,
|
|
|
|
CacheInstruction,
|
|
|
|
CacheData,
|
|
|
|
CacheTrace,
|
|
|
|
} PROCESSOR_CACHE_TYPE;
|
|
|
|
|
2005-11-26 22:51:59 +00:00
|
|
|
//
|
|
|
|
// PRCB DPC Data
|
|
|
|
//
|
|
|
|
typedef struct _KDPC_DATA
|
|
|
|
{
|
|
|
|
LIST_ENTRY DpcListHead;
|
2008-08-25 14:51:22 +00:00
|
|
|
ULONG_PTR DpcLock;
|
2006-09-02 16:19:00 +00:00
|
|
|
volatile ULONG DpcQueueDepth;
|
2005-11-26 22:51:59 +00:00
|
|
|
ULONG DpcCount;
|
|
|
|
} KDPC_DATA, *PKDPC_DATA;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Per-Processor Lookaside List
|
|
|
|
//
|
|
|
|
typedef struct _PP_LOOKASIDE_LIST
|
|
|
|
{
|
|
|
|
struct _GENERAL_LOOKASIDE *P;
|
|
|
|
struct _GENERAL_LOOKASIDE *L;
|
|
|
|
} PP_LOOKASIDE_LIST, *PPP_LOOKASIDE_LIST;
|
|
|
|
|
2008-12-01 15:12:23 +00:00
|
|
|
//
|
|
|
|
// CPU Cache Descriptor
|
|
|
|
//
|
|
|
|
typedef struct _CACHE_DESCRIPTOR
|
|
|
|
{
|
|
|
|
UCHAR Level;
|
|
|
|
UCHAR Associativity;
|
|
|
|
USHORT LineSize;
|
|
|
|
ULONG Size;
|
|
|
|
PROCESSOR_CACHE_TYPE Type;
|
|
|
|
} CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
|
|
|
|
|
2005-11-26 22:51:59 +00:00
|
|
|
//
|
|
|
|
// Architectural Types
|
|
|
|
//
|
|
|
|
#include <arch/ketypes.h>
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
2005-11-27 19:21:19 +00:00
|
|
|
// Kernel Memory Node
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
2006-05-10 17:47:44 +00:00
|
|
|
#include <pshpack1.h>
|
2005-06-25 17:01:17 +00:00
|
|
|
typedef struct _KNODE
|
|
|
|
{
|
2005-11-22 04:57:45 +00:00
|
|
|
SLIST_HEADER DeadStackList;
|
|
|
|
SLIST_HEADER PfnDereferenceSListHead;
|
2006-05-10 17:47:44 +00:00
|
|
|
KAFFINITY ProcessorMask;
|
2005-11-22 04:57:45 +00:00
|
|
|
ULONG Color;
|
|
|
|
UCHAR Seed;
|
|
|
|
UCHAR NodeNumber;
|
|
|
|
ULONG Flags;
|
|
|
|
ULONG MmShiftedColor;
|
|
|
|
ULONG FreeCount[2];
|
|
|
|
struct _SINGLE_LIST_ENTRY *PfnDeferredList;
|
2005-06-25 17:01:17 +00:00
|
|
|
} KNODE, *PKNODE;
|
2006-05-10 17:47:44 +00:00
|
|
|
#include <poppack.h>
|
2005-06-25 17:01:17 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
2005-11-27 19:21:19 +00:00
|
|
|
// Kernel Profile Object
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
2005-06-25 17:01:17 +00:00
|
|
|
typedef struct _KPROFILE
|
|
|
|
{
|
|
|
|
CSHORT Type;
|
|
|
|
CSHORT Size;
|
2005-11-27 19:21:19 +00:00
|
|
|
LIST_ENTRY ProfileListEntry;
|
2005-11-28 21:40:21 +00:00
|
|
|
struct _KPROCESS *Process;
|
2005-11-27 19:21:19 +00:00
|
|
|
PVOID RangeBase;
|
|
|
|
PVOID RangeLimit;
|
2005-06-25 17:01:17 +00:00
|
|
|
ULONG BucketShift;
|
|
|
|
PVOID Buffer;
|
2009-09-28 18:27:06 +00:00
|
|
|
ULONG_PTR Segment;
|
2005-11-27 19:21:19 +00:00
|
|
|
KAFFINITY Affinity;
|
2005-07-05 22:35:29 +00:00
|
|
|
KPROFILE_SOURCE Source;
|
2005-11-27 19:21:19 +00:00
|
|
|
BOOLEAN Started;
|
2005-06-25 17:01:17 +00:00
|
|
|
} KPROFILE, *PKPROFILE;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
2005-11-27 19:21:19 +00:00
|
|
|
// Kernel Interrupt Object
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
2005-06-26 01:08:55 +00:00
|
|
|
typedef struct _KINTERRUPT
|
2005-06-18 23:33:40 +00:00
|
|
|
{
|
2005-07-05 21:57:55 +00:00
|
|
|
CSHORT Type;
|
|
|
|
CSHORT Size;
|
|
|
|
LIST_ENTRY InterruptListEntry;
|
|
|
|
PKSERVICE_ROUTINE ServiceRoutine;
|
2006-05-10 17:47:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
PKSERVICE_ROUTINE MessageServiceRoutine;
|
|
|
|
ULONG MessageIndex;
|
|
|
|
#endif
|
2005-07-05 21:57:55 +00:00
|
|
|
PVOID ServiceContext;
|
|
|
|
KSPIN_LOCK SpinLock;
|
|
|
|
ULONG TickCount;
|
|
|
|
PKSPIN_LOCK ActualLock;
|
2007-03-19 03:29:29 +00:00
|
|
|
PKINTERRUPT_ROUTINE DispatchAddress;
|
2005-07-05 21:57:55 +00:00
|
|
|
ULONG Vector;
|
|
|
|
KIRQL Irql;
|
|
|
|
KIRQL SynchronizeIrql;
|
|
|
|
BOOLEAN FloatingSave;
|
|
|
|
BOOLEAN Connected;
|
2007-03-19 03:29:29 +00:00
|
|
|
CCHAR Number;
|
|
|
|
BOOLEAN ShareVector;
|
2005-07-05 21:57:55 +00:00
|
|
|
KINTERRUPT_MODE Mode;
|
2006-05-10 17:47:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
KINTERRUPT_POLARITY Polarity;
|
|
|
|
#endif
|
2005-07-05 21:57:55 +00:00
|
|
|
ULONG ServiceCount;
|
|
|
|
ULONG DispatchCount;
|
2006-05-10 17:47:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
ULONGLONG Rsvd1;
|
|
|
|
#endif
|
|
|
|
ULONG DispatchCode[KINTERRUPT_DISPATCH_CODES];
|
2008-12-01 15:12:23 +00:00
|
|
|
} KINTERRUPT;
|
2005-06-18 23:33:40 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Kernel Event Pair Object
|
|
|
|
//
|
2005-06-19 03:25:33 +00:00
|
|
|
typedef struct _KEVENT_PAIR
|
|
|
|
{
|
|
|
|
CSHORT Type;
|
|
|
|
CSHORT Size;
|
|
|
|
KEVENT LowEvent;
|
|
|
|
KEVENT HighEvent;
|
|
|
|
} KEVENT_PAIR, *PKEVENT_PAIR;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Kernel No Execute Options
|
|
|
|
//
|
2005-06-25 17:01:17 +00:00
|
|
|
typedef struct _KEXECUTE_OPTIONS
|
|
|
|
{
|
|
|
|
UCHAR ExecuteDisable:1;
|
|
|
|
UCHAR ExecuteEnable:1;
|
|
|
|
UCHAR DisableThunkEmulation:1;
|
|
|
|
UCHAR Permanent:1;
|
|
|
|
UCHAR ExecuteDispatchEnable:1;
|
|
|
|
UCHAR ImageDispatchEnable:1;
|
|
|
|
UCHAR Spare:2;
|
|
|
|
} KEXECUTE_OPTIONS, *PKEXECUTE_OPTIONS;
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Kernel Thread (KTHREAD)
|
|
|
|
//
|
2005-06-25 17:01:17 +00:00
|
|
|
typedef struct _KTHREAD
|
|
|
|
{
|
2006-05-10 17:47:44 +00:00
|
|
|
DISPATCHER_HEADER DispatcherHeader;
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
ULONGLONG CycleTime;
|
|
|
|
ULONG HighCycleTime;
|
2008-01-16 23:19:01 +00:00
|
|
|
ULONGLONG QuantumTarget;
|
2006-05-10 17:47:44 +00:00
|
|
|
#else
|
|
|
|
LIST_ENTRY MutantListHead;
|
|
|
|
#endif
|
|
|
|
PVOID InitialStack;
|
|
|
|
ULONG_PTR StackLimit;
|
|
|
|
PVOID KernelStack;
|
|
|
|
KSPIN_LOCK ThreadLock;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
KAPC_STATE ApcState;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR ApcStateFill[23];
|
|
|
|
UCHAR ApcQueueable;
|
2007-01-16 02:40:41 +00:00
|
|
|
volatile UCHAR NextProcessor;
|
|
|
|
volatile UCHAR DeferredProcessor;
|
|
|
|
UCHAR AdjustReason;
|
|
|
|
SCHAR AdjustIncrement;
|
2006-05-10 17:47:44 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
KSPIN_LOCK ApcQueueLock;
|
|
|
|
ULONG ContextSwitches;
|
2006-09-02 16:19:00 +00:00
|
|
|
volatile UCHAR State;
|
2006-05-10 17:47:44 +00:00
|
|
|
UCHAR NpxState;
|
2007-01-16 02:40:41 +00:00
|
|
|
KIRQL WaitIrql;
|
|
|
|
KPROCESSOR_MODE WaitMode;
|
|
|
|
LONG_PTR WaitStatus;
|
2006-05-10 17:47:44 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
PKWAIT_BLOCK WaitBlockList;
|
|
|
|
PKGATE GateObject;
|
|
|
|
};
|
2008-01-16 23:19:01 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
ULONG KernelStackResident:1;
|
|
|
|
ULONG ReadyTransition:1;
|
|
|
|
ULONG ProcessReadyQueue:1;
|
|
|
|
ULONG WaitNext:1;
|
|
|
|
ULONG SystemAffinityActive:1;
|
|
|
|
ULONG Alertable:1;
|
|
|
|
ULONG GdiFlushActive:1;
|
|
|
|
ULONG Reserved:25;
|
|
|
|
};
|
|
|
|
LONG MiscFlags;
|
|
|
|
};
|
|
|
|
#else
|
2007-01-16 02:40:41 +00:00
|
|
|
BOOLEAN Alertable;
|
|
|
|
BOOLEAN WaitNext;
|
2008-01-16 23:19:01 +00:00
|
|
|
#endif
|
2006-05-10 17:47:44 +00:00
|
|
|
UCHAR WaitReason;
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
SCHAR Priority;
|
2007-01-16 02:40:41 +00:00
|
|
|
BOOLEAN EnableStackSwap;
|
2006-09-02 16:19:00 +00:00
|
|
|
volatile UCHAR SwapBusy;
|
2007-01-16 02:40:41 +00:00
|
|
|
BOOLEAN Alerted[MaximumMode];
|
2006-05-10 17:47:44 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
LIST_ENTRY WaitListEntry;
|
|
|
|
SINGLE_LIST_ENTRY SwapListEntry;
|
|
|
|
};
|
|
|
|
PKQUEUE Queue;
|
|
|
|
ULONG WaitTime;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2006-07-13 04:20:18 +00:00
|
|
|
SHORT KernelApcDisable;
|
|
|
|
SHORT SpecialApcDisable;
|
2006-05-10 17:47:44 +00:00
|
|
|
};
|
|
|
|
ULONG CombinedApcDisable;
|
|
|
|
};
|
|
|
|
struct _TEB *Teb;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
KTIMER Timer;
|
|
|
|
struct
|
|
|
|
{
|
2007-01-16 02:40:41 +00:00
|
|
|
UCHAR TimerFill[40];
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
LONG AutoAlignment:1;
|
|
|
|
LONG DisableBoost:1;
|
2006-05-10 17:47:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
2007-01-16 02:40:41 +00:00
|
|
|
LONG EtwStackTrace1ApcInserted:1;
|
|
|
|
LONG EtwStackTrace2ApcInserted:1;
|
|
|
|
LONG CycleChargePending:1;
|
|
|
|
LONG ReservedFlags:27;
|
2006-05-10 17:47:44 +00:00
|
|
|
#else
|
2007-01-16 02:40:41 +00:00
|
|
|
LONG ReservedFlags:30;
|
2006-05-10 17:47:44 +00:00
|
|
|
#endif
|
2007-01-16 02:40:41 +00:00
|
|
|
};
|
|
|
|
LONG ThreadFlags;
|
|
|
|
};
|
2006-05-10 17:47:44 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
2007-01-16 02:40:41 +00:00
|
|
|
KWAIT_BLOCK WaitBlock[THREAD_WAIT_OBJECTS + 1];
|
|
|
|
struct
|
2006-05-10 17:47:44 +00:00
|
|
|
{
|
2007-01-16 02:40:41 +00:00
|
|
|
UCHAR WaitBlockFill0[23];
|
2008-01-16 23:19:01 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
UCHAR IdealProcessor;
|
|
|
|
#else
|
2007-01-16 02:40:41 +00:00
|
|
|
BOOLEAN SystemAffinityActive;
|
2008-01-16 23:19:01 +00:00
|
|
|
#endif
|
2007-01-16 02:40:41 +00:00
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR WaitBlockFill1[47];
|
|
|
|
CCHAR PreviousMode;
|
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR WaitBlockFill2[71];
|
|
|
|
UCHAR ResourceIndex;
|
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR WaitBlockFill3[95];
|
|
|
|
UCHAR LargeStack;
|
2006-05-10 17:47:44 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
LIST_ENTRY QueueListEntry;
|
|
|
|
PKTRAP_FRAME TrapFrame;
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
PVOID FirstArgument;
|
|
|
|
#endif
|
|
|
|
PVOID CallbackStack;
|
|
|
|
PVOID ServiceTable;
|
|
|
|
UCHAR ApcStateIndex;
|
2008-01-16 23:19:01 +00:00
|
|
|
#if (NTDDI_VERSION < NTDDI_LONGHORN)
|
2006-05-10 17:47:44 +00:00
|
|
|
UCHAR IdealProcessor;
|
2008-01-16 23:19:01 +00:00
|
|
|
#endif
|
2007-01-16 02:40:41 +00:00
|
|
|
BOOLEAN Preempted;
|
2006-05-10 17:47:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
2007-01-16 02:40:41 +00:00
|
|
|
BOOLEAN CalloutActive;
|
2006-05-10 17:47:44 +00:00
|
|
|
#else
|
2007-01-16 02:40:41 +00:00
|
|
|
BOOLEAN ProcessReadyQueue;
|
|
|
|
BOOLEAN KernelStackResident;
|
2008-01-16 23:19:01 +00:00
|
|
|
#endif
|
2007-01-16 02:40:41 +00:00
|
|
|
SCHAR BasePriority;
|
|
|
|
SCHAR PriorityDecrement;
|
2006-05-10 17:47:44 +00:00
|
|
|
CHAR Saturation;
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
ULONG SystemCallNumber;
|
2008-01-16 23:19:01 +00:00
|
|
|
ULONG Spare2;
|
2006-05-10 17:47:44 +00:00
|
|
|
#endif
|
|
|
|
KAFFINITY UserAffinity;
|
|
|
|
struct _KPROCESS *Process;
|
|
|
|
KAFFINITY Affinity;
|
|
|
|
PKAPC_STATE ApcStatePointer[2];
|
|
|
|
union
|
|
|
|
{
|
|
|
|
KAPC_STATE SavedApcState;
|
2007-01-16 02:40:41 +00:00
|
|
|
struct
|
2006-05-10 17:47:44 +00:00
|
|
|
{
|
|
|
|
UCHAR SavedApcStateFill[23];
|
2007-01-16 02:40:41 +00:00
|
|
|
CCHAR FreezeCount;
|
|
|
|
CCHAR SuspendCount;
|
|
|
|
UCHAR UserIdealProcessor;
|
2006-05-10 17:47:44 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
2007-01-16 02:40:41 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR ReservedBits0:1;
|
|
|
|
UCHAR SegmentsPresent:1;
|
|
|
|
UCHAR Reservedbits1:1;
|
|
|
|
};
|
|
|
|
UCHAR NestedStateFlags;
|
|
|
|
};
|
2006-05-10 17:47:44 +00:00
|
|
|
#else
|
2007-01-16 02:40:41 +00:00
|
|
|
UCHAR CalloutActive;
|
2006-05-10 17:47:44 +00:00
|
|
|
#endif
|
2007-01-16 02:40:41 +00:00
|
|
|
UCHAR Iopl;
|
|
|
|
};
|
|
|
|
};
|
2006-05-10 17:47:44 +00:00
|
|
|
PVOID Win32Thread;
|
|
|
|
PVOID StackBase;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
KAPC SuspendApc;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR SuspendApcFill0[1];
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
SCHAR Quantum;
|
2006-05-10 17:47:44 +00:00
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR SuspendApcFill1[3];
|
|
|
|
UCHAR QuantumReset;
|
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR SuspendApcFill2[4];
|
|
|
|
ULONG KernelTime;
|
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR SuspendApcFill3[36];
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
PKPRCB WaitPrcb;
|
|
|
|
#else
|
|
|
|
PVOID TlsArray;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR SuspendApcFill4[40];
|
|
|
|
PVOID LegoData;
|
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR SuspendApcFill5[47];
|
|
|
|
UCHAR PowerState;
|
2007-01-16 02:40:41 +00:00
|
|
|
ULONG UserTime;
|
2006-05-10 17:47:44 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
|
|
|
KSEMAPHORE SuspendSemaphore;
|
2007-01-16 02:40:41 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR SuspendSemaphorefill[20];
|
|
|
|
ULONG SListFaultCount;
|
|
|
|
};
|
2006-05-10 17:47:44 +00:00
|
|
|
};
|
|
|
|
LIST_ENTRY ThreadListEntry;
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
LIST_ENTRY MutantListHead;
|
|
|
|
#endif
|
|
|
|
PVOID SListFaultAddress;
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
PVOID MdlForLockedteb;
|
|
|
|
#endif
|
2008-12-01 15:12:23 +00:00
|
|
|
} KTHREAD;
|
2005-06-25 17:01:17 +00:00
|
|
|
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
#define ASSERT_THREAD(object) \
|
2006-09-10 16:09:58 +00:00
|
|
|
ASSERT((((object)->DispatcherHeader.Type & KOBJECT_TYPE_MASK) == ThreadObject))
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Kernel Process (KPROCESS)
|
|
|
|
//
|
2005-06-25 17:01:17 +00:00
|
|
|
typedef struct _KPROCESS
|
|
|
|
{
|
2006-05-10 17:47:44 +00:00
|
|
|
DISPATCHER_HEADER Header;
|
|
|
|
LIST_ENTRY ProfileListHead;
|
2007-04-07 05:33:30 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
ULONG DirectoryTableBase;
|
|
|
|
ULONG Unused0;
|
|
|
|
#else
|
2008-08-11 08:40:52 +00:00
|
|
|
ULONG DirectoryTableBase[2];
|
2007-04-07 05:33:30 +00:00
|
|
|
#endif
|
2005-07-05 21:57:55 +00:00
|
|
|
#if defined(_M_IX86)
|
2006-05-10 17:47:44 +00:00
|
|
|
KGDTENTRY LdtDescriptor;
|
|
|
|
KIDTENTRY Int21Descriptor;
|
|
|
|
USHORT IopmOffset;
|
|
|
|
UCHAR Iopl;
|
|
|
|
UCHAR Unused;
|
2005-07-05 21:57:55 +00:00
|
|
|
#endif
|
2006-09-02 16:19:00 +00:00
|
|
|
volatile ULONG ActiveProcessors;
|
2006-05-10 17:47:44 +00:00
|
|
|
ULONG KernelTime;
|
|
|
|
ULONG UserTime;
|
|
|
|
LIST_ENTRY ReadyListHead;
|
|
|
|
SINGLE_LIST_ENTRY SwapListEntry;
|
|
|
|
PVOID VdmTrapcHandler;
|
|
|
|
LIST_ENTRY ThreadListHead;
|
|
|
|
KSPIN_LOCK ProcessLock;
|
|
|
|
KAFFINITY Affinity;
|
2005-06-26 01:08:55 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2006-09-10 23:17:22 +00:00
|
|
|
LONG AutoAlignment:1;
|
|
|
|
LONG DisableBoost:1;
|
|
|
|
LONG DisableQuantum:1;
|
|
|
|
LONG ReservedFlags:29;
|
2005-06-25 17:01:17 +00:00
|
|
|
};
|
2006-09-10 23:17:22 +00:00
|
|
|
LONG ProcessFlags;
|
2005-06-25 17:01:17 +00:00
|
|
|
};
|
- Add some definitions to ketypes.h
- Fix multiple bugs in KTHREAD/KPROCESS where signed char values were marked as unsigned (and define SCHAR in ntdef.h)
- Change prototype of KiSwapThread for future compatibility.
- Fix prototype of KeSetIdealProcessorThread.
- Add KiAcquireDispatcherLock, KiReleaseDispatcherLock, KiAcquireDispatcherLockAtDpcLevel, KiReleaseDispatcherLockFromDpcLevel to ke_x.h for future use.
- Add KiInsertDeferredReadyList, KiRescheduleThread, KiSetThreadSwapBusy, KiRundownThread, KiCheckDeferredReadyList for future use.
- Add KiAcquirePrcbLock, KiReleasePrcbLock, KiAcquireThreadLock, KiReleaseThreadLock for future use.
- Add KxQueueReadyThread, KiSelectReadyThread for future use.
- Add KiComputeNewPriority for future use.
svn path=/trunk/; revision=24022
2006-09-10 14:43:12 +00:00
|
|
|
SCHAR BasePriority;
|
|
|
|
SCHAR QuantumReset;
|
2006-05-10 17:47:44 +00:00
|
|
|
UCHAR State;
|
|
|
|
UCHAR ThreadSeed;
|
|
|
|
UCHAR PowerState;
|
|
|
|
UCHAR IdealNode;
|
|
|
|
UCHAR Visited;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
KEXECUTE_OPTIONS Flags;
|
|
|
|
UCHAR ExecuteOptions;
|
|
|
|
};
|
|
|
|
ULONG StackCount;
|
|
|
|
LIST_ENTRY ProcessListEntry;
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
ULONGLONG CycleTime;
|
|
|
|
#endif
|
2008-12-01 15:12:23 +00:00
|
|
|
} KPROCESS;
|
2005-09-05 04:48:20 +00:00
|
|
|
|
2006-07-21 19:28:38 +00:00
|
|
|
#define ASSERT_PROCESS(object) \
|
|
|
|
ASSERT((((object)->Header.Type & KOBJECT_TYPE_MASK) == ProcessObject))
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// System Service Table Descriptor
|
|
|
|
//
|
2005-09-05 04:48:20 +00:00
|
|
|
typedef struct _KSERVICE_TABLE_DESCRIPTOR
|
|
|
|
{
|
|
|
|
PULONG_PTR Base;
|
|
|
|
PULONG Count;
|
|
|
|
ULONG Limit;
|
|
|
|
#if defined(_IA64_)
|
|
|
|
LONG TableBaseGpOffset;
|
|
|
|
#endif
|
|
|
|
PUCHAR Number;
|
|
|
|
} KSERVICE_TABLE_DESCRIPTOR, *PKSERVICE_TABLE_DESCRIPTOR;
|
2005-06-25 17:01:17 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Exported Loader Parameter Block
|
|
|
|
//
|
2006-05-10 17:47:44 +00:00
|
|
|
extern struct _LOADER_PARAMETER_BLOCK NTSYSAPI *KeLoaderBlock;
|
2005-11-22 04:57:45 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Exported Hardware Data
|
|
|
|
//
|
2005-09-05 04:48:20 +00:00
|
|
|
extern KAFFINITY NTSYSAPI KeActiveProcessors;
|
2006-08-05 16:27:20 +00:00
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
extern volatile CCHAR NTSYSAPI KeNumberProcessors;
|
|
|
|
#else
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_WINXP)
|
|
|
|
extern CCHAR NTSYSAPI KeNumberProcessors;
|
|
|
|
#else
|
2006-08-06 19:57:24 +00:00
|
|
|
//extern PCCHAR KeNumberProcessors;
|
|
|
|
extern NTSYSAPI CCHAR KeNumberProcessors; //FIXME: Note to Alex: I won't fix this atm, since I prefer to discuss this with you first.
|
2006-08-05 16:27:20 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2005-11-22 04:57:45 +00:00
|
|
|
extern ULONG NTSYSAPI KiDmaIoCoherency;
|
2005-09-05 04:48:20 +00:00
|
|
|
extern ULONG NTSYSAPI KeMaximumIncrement;
|
|
|
|
extern ULONG NTSYSAPI KeMinimumIncrement;
|
2005-11-22 04:57:45 +00:00
|
|
|
extern ULONG NTSYSAPI KeDcacheFlushCount;
|
|
|
|
extern ULONG NTSYSAPI KeIcacheFlushCount;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Exported System Service Descriptor Tables
|
|
|
|
//
|
2005-09-05 04:48:20 +00:00
|
|
|
extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTable[SSDT_MAX_ENTRIES];
|
|
|
|
extern KSERVICE_TABLE_DESCRIPTOR NTSYSAPI KeServiceDescriptorTableShadow[SSDT_MAX_ENTRIES];
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
#endif // !NTOS_MODE_USER
|
|
|
|
|
|
|
|
#endif // _KETYPES_H
|