Added: trunk/reactos/include/ndk/dbgktypes.h
Modified: trunk/reactos/include/ndk/extypes.h
Modified: trunk/reactos/include/ndk/i386/floatsave.h
Modified: trunk/reactos/include/ndk/i386/segment.h
Modified: trunk/reactos/include/ndk/iotypes.h
Modified: trunk/reactos/include/ndk/ketypes.h
Modified: trunk/reactos/include/ndk/ldrfuncs.h
Modified: trunk/reactos/include/ndk/mmtypes.h
Modified: trunk/reactos/include/ndk/ntndk.h
Modified: trunk/reactos/include/ndk/obtypes.h
Modified: trunk/reactos/include/ndk/potypes.h
Modified: trunk/reactos/include/ndk/pstypes.h
Modified: trunk/reactos/ntoskrnl/ex/callback.c
Modified: trunk/reactos/ntoskrnl/include/internal/arch/ps.h
Added: trunk/reactos/ntoskrnl/include/internal/asm.h
Deleted: trunk/reactos/ntoskrnl/include/internal/callbacks.h
Modified: trunk/reactos/ntoskrnl/include/internal/cc.h
Deleted: trunk/reactos/ntoskrnl/include/internal/config.h
Modified: trunk/reactos/ntoskrnl/include/internal/dbgk.h
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
Added: trunk/reactos/ntoskrnl/include/internal/fs.h
Modified: trunk/reactos/ntoskrnl/include/internal/i386/fpu.h
Deleted: trunk/reactos/ntoskrnl/include/internal/i386/hal.h
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
Modified: trunk/reactos/ntoskrnl/include/internal/i386/mm.h
Deleted: trunk/reactos/ntoskrnl/include/internal/i386/ps.h
Deleted: trunk/reactos/ntoskrnl/include/internal/i386/segment.h
Deleted: trunk/reactos/ntoskrnl/include/internal/ifs.h
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
Modified: trunk/reactos/ntoskrnl/include/internal/kbd.h
Modified: trunk/reactos/ntoskrnl/include/internal/kd.h
Deleted: trunk/reactos/ntoskrnl/include/internal/kdb.h
Deleted: trunk/reactos/ntoskrnl/include/internal/kdbochs.h
Deleted: trunk/reactos/ntoskrnl/include/internal/kdgdb.h
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
Modified: trunk/reactos/ntoskrnl/include/internal/ldr.h
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
Modified: trunk/reactos/ntoskrnl/include/internal/module.h
Modified: trunk/reactos/ntoskrnl/include/internal/nls.h
Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
Modified: trunk/reactos/ntoskrnl/include/internal/po.h
Deleted: trunk/reactos/ntoskrnl/include/internal/pool.h
Modified: trunk/reactos/ntoskrnl/include/internal/port.h
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
Deleted: trunk/reactos/ntoskrnl/include/internal/safe.h
Modified: trunk/reactos/ntoskrnl/include/internal/se.h
Modified: trunk/reactos/ntoskrnl/include/internal/tag.h
Deleted: trunk/reactos/ntoskrnl/include/internal/trap.h
Modified: trunk/reactos/ntoskrnl/include/internal/v86m.h
Modified: trunk/reactos/ntoskrnl/include/internal/xhal.h
Modified: trunk/reactos/ntoskrnl/io/disk.c
Modified: trunk/reactos/ntoskrnl/kdbg/kdb.h
Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S
Modified: trunk/reactos/ntoskrnl/ke/i386/irqhand.s
Modified: trunk/reactos/ntoskrnl/ke/i386/main.S
Modified: trunk/reactos/ntoskrnl/ke/i386/stkswitch.S
Modified: trunk/reactos/ntoskrnl/ke/i386/syscall.S
Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s
Modified: trunk/reactos/ntoskrnl/ke/i386/usercall.S
Modified: trunk/reactos/ntoskrnl/ke/i386/v86m_sup.S
Modified: trunk/reactos/ntoskrnl/ob/object.c
--- trunk/reactos/include/ndk/dbgktypes.h 2005-06-25 16:01:27 UTC (rev 16267)
+++ trunk/reactos/include/ndk/dbgktypes.h 2005-06-25 17:01:17 UTC (rev 16268)
@@ -0,0 +1,139 @@
+/*
+ * PROJECT: ReactOS Native Headers
+ * FILE: include/ndk/dbgktypes.h
+ * PURPOSE: Definitions for User-Mode Kernel Debugging not in DDK/IFS
+ * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
+ * UPDATE HISTORY:
+ * Created 25/06/05
+ */
+
+#ifndef _DBGKTYPES_H
+#define _DBGKTYPES_H
+
+/* DEPENDENCIES **************************************************************/
+
+/* EXPORTED DATA *************************************************************/
+
+/* CONSTANTS *****************************************************************/
+#define DEBUG_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x0F)
+#define DEBUG_OBJECT_WAIT_STATE_CHANGE 0x0001
+#define DEBUG_OBJECT_ADD_REMOVE_PROCESS 0x0002
+
+/* ENUMERATIONS **************************************************************/
+
+typedef enum _DEBUGOBJECTINFOCLASS
+{
+ DebugObjectUnusedInformation,
+ DebugObjectKillProcessOnExitInformation
+} DEBUGOBJECTINFOCLASS, * PDEBUGOBJECTINFOCLASS;
+
+/* TYPES *********************************************************************/
+
+typedef struct _DEBUG_OBJECT_KILL_PROCESS_ON_EXIT_INFORMATION
+{
+ ULONG KillProcessOnExit;
+} DEBUG_OBJECT_KILL_PROCESS_ON_EXIT_INFORMATION, *
+PDEBUG_OBJECT_KILL_PROCESS_ON_EXIT_INFORMATION;
+
+typedef struct _DBGK_DEBUG_OBJECT
+{
+ KEVENT Event;
+ FAST_MUTEX Mutex;
+ LIST_ENTRY StateEventListEntry;
+ union
+ {
+ ULONG Flags;
+ struct
+ {
+ UCHAR DebuggerInactive :1;
+ UCHAR KillProcessOnExit :1;
+ };
+ };
+} DBGK_DEBUG_OBJECT, *PDBGK_DEBUG_OBJECT;
+
+typedef enum _DBG_STATE
+{
+ DbgIdle,
+ DbgReplyPending,
+ DbgCreateThreadStateChange,
+ DbgCreateProcessStateChange,
+ DbgExitThreadStateChange,
+ DbgExitProcessStateChange,
+ DbgExceptionStateChange,
+ DbgBreakpointStateChange,
+ DbgSingleStepStateChange,
+ DbgLoadDllStateChange,
+ DbgUnloadDllStateChange
+} DBG_STATE, *PDBG_STATE;
+
+typedef struct _DBGKM_EXCEPTION
+{
+ EXCEPTION_RECORD ExceptionRecord;
+ ULONG FirstChance;
+} DBGKM_EXCEPTION, *PDBGKM_EXCEPTION;
+
+typedef struct _DBGKM_CREATE_THREAD
+{
+ ULONG SubSystemKey;
+ PVOID StartAddress;
+} DBGKM_CREATE_THREAD, *PDBGKM_CREATE_THREAD;
+
+typedef struct _DBGKM_CREATE_PROCESS
+{
+ ULONG SubSystemKey;
+ HANDLE FileHandle;
+ PVOID BaseOfImage;
+ ULONG DebugInfoFileOffset;
+ ULONG DebugInfoSize;
+ DBGKM_CREATE_THREAD InitialThread;
+} DBGKM_CREATE_PROCESS, *PDBGKM_CREATE_PROCESS;
+
+typedef struct _DBGKM_EXIT_THREAD
+{
+ NTSTATUS ExitStatus;
+} DBGKM_EXIT_THREAD, *PDBGKM_EXIT_THREAD;
+
+typedef struct _DBGKM_EXIT_PROCESS
+{
+ NTSTATUS ExitStatus;
+} DBGKM_EXIT_PROCESS, *PDBGKM_EXIT_PROCESS;
+
+typedef struct _DBGKM_LOAD_DLL
+{
+ HANDLE FileHandle;
+ PVOID BaseOfDll;
+ ULONG DebugInfoFileOffset;
+ ULONG DebugInfoSize;
+} DBGKM_LOAD_DLL, *PDBGKM_LOAD_DLL;
+
+typedef struct _DBGKM_UNLOAD_DLL
+{
+ PVOID BaseAddress;
+} DBGKM_UNLOAD_DLL, *PDBGKM_UNLOAD_DLL;
+
+typedef struct _DBGUI_WAIT_STATE_CHANGE
+{
+ DBG_STATE NewState;
+ CLIENT_ID AppClientId;
+ union
+ {
+ struct
+ {
+ HANDLE HandleToThread;
+ DBGKM_CREATE_THREAD NewThread;
+ } CreateThread;
+ struct
+ {
+ HANDLE HandleToProcess;
+ HANDLE HandleToThread;
+ DBGKM_CREATE_PROCESS NewProcess;
+ } CreateProcessInfo;
+ DBGKM_EXIT_THREAD ExitThread;
+ DBGKM_EXIT_PROCESS ExitProcess;
+ DBGKM_EXCEPTION Exception;
+ DBGKM_LOAD_DLL LoadDll;
+ DBGKM_UNLOAD_DLL UnloadDll;
+ } StateInfo;
+} DBGUI_WAIT_STATE_CHANGE, * PDBGUI_WAIT_STATE_CHANGE;
+
+#endif
--- trunk/reactos/include/ndk/extypes.h 2005-06-25 16:01:27 UTC (rev 16267)
+++ trunk/reactos/include/ndk/extypes.h 2005-06-25 17:01:17 UTC (rev 16268)
@@ -21,6 +21,12 @@
/* CONSTANTS *****************************************************************/
#define INVALID_HANDLE_VALUE (HANDLE)-1
+/* Callback Object Access Rights */
+#define CALLBACK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x0001)
+#define CALLBACK_EXECUTE (STANDARD_RIGHTS_EXECUTE|SYNCHRONIZE|0x0001)
+#define CALLBACK_WRITE (STANDARD_RIGHTS_WRITE|SYNCHRONIZE|0x0001)
+#define CALLBACK_READ (STANDARD_RIGHTS_READ|SYNCHRONIZE|0x0001)
+
/* ENUMERATIONS **************************************************************/
/* TYPES *********************************************************************/
@@ -57,6 +63,14 @@
KEVENT RundownEvent;
} RUNDOWN_DESCRIPTOR, *PRUNDOWN_DESCRIPTOR;
+typedef struct _CALLBACK_OBJECT
+{
+ ULONG Name;
+ KSPIN_LOCK Lock;
+ LIST_ENTRY RegisteredCallbacks;
+ ULONG AllowMultipleCallbacks;
+} CALLBACK_OBJECT , *PCALLBACK_OBJECT;
+
typedef struct _HANDLE_TABLE_ENTRY
{
union
--- trunk/reactos/include/ndk/i386/floatsave.h 2005-06-25 16:01:27 UTC (rev 16267)
+++ trunk/reactos/include/ndk/i386/floatsave.h 2005-06-25 17:01:17 UTC (rev 16268)
@@ -1,5 +1,5 @@
-#ifndef __NAPI_I386_FLOATSAVE_H__
-#define __NAPI_I386_FLOATSAVE_H__
+#ifndef _FLOATSAVE_H_
+#define _FLOATSAVE_H_
#define FLOAT_SAVE_CONTROL (0xFFFF037F)
#define FLOAT_SAVE_STATUS (0xFFFF0000)
--- trunk/reactos/include/ndk/i386/segment.h 2005-06-25 16:01:27 UTC (rev 16267)
+++ trunk/reactos/include/ndk/i386/segment.h 2005-06-25 17:01:17 UTC (rev 16268)
@@ -5,8 +5,10 @@
#define KERNEL_DS (0x10)
#define USER_CS (0x18 + 0x3)
#define USER_DS (0x20 + 0x3)
-#define RESERVED_FOR_TSS (0x28)
+#define TSS_SELECTOR (0x28)
#define PCR_SELECTOR (0x30)
#define TEB_SELECTOR (0x38 + 0x3)
+#define LDT_SELECTOR (0x48)
+#define TRAP_TSS_SELECTOR (0x50)
#endif /* _ASM_SEGMENT_H */
--- trunk/reactos/include/ndk/iotypes.h 2005-06-25 16:01:27 UTC (rev 16267)
+++ trunk/reactos/include/ndk/iotypes.h 2005-06-25 17:01:17 UTC (rev 16268)
@@ -11,6 +11,7 @@
#define _IOTYPES_H
/* DEPENDENCIES **************************************************************/
+#include "potypes.h"
/* EXPORTED DATA *************************************************************/
extern POBJECT_TYPE NTOSAPI IoAdapterObjectType;
@@ -20,13 +21,77 @@
extern POBJECT_TYPE NTOSAPI IoFileObjectType;
/* CONSTANTS *****************************************************************/
+
+/* Device Object Extension Flags */
#define DOE_UNLOAD_PENDING 0x1
#define DOE_DELETE_PENDING 0x2
#define DOE_REMOVE_PENDING 0x4
#define DOE_REMOVE_PROCESSED 0x8
#define DOE_START_PENDING 0x10
+/* Device Node Flags */
+#define DNF_PROCESSED 0x00000001
+#define DNF_STARTED 0x00000002
+#define DNF_START_FAILED 0x00000004
+#define DNF_ENUMERATED 0x00000008
+#define DNF_DELETED 0x00000010
+#define DNF_MADEUP 0x00000020
+#define DNF_START_REQUEST_PENDING 0x00000040
+#define DNF_NO_RESOURCE_REQUIRED 0x00000080
+#define DNF_INSUFFICIENT_RESOURCES 0x00000100
+#define DNF_RESOURCE_ASSIGNED 0x00000200
+#define DNF_RESOURCE_REPORTED 0x00000400
+#define DNF_HAL_NODE 0x00000800 // ???
+#define DNF_ADDED 0x00001000
+#define DNF_ADD_FAILED 0x00002000
+#define DNF_LEGACY_DRIVER 0x00004000
+#define DNF_STOPPED 0x00008000
+#define DNF_WILL_BE_REMOVED 0x00010000
+#define DNF_NEED_TO_ENUM 0x00020000
+#define DNF_NOT_CONFIGURED 0x00040000
+#define DNF_REINSTALL 0x00080000
+#define DNF_RESOURCE_REQUIREMENTS_NEED_FILTERED 0x00100000 // ???
+#define DNF_DISABLED 0x00200000
+#define DNF_RESTART_OK 0x00400000
+#define DNF_NEED_RESTART 0x00800000
+#define DNF_VISITED 0x01000000
+#define DNF_ASSIGNING_RESOURCES 0x02000000
+#define DNF_BEEING_ENUMERATED 0x04000000
+#define DNF_NEED_ENUMERATION_ONLY 0x08000000
+#define DNF_LOCKED 0x10000000
+#define DNF_HAS_BOOT_CONFIG 0x20000000
+#define DNF_BOOT_CONFIG_RESERVED 0x40000000
+#define DNF_HAS_PROBLEM 0x80000000 // ???
+/* For UserFlags field */
+#define DNUF_DONT_SHOW_IN_UI 0x0002
+#define DNUF_NOT_DISABLEABLE 0x0008
+
/* ENUMERATIONS **************************************************************/
+typedef enum _PNP_DEVNODE_STATE
+{
+ DeviceNodeUnspecified = 0x300,
+ DeviceNodeUninitialized = 0x301,
+ DeviceNodeInitialized = 0x302,
+ DeviceNodeDriversAdded = 0x303,
+ DeviceNodeResourcesAssigned = 0x304,
+ DeviceNodeStartPending = 0x305,
+ DeviceNodeStartCompletion = 0x306,
+ DeviceNodeStartPostWork = 0x307,
+ DeviceNodeStarted = 0x308,
+ DeviceNodeQueryStopped = 0x309,
+ DeviceNodeStopped = 0x30a,
+ DeviceNodeRestartCompletion = 0x30b,
+ DeviceNodeEnumeratePending = 0x30c,
+ DeviceNodeEnumerateCompletion = 0x30d,
+ DeviceNodeAwaitingQueuedDeletion = 0x30e,
+ DeviceNodeAwaitingQueuedRemoval = 0x30f,
+ DeviceNodeQueryRemoved = 0x310,
+ DeviceNodeRemovePendingCloses = 0x311,
+ DeviceNodeRemoved = 0x312,
+ DeviceNodeDeletePendingCloses = 0x313,
+ DeviceNodeDeleted = 0x314,
+ MaxDeviceNodeState = 0x315,
+} PNP_DEVNODE_STATE;
/* TYPES *********************************************************************/
@@ -52,13 +117,124 @@
typedef struct _IO_TIMER
{
- USHORT Type;
- USHORT TimerEnabled;
- LIST_ENTRY IoTimerList;
- PIO_TIMER_ROUTINE TimerRoutine;
- PVOID Context;
- PDEVICE_OBJECT DeviceObject;
+ USHORT Type;
+ USHORT TimerEnabled;
+ LIST_ENTRY IoTimerList;
+ PIO_TIMER_ROUTINE TimerRoutine;
+ PVOID Context;
+ PDEVICE_OBJECT DeviceObject;
} IO_TIMER, *PIO_TIMER;
+typedef struct _DEVICE_NODE
+{
+ /* A tree structure. */
+ struct _DEVICE_NODE *Parent;
+ struct _DEVICE_NODE *PrevSibling;
+ struct _DEVICE_NODE *NextSibling;
+ struct _DEVICE_NODE *Child;
+ /* The level of deepness in the tree. */
+ UINT Level;
+ PPO_DEVICE_NOTIFY Notify;
+ /* State machine. */
+ PNP_DEVNODE_STATE State;
+ PNP_DEVNODE_STATE PreviousState;
+ PNP_DEVNODE_STATE StateHistory[20];
+ UINT StateHistoryEntry;
+ /* ? */
+ INT CompletionStatus;
+ /* ? */
+ PIRP PendingIrp;
+ /* See DNF_* flags below (WinDBG documentation has WRONG values) */
+ ULONG Flags;
+ /* See DNUF_* flags below (and IRP_MN_QUERY_PNP_DEVICE_STATE) */
+ ULONG UserFlags;
+ /* See CM_PROB_* values are defined in cfg.h */
+ ULONG Problem;
+ /* Pointer to the PDO corresponding to the device node. */
+ PDEVICE_OBJECT PhysicalDeviceObject;
+ /* Resource list as assigned by the PnP arbiter. See IRP_MN_START_DEVICE
+ and ARBITER_INTERFACE (not documented in DDK, but present in headers). */
+ PCM_RESOURCE_LIST ResourceList;
+ /* Resource list as assigned by the PnP arbiter (translated version). */
+ PCM_RESOURCE_LIST ResourceListTranslated;
+ /* Instance path relative to the Enum key in registry. */
+ UNICODE_STRING InstancePath;
+ /* Name of the driver service. */
+ UNICODE_STRING ServiceName;
+ /* ? */
+ PDEVICE_OBJECT DuplicatePDO;
+ /* See IRP_MN_QUERY_RESOURCE_REQUIREMENTS. */
+ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements;
+ /* Information about bus for bus drivers. */
+ INTERFACE_TYPE InterfaceType;
+ ULONG BusNumber;
+ /* Information about underlying bus for child devices. */
+ INTERFACE_TYPE ChildInterfaceType;
+ ULONG ChildBusNumber;
+ USHORT ChildBusTypeIndex;
+ /* ? */
+ UCHAR RemovalPolicy;
+ UCHAR HardwareRemovalPolicy;
+ LIST_ENTRY TargetDeviceNotify;
+ LIST_ENTRY DeviceArbiterList;
+ LIST_ENTRY DeviceTranslatorList;
+ USHORT NoTranslatorMask;
+ USHORT QueryTranslatorMask;
+ USHORT NoArbiterMask;
+ USHORT QueryArbiterMask;
+ union
+ {
+ struct _DEVICE_NODE *LegacyDeviceNode;
+ PDEVICE_RELATIONS PendingDeviceRelations;
+ } OverUsed1;
+ union
+ {
+ struct _DEVICE_NODE *NextResourceDeviceNode;
+ } OverUsed2;
+ /* See IRP_MN_QUERY_RESOURCES/IRP_MN_FILTER_RESOURCES. */
+ PCM_RESOURCE_LIST BootResources;
+ /* See the bitfields in DEVICE_CAPABILITIES structure. */
+ ULONG CapabilityFlags;
+ struct
+ {
+ ULONG DockStatus;
+ LIST_ENTRY ListEntry;
+ WCHAR *SerialNumber;
+ } DockInfo;
+ ULONG DisableableDepends;
+ LIST_ENTRY PendedSetInterfaceState;
+ LIST_ENTRY LegacyBusListEntry;
+ ULONG DriverUnloadRetryCount;
+ struct _DEVICE_NODE *PreviousParent;
+ ULONG DeletedChidren;
+
+ /* FIXME: Not NT's */
+ GUID BusTypeGuid;
+ ULONG Address;
+} DEVICE_NODE, *PDEVICE_NODE;
+
+typedef struct _DEVOBJ_EXTENSION
+{
+ CSHORT Type;
+ USHORT Size;
+ PDEVICE_OBJECT DeviceObject;
+ ULONG PowerFlags;
+ struct DEVICE_OBJECT_POWER_EXTENSION *Dope;
+ ULONG ExtensionFlags;
+ struct _DEVICE_NODE *DeviceNode;
+ PDEVICE_OBJECT AttachedTo;
+ LONG StartIoCount;
+ LONG StartIoKey;
+ ULONG StartIoFlags;
+ struct _VPB *Vpb;
+} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
+
+typedef struct _PRIVATE_DRIVER_EXTENSIONS
+{
+ struct _PRIVATE_DRIVER_EXTENSIONS *Link;
+ PVOID ClientIdentificationAddress;
+ CHAR Extension[1];
+} PRIVATE_DRIVER_EXTENSIONS, *PPRIVATE_DRIVER_EXTENSIONS;
+
#endif
--- trunk/reactos/include/ndk/ketypes.h 2005-06-25 16:01:27 UTC (rev 16267)
+++ trunk/reactos/include/ndk/ketypes.h 2005-06-25 17:01:17 UTC (rev 16268)
@@ -11,6 +11,8 @@
/* DEPENDENCIES **************************************************************/
#include "haltypes.h"
+#include "potypes.h"
+#include "mmtypes.h"
#include <arc/arc.h>
/* CONSTANTS *****************************************************************/
@@ -21,12 +23,6 @@
#define THREAD_WAIT_OBJECTS 4
-/* FIXME: Create an ASM Offset File */
-#define KTSS_ESP0 (0x4)
-#define KTSS_CR3 (0x1C)
-#define KTSS_EFLAGS (0x24)
-#define KTSS_IOMAPBASE (0x66)
-
/* EXPORTED DATA *************************************************************/
extern CHAR NTOSAPI KeNumberProcessors;
extern LOADER_PARAMETER_BLOCK NTOSAPI KeLoaderBlock;
@@ -46,13 +42,12 @@
typedef struct _CONFIGURATION_COMPONENT_DATA
{
- struct _CONFIGURATION_COMPONENT_DATA *Parent;
- struct _CONFIGURATION_COMPONENT_DATA *Child;
- struct _CONFIGURATION_COMPONENT_DATA *Sibling;
- CONFIGURATION_COMPONENT Component;
+ struct _CONFIGURATION_COMPONENT_DATA *Parent;
+ struct _CONFIGURATION_COMPONENT_DATA *Child;
+ struct _CONFIGURATION_COMPONENT_DATA *Sibling;
+ CONFIGURATION_COMPONENT Component;
} CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
-
typedef enum _KAPC_ENVIRONMENT
{
OriginalApcEnvironment,
@@ -68,6 +63,48 @@
ULONG DpcCount;
} KDPC_DATA, *PKDPC_DATA;
+/* FIXME: Most of these should go to i386 directory */
+typedef struct _FNSAVE_FORMAT
+{
+ ULONG ControlWord;
+ ULONG StatusWord;
+ ULONG TagWord;
+ ULONG ErrorOffset;
+ ULONG ErrorSelector;
+ ULONG DataOffset;
+ ULONG DataSelector;
+ UCHAR RegisterArea[80];
+} FNSAVE_FORMAT, *PFNSAVE_FORMAT;
+
+typedef struct _FXSAVE_FORMAT
+{
+ USHORT ControlWord;
+ USHORT StatusWord;
+ USHORT TagWord;
+ USHORT ErrorOpcode;
+ ULONG ErrorOffset;
+ ULONG ErrorSelector;
+ ULONG DataOffset;
+ ULONG DataSelector;
+ ULONG MXCsr;
+ ULONG MXCsrMask;
+ UCHAR RegisterArea[128];
+ UCHAR Reserved3[128];
+ UCHAR Reserved4[224];
+ UCHAR Align16Byte[8];
+} FXSAVE_FORMAT, *PFXSAVE_FORMAT;
+
+typedef struct _FX_SAVE_AREA
+{
+ union
+ {
+ FNSAVE_FORMAT FnArea;
+ FXSAVE_FORMAT FxArea;
+ } U;
+ ULONG NpxSavedCpu;
+ ULONG Cr0NpxState;
+} FX_SAVE_AREA, *PFX_SAVE_AREA;
+
typedef struct _KTRAP_FRAME
{
PVOID DebugEbp;
@@ -141,7 +178,231 @@
} HighWord;
} LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
+typedef struct _KGDTENTRY
+{
+ USHORT LimitLow;
+ USHORT BaseLow;
+ union {
+ struct {
+ UCHAR BaseMid;
+ UCHAR Flags1;
+ UCHAR Flags2;
+ UCHAR BaseHi;
+ } Bytes;
+ struct {
+ ULONG BaseMid : 8;
+ ULONG Type : 5;
+ ULONG Dpl : 2;
+ ULONG Pres : 1;
+ ULONG LimitHi : 4;
+ ULONG Sys : 1;
+ ULONG Reserved_0 : 1;
+ ULONG Default_Big : 1;
+ ULONG Granularity : 1;
+ ULONG BaseHi : 8;
+ } Bits;
+ } HighWord;
+} KGDTENTRY, *PKGDTENTRY;
+typedef struct _KIDTENTRY
+{
+ USHORT Offset;
+ USHORT Selector;
+ USHORT Access;
+ USHORT ExtendedOffset;
+} KIDTENTRY, *PKIDTENTRY;
+
+typedef struct _HARDWARE_PTE_X86
+{
+ ULONG Valid : 1;
+ ULONG Write : 1;
+ ULONG Owner : 1;
+ ULONG WriteThrough : 1;
+ ULONG CacheDisable : 1;
+ ULONG Accessed : 1;
+ ULONG Dirty : 1;
+ ULONG LargePage : 1;
+ ULONG Global : 1;
+ ULONG CopyOnWrite : 1;
+ ULONG Prototype : 1;
+ ULONG reserved : 1;
+ ULONG PageFrameNumber : 20;
+} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
+
+#pragma pack(push,4)
+
+/* Fixme: Use correct types? */
+typedef struct _KPROCESSOR_STATE
+{
+ PCONTEXT ContextFrame;
+ PVOID SpecialRegisters;
+} KPROCESSOR_STATE;
+
+/* Processor Control Block */
+typedef struct _KPRCB
+{
+ USHORT MinorVersion;
+ USHORT MajorVersion;
+ struct _KTHREAD *CurrentThread;
+ struct _KTHREAD *NextThread;
+ struct _KTHREAD *IdleThread;
+ UCHAR Number;
+ UCHAR Reserved;
+ USHORT BuildType;
+ ULONG SetMember;
+ UCHAR CpuType;
+ UCHAR CpuID;
+ USHORT CpuStep;
+ KPROCESSOR_STATE ProcessorState;
+ ULONG KernelReserved[16];
+ ULONG HalReserved[16];
+ UCHAR PrcbPad0[92];
+ PVOID LockQueue[33]; // Used for Queued Spinlocks
+ struct _KTHREAD *NpxThread;
+ ULONG InterruptCount;
+ ULONG KernelTime;
+ ULONG UserTime;
+ ULONG DpcTime;
+ ULONG DebugDpcTime;
+ ULONG InterruptTime;
+ ULONG AdjustDpcThreshold;
+ ULONG PageColor;
+ UCHAR SkipTick;
+ UCHAR DebuggerSavedIRQL;
+ UCHAR Spare1[6];
+ struct _KNODE *ParentNode;
+ ULONG MultiThreadProcessorSet;
+ struct _KPRCB *MultiThreadSetMaster;
+ ULONG ThreadStartCount[2];
+ ULONG CcFastReadNoWait;
+ ULONG CcFastReadWait;
+ ULONG CcFastReadNotPossible;
+ ULONG CcCopyReadNoWait;
+ ULONG CcCopyReadWait;
+ ULONG CcCopyReadNoWaitMiss;
+ ULONG KeAlignmentFixupCount;
+ ULONG KeContextSwitches;
+ ULONG KeDcacheFlushCount;
+ ULONG KeExceptionDispatchCount;
+ ULONG KeFirstLevelTbFills;
+ ULONG KeFloatingEmulationCount;
+ ULONG KeIcacheFlushCount;
+ ULONG KeSecondLevelTbFills;
+ ULONG KeSystemCalls;
+ ULONG IoReadOperationCount;
+ ULONG IoWriteOperationCount;
+ ULONG IoOtherOperationCount;
+ LARGE_INTEGER IoReadTransferCount;
+ LARGE_INTEGER IoWriteTransferCount;
+ LARGE_INTEGER IoOtherTransferCount;
+ ULONG SpareCounter1[8];
+ PP_LOOKASIDE_LIST PPLookasideList[16];
+ PP_LOOKASIDE_LIST PPNPagedLookasideList[32];
+ PP_LOOKASIDE_LIST PPPagedLookasideList[32];
+ ULONG PacketBarrier;
+ ULONG ReverseStall;
+ PVOID IpiFrame;
+ UCHAR PrcbPad2[52];
+ PVOID CurrentPacket[3];
+ ULONG TargetSet;
+ ULONG_PTR WorkerRoutine;
+ ULONG IpiFrozen;
+ UCHAR PrcbPad3[40];
+ ULONG RequestSummary;
+ struct _KPRCB *SignalDone;
+ UCHAR PrcbPad4[56];
+ struct _KDPC_DATA DpcData[2];
+ PVOID DpcStack;
+ ULONG MaximumDpcQueueDepth;
+ ULONG DpcRequestRate;
+ ULONG MinimumDpcRate;
+ UCHAR DpcInterruptRequested;
+ UCHAR DpcThreadRequested;
+ UCHAR DpcRoutineActive;
+ UCHAR DpcThreadActive;
+ ULONG PrcbLock;
+ ULONG DpcLastCount;
+ ULONG TimerHand;
+ ULONG TimerRequest;
+ PVOID DpcThread;
+ struct _KEVENT *DpcEvent;
+ UCHAR ThreadDpcEnable;
+ BOOLEAN QuantumEnd;
+ UCHAR PrcbPad50;
+ UCHAR IdleSchedule;
+ ULONG DpcSetEventRequest;
+ UCHAR PrcbPad5[18];
+ LONG TickOffset;
+ struct _KDPC* CallDpc;
+ ULONG PrcbPad7[8];
+ LIST_ENTRY WaitListHead;
+ ULONG ReadySummary;
+ ULONG SelectNextLast;
+ LIST_ENTRY DispatcherReadyListHead[32];
+ SINGLE_LIST_ENTRY DeferredReadyListHead;
+ ULONG PrcbPad72[11];
+ PVOID ChainedInterruptList;
+ LONG LookasideIrpFloat;
+ LONG MmPageFaultCount;
+ LONG MmCopyOnWriteCount;
+ LONG MmTransitionCount;
+ LONG MmCacheTransitionCount;
+ LONG MmDemandZeroCount;
+ LONG MmPageReadCount;
+ LONG MmPageReadIoCount;
+ LONG MmCacheReadCount;
+ LONG MmCacheIoCount;
+ LONG MmDirtyPagesWriteCount;
+ LONG MmDirtyWriteIoCount;
+ LONG MmMappedPagesWriteCount;
+ LONG MmMappedWriteIoCount;
+ ULONG SpareFields0[1];
+ CHAR VendorString[13];
+ UCHAR InitialApicId;
+ UCHAR LogicalProcessorsPerPhysicalProcessor;
+ ULONG MHz;
+ ULONG FeatureBits;
+ LARGE_INTEGER UpdateSignature;
+ LARGE_INTEGER IsrTime;
+ LARGE_INTEGER SpareField1;
+ FX_SAVE_AREA NpxSaveArea;
+ PROCESSOR_POWER_STATE PowerState;
+} KPRCB, *PKPRCB;
+
+/*
+ * This is the complete, internal KPCR structure
+ */
+typedef struct _KIPCR {
+ KPCR_TIB Tib; /* 00 */
+ struct _KPCR *Self; /* 1C */
+ struct _KPRCB *Prcb; /* 20 */
+ KIRQL Irql; /* 24 */
+ ULONG IRR; /* 28 */
+ ULONG IrrActive; /* 2C */
+ ULONG IDR; /* 30 */
+ PVOID KdVersionBlock; /* 34 */
+ PUSHORT IDT; /* 38 */
+ PUSHORT GDT; /* 3C */
+ struct _KTSS *TSS; /* 40 */
+ USHORT MajorVersion; /* 44 */
+ USHORT MinorVersion; /* 46 */
+ KAFFINITY SetMember; /* 48 */
+ ULONG StallScaleFactor; /* 4C */
+ UCHAR SparedUnused; /* 50 */
+ UCHAR Number; /* 51 */
+ UCHAR Reserved; /* 52 */
+ UCHAR L2CacheAssociativity; /* 53 */
+ ULONG VdmAlert; /* 54 */
+ ULONG KernelReserved[14]; /* 58 */
+ ULONG L2CacheSize; /* 90 */
+ ULONG HalReserved[16]; /* 94 */
+ ULONG InterruptMode; /* D4 */
+ UCHAR KernelReserved2[0x48]; /* D8 */
+ KPRCB PrcbData; /* 120 */
+} KIPCR, *PKIPCR;
+
+#pragma pack(pop)
+
#include <pshpack1.h>
typedef struct _KTSSNOIOPM
@@ -239,6 +500,35 @@
} KEXCEPTION_FRAME, *PKEXCEPTION_FRAME;
+typedef struct _KNODE
+{
+ SLIST_HEADER DeadStackList;
+ SLIST_HEADER PfnDereferenceSListHead;
+ ULONG ProcessorMask;
+ ULONG Color;
+ UCHAR Seed;
+ UCHAR NodeNumber;
+ ULONG Flags;
+ ULONG MmShiftedColor;
+ ULONG FreeCount[2];
+ struct _SINGLE_LIST_ENTRY *PfnDeferredList;
+} KNODE, *PKNODE;
+
+typedef struct _KPROFILE
+{
+ CSHORT Type;
+ CSHORT Size;
+ LIST_ENTRY ListEntry;
+ PVOID RegionStart;
+ PVOID RegionEnd;
+ ULONG BucketShift;
+ PVOID Buffer;
+ CSHORT Source;
+ ULONG Affinity;
+ BOOLEAN Active;
+ struct _KPROCESS *Process;
+} KPROFILE, *PKPROFILE;
+
typedef struct _KINTERRUPT
{
CSHORT Type;
@@ -271,36 +561,192 @@
KEVENT HighEvent;
} KEVENT_PAIR, *PKEVENT_PAIR;
-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
+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;
+
+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;
-typedef enum _KTHREAD_STATE {
+#include <pshpack1.h>
+
+typedef struct _KTHREAD
+{
+ /* For waiting on thread exit */
+ DISPATCHER_HEADER DispatcherHeader; /* 00 */
+
+ /* List of mutants owned by the thread */
+ LIST_ENTRY MutantListHead; /* 10 */
+ PVOID InitialStack; /* 18 */
+ ULONG_PTR StackLimit; /* 1C */
+
+ /* Pointer to the thread's environment block in user memory */
+ struct _TEB *Teb; /* 20 */
+
+ /* Pointer to the thread's TLS array */
+ PVOID TlsArray; /* 24 */
+ PVOID KernelStack; /* 28 */
+ UCHAR DebugActive; /* 2C */
+
+ /* Thread state (one of THREAD_STATE_xxx constants below) */
+ UCHAR State; /* 2D */
+ BOOLEAN Alerted[2]; /* 2E */
+ UCHAR Iopl; /* 30 */
+ UCHAR NpxState; /* 31 */
+ CHAR Saturation; /* 32 */
+ CHAR Priority; /* 33 */
+ KAPC_STATE ApcState; /* 34 */
+ ULONG ContextSwitches; /* 4C */
+ LONG WaitStatus; /* 50 */
+ KIRQL WaitIrql; /* 54 */
+ CHAR WaitMode; /* 55 */
+ UCHAR WaitNext; /* 56 */
+ UCHAR WaitReason; /* 57 */
+ union { /* 58 */
+ PKWAIT_BLOCK WaitBlockList; /* 58 */
+ PKGATE GateObject; /* 58 */
+ }; /* 58 */
+ LIST_ENTRY WaitListEntry; /* 5C */
+ ULONG WaitTime; /* 64 */
+ CHAR BasePriority; /* 68 */
+ UCHAR DecrementCount; /* 69 */
+ UCHAR PriorityDecrement; /* 6A */
+ CHAR Quantum; /* 6B */
+ KWAIT_BLOCK WaitBlock[4]; /* 6C */
+ PVOID LegoData; /* CC */
+ union {
+ struct {
+ USHORT KernelApcDisable;
+ USHORT SpecialApcDisable;
+ };
+ ULONG CombinedApcDisable; /* D0 */
+ };
+ KAFFINITY UserAffinity; /* D4 */
+ UCHAR SystemAffinityActive;/* D8 */
+ UCHAR PowerState; /* D9 */
+ UCHAR NpxIrql; /* DA */
+ UCHAR Pad[1]; /* DB */
+ PVOID ServiceTable; /* DC */
+ PKQUEUE Queue; /* E0 */
+ KSPIN_LOCK ApcQueueLock; /* E4 */
+ KTIMER Timer; /* E8 */
+ LIST_ENTRY QueueListEntry; /* 110 */
+ KAFFINITY Affinity; /* 118 */
+ UCHAR Preempted; /* 11C */
+ UCHAR ProcessReadyQueue; /* 11D */
+ UCHAR KernelStackResident; /* 11E */
+ UCHAR NextProcessor; /* 11F */
+ PVOID CallbackStack; /* 120 */
+ struct _W32THREAD *Win32Thread; /* 124 */
+ struct _KTRAP_FRAME *TrapFrame; /* 128 */
+ PKAPC_STATE ApcStatePointer[2]; /* 12C */
+ UCHAR EnableStackSwap; /* 134 */
+ UCHAR LargeStack; /* 135 */
+ UCHAR ResourceIndex; /* 136 */
+ UCHAR PreviousMode; /* 137 */
+ ULONG KernelTime; /* 138 */
+ ULONG UserTime; /* 13C */
+ KAPC_STATE SavedApcState; /* 140 */
+ UCHAR Alertable; /* 158 */
+ UCHAR ApcStateIndex; /* 159 */
+ UCHAR ApcQueueable; /* 15A */
+ UCHAR AutoAlignment; /* 15B */
+ PVOID StackBase; /* 15C */
+ KAPC SuspendApc; /* 160 */
+ KSEMAPHORE SuspendSemaphore; /* 190 */
+ LIST_ENTRY ThreadListEntry; /* 1A4 */
+ CHAR FreezeCount; /* 1AC */
+ UCHAR SuspendCount; /* 1AD */
+ UCHAR IdealProcessor; /* 1AE */
+ UCHAR DisableBoost; /* 1AF */
+ UCHAR QuantumReset; /* 1B0 */
+} KTHREAD;
+
+#include <poppack.h>
+
+/*
+ * NAME: KPROCESS
+ * DESCRIPTION: Internal Kernel Process Structure.
+ * PORTABILITY: Architecture Dependent.
+ * KERNEL VERSION: 5.2
+ * DOCUMENTATION: http://reactos.com/wiki/index.php/KPROCESS
+ */
+typedef struct _KPROCESS
+{
+ DISPATCHER_HEADER Header; /* 000 */
+ LIST_ENTRY ProfileListHead; /* 010 */
+ PHYSICAL_ADDRESS DirectoryTableBase; /* 018 */
+ KGDTENTRY LdtDescriptor; /* 020 */
+ KIDTENTRY Int21Descriptor; /* 028 */
+ USHORT IopmOffset; /* 030 */
+ UCHAR Iopl; /* 032 */
+ UCHAR Unused; /* 033 */
+ ULONG ActiveProcessors; /* 034 */
+ ULONG KernelTime; /* 038 */
+ ULONG UserTime; /* 03C */
+ LIST_ENTRY ReadyListHead; /* 040 */
+ LIST_ENTRY SwapListEntry; /* 048 */
+ PVOID VdmTrapcHandler; /* 04C */
+ LIST_ENTRY ThreadListHead; /* 050 */
+ KSPIN_LOCK ProcessLock; /* 058 */
+ KAFFINITY Affinity; /* 05C */
+ union {
+ struct {
+ ULONG AutoAlignment:1; /* 060.0 */
+ ULONG DisableBoost:1; /* 060.1 */
+ ULONG DisableQuantum:1; /* 060.2 */
+ ULONG ReservedFlags:29; /* 060.3 */
+ };
+ ULONG ProcessFlags; /* 060 */
+ };
+ CHAR BasePriority; /* 064 */
+ CHAR QuantumReset; /* 065 */
+ UCHAR State; /* 066 */
+ UCHAR ThreadSeed; /* 067 */
+ UCHAR PowerState; /* 068 */
+ UCHAR IdealNode; /* 069 */
+ UCHAR Visited; /* 06A */
+ KEXECUTE_OPTIONS Flags; /* 06B */
+ ULONG StackCount; /* 06C */
+ LIST_ENTRY ProcessListEntry; /* 070 */
[truncated at 1000 lines; 6372 more skipped]