- Fix KiDispatchException to unmask KI_EXCEPTION_INTERNAL when setting the exception...
authorAlex Ionescu <aionescu@gmail.com>
Thu, 1 Mar 2007 19:51:20 +0000 (19:51 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Thu, 1 Mar 2007 19:51:20 +0000 (19:51 +0000)
- 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

47 files changed:
reactos/drivers/base/kdcom/kdbg.c
reactos/include/ddk/ntifs.h
reactos/include/ddk/winddk.h
reactos/include/ndk/asm.h
reactos/include/ndk/i386/ketypes.h
reactos/include/ndk/kdfuncs.h
reactos/include/ndk/kdtypes.h
reactos/include/ndk/ketypes.h
reactos/include/ndk/rtlfuncs.h
reactos/include/psdk/common.ver [new file with mode: 0644]
reactos/include/psdk/ntdef.h
reactos/include/psdk/ntverp.h [new file with mode: 0644]
reactos/include/psdk/wdbgexts.h [new file with mode: 0644]
reactos/include/reactos/kddll.h [new file with mode: 0644]
reactos/include/reactos/windbgkd.h [new file with mode: 0644]
reactos/lib/rtl/debug.c
reactos/lib/rtl/i386/debug_asm.S
reactos/ntoskrnl/cm/regobj.c
reactos/ntoskrnl/ex/init.c
reactos/ntoskrnl/ex/time.c
reactos/ntoskrnl/include/internal/ex.h
reactos/ntoskrnl/include/internal/i386/intrin_i.h
reactos/ntoskrnl/include/internal/i386/ke.h
reactos/ntoskrnl/include/internal/io.h
reactos/ntoskrnl/include/internal/ke.h
reactos/ntoskrnl/include/internal/ob.h
reactos/ntoskrnl/include/internal/ps.h
reactos/ntoskrnl/include/ntoskrnl.h
reactos/ntoskrnl/io/iomgr/error.c
reactos/ntoskrnl/io/iomgr/iomgr.c
reactos/ntoskrnl/kd/kdmain.c
reactos/ntoskrnl/ke/bug.c
reactos/ntoskrnl/ke/except.c
reactos/ntoskrnl/ke/i386/cpu.c
reactos/ntoskrnl/ke/i386/exp.c
reactos/ntoskrnl/ke/i386/kiinit.c
reactos/ntoskrnl/ke/i386/trap.s
reactos/ntoskrnl/ke/krnlinit.c
reactos/ntoskrnl/ke/spinlock.c
reactos/ntoskrnl/mm/process.c
reactos/ntoskrnl/mm/rpoolmgr.h
reactos/ntoskrnl/mm/sysldr.c
reactos/ntoskrnl/ntoskrnl.rc
reactos/ntoskrnl/ob/obinit.c
reactos/ntoskrnl/ob/oblife.c
reactos/ntoskrnl/ob/obname.c
reactos/ntoskrnl/rtl/misc.c

index 2e5762a..6924d40 100644 (file)
@@ -17,6 +17,8 @@
 #include <halfuncs.h>\r
 #include <stdio.h>\r
 #include <debug.h>\r
+#include "arc/arc.h"\r
+#include "windbgkd.h"\r
 \r
 typedef struct _KD_PORT_INFORMATION\r
 {\r
@@ -553,4 +555,77 @@ KdPortEnableInterrupts()
        return TRUE;\r
 }\r
 \r
+/*\r
+ * @unimplemented\r
+ */\r
+NTSTATUS\r
+NTAPI\r
+KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)\r
+{\r
+    /* FIXME: TODO */\r
+    return STATUS_UNSUCCESSFUL;\r
+}\r
+\r
+/*\r
+ * @unimplemented\r
+ */\r
+NTSTATUS\r
+NTAPI\r
+KdDebuggerInitialize1(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)\r
+{\r
+    /* FIXME: TODO */\r
+    return STATUS_UNSUCCESSFUL;\r
+}\r
+\r
+/*\r
+ * @implemented\r
+ */\r
+NTSTATUS\r
+NTAPI\r
+KdSave(IN BOOLEAN SleepTransition)\r
+{\r
+    /* Nothing to do on COM ports */\r
+    return STATUS_SUCCESS;\r
+}\r
+\r
+/*\r
+ * @implemented\r
+ */\r
+NTSTATUS\r
+NTAPI\r
+KdRestore(IN BOOLEAN SleepTransition)\r
+{\r
+    /* Nothing to do on COM ports */\r
+    return STATUS_SUCCESS;\r
+}\r
+\r
+/*\r
+ * @unimplemented\r
+ */\r
+VOID\r
+NTAPI\r
+KdSendPacket(IN USHORT PacketType,\r
+             IN PSTRING Header,\r
+             IN PSTRING Data OPTIONAL,\r
+             OUT PKD_CONTEXT Context)\r
+{\r
+    /* FIXME: TODO */\r
+    return;\r
+}\r
+\r
+/*\r
+ * @unimplemented\r
+ */\r
+ULONG\r
+NTAPI\r
+KdReceivePacket(IN USHORT PacketType,\r
+                OUT PSTRING Header,\r
+                OUT PSTRING Data,\r
+                OUT PUSHORT DataSize,\r
+                OUT PKD_CONTEXT Context OPTIONAL)\r
+{\r
+    /* FIXME: TODO */\r
+    return 0;\r
+}\r
+\r
 /* EOF */\r
index 7acf7d6..4614a46 100644 (file)
@@ -44,7 +44,9 @@ extern "C" {
 
 #pragma pack(push,4)
 
+#ifndef VER_PRODUCTBUILD
 #define VER_PRODUCTBUILD 10000
+#endif
 
 #ifndef NTSYSAPI
 #define NTSYSAPI
index 0131a0a..b06e5cb 100644 (file)
@@ -637,6 +637,28 @@ typedef IO_ALLOCATION_ACTION
   IN PVOID  MapRegisterBase,
   IN PVOID  Context);
 
+
+typedef struct _EXCEPTION_RECORD32
+{
+    NTSTATUS ExceptionCode;
+    ULONG ExceptionFlags;
+    ULONG ExceptionRecord;
+    ULONG ExceptionAddress;
+    ULONG NumberParameters;
+    ULONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
+} EXCEPTION_RECORD32, *PEXCEPTION_RECORD32;
+
+typedef struct _EXCEPTION_RECORD64
+{
+    NTSTATUS ExceptionCode;
+    ULONG ExceptionFlags;
+    ULONG64 ExceptionRecord;
+    ULONG64 ExceptionAddress;
+    ULONG NumberParameters;
+    ULONG __unusedAlignment;
+    ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
+} EXCEPTION_RECORD64, *PEXCEPTION_RECORD64;
+
 typedef EXCEPTION_DISPOSITION
 (DDKAPI *PEXCEPTION_ROUTINE)(
   IN struct _EXCEPTION_RECORD *ExceptionRecord,
@@ -5425,6 +5447,13 @@ KfReleaseSpinLock(
   IN PKSPIN_LOCK SpinLock,
   IN KIRQL NewIrql);
 
+NTKERNELAPI
+BOOLEAN
+FASTCALL
+KeTryToAcquireSpinLockAtDpcLevel(
+    IN OUT PKSPIN_LOCK SpinLock
+);
+
 #define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
 #define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
 #define KeAcquireSpinLock(a,b)  *(b) = KfAcquireSpinLock(a)
index 88cebfc..8cfa597 100644 (file)
@@ -494,6 +494,7 @@ Author:
 #define DR6_LEGAL                               0xE00F
 #define DR7_LEGAL                               0xFFFF0155
 #define DR7_ACTIVE                              0x55
+#define DR7_OVERRIDE_V                          0x04
 #define DR7_RESERVED_MASK                       0xDC00
 #define DR7_OVERRIDE_MASK                       0xF0000
 
@@ -503,6 +504,7 @@ Author:
 #define CBSTACK_STACK                           0x0
 #define CBSTACK_TRAP_FRAME                      0x4
 #define CBSTACK_CALLBACK_STACK                  0x8
+#define CBSTACK_EBP                             0x18
 #define CBSTACK_RESULT                          0x20
 #define CBSTACK_RESULT_LENGTH                   0x24
 
index 3d7e5c1..d467a10 100644 (file)
@@ -350,7 +350,6 @@ typedef struct _KSPECIAL_REGISTERS
 //
 // Processor State Data
 //
-#pragma pack(push,4)
 typedef struct _KPROCESSOR_STATE
 {
     CONTEXT ContextFrame;
@@ -360,6 +359,7 @@ typedef struct _KPROCESSOR_STATE
 //
 // Processor Region Control Block
 //
+#pragma pack(push,4)
 typedef struct _KPRCB
 {
     USHORT MinorVersion;
index 7e7e458..cd71e2b 100644 (file)
@@ -27,29 +27,6 @@ Author:
 
 #ifndef NTOS_MODE_USER
 
-//
-// Port Functions
-//
-UCHAR
-NTAPI
-KdPollBreakIn(VOID);
-
-NTSTATUS
-NTAPI
-KdRestore(IN BOOLEAN DisableDbgPorts);
-
-NTSTATUS
-NTAPI
-KdSave(IN ULONG Unknown);
-
-#ifdef _ARC_
-NTSTATUS
-NTAPI
-KdDebuggerInitialize0(
-    IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock
-);
-#endif
-
 //
 // Debugger API
 //
@@ -65,6 +42,12 @@ KdSystemDebugControl(
     KPROCESSOR_MODE PreviousMode
 );
 
+BOOLEAN
+NTAPI
+KdPollBreakIn(
+    VOID
+);
+
 #endif
 
 //
index 60597af..26eb130 100644 (file)
@@ -52,6 +52,7 @@ Author:
 #define BREAKPOINT_PROMPT                   2
 #define BREAKPOINT_LOAD_SYMBOLS             3
 #define BREAKPOINT_UNLOAD_SYMBOLS           4
+#define BREAKPOINT_COMMAND_STRING           5
 
 //
 // Debug Control Codes for NtSystemDebugcontrol
@@ -167,7 +168,7 @@ typedef struct _SYSDBG_TRIAGE_DUMP
 typedef struct _KD_SYMBOLS_INFO
 {
     PVOID BaseOfDll;
-    PVOID ProcessId;
+    ULONG_PTR ProcessId;
     ULONG CheckSum;
     ULONG SizeOfImage;
 } KD_SYMBOLS_INFO, *PKD_SYMBOLS_INFO;
index 290c08a..83354dd 100644 (file)
@@ -97,6 +97,12 @@ Author:
 #define KF_NX_DISABLED                  0x40000000
 #define KF_NX_ENABLED                   0x80000000
 
+//
+// Internal Exception Codes
+//
+#define KI_EXCEPTION_INTERNAL           0x10000000
+#define KI_EXCEPTION_ACCESS_VIOLATION   (KI_EXCEPTION_INTERNAL | 0x04)
+
 //
 // KPCR Access for non-IA64 builds
 //
@@ -297,6 +303,17 @@ typedef enum _ADJUST_REASON
     AdjustBoost = 2
 } ADJUST_REASON;
 
+//
+// Continue Status
+//
+typedef enum _KCONTINUE_STATUS
+{
+    ContinueError = 0,
+    ContinueSuccess,
+    ContinueProcessorReselected,
+    ContinueNextProcessor
+} KCONTINUE_STATUS;
+
 //
 // Process States
 //
index f25db1d..70aacd9 100644 (file)
@@ -2511,7 +2511,7 @@ NTAPI
 DbgLoadImageSymbols(
     IN PANSI_STRING Name,
     IN PVOID Base,
-    IN ULONG ProcessId
+    IN ULONG_PTR ProcessId
 );
 
 VOID
diff --git a/reactos/include/psdk/common.ver b/reactos/include/psdk/common.ver
new file mode 100644 (file)
index 0000000..3295b44
--- /dev/null
@@ -0,0 +1,207 @@
+/*\r
+ * PROJECT:         ReactOS\r
+ * LICENSE:         GPL - See COPYING in the top level directory\r
+ * FILE:            include/psdk/common.ver\r
+ * PURPOSE:         Common Version File.\r
+ * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)\r
+ */\r
+\r
+//\r
+// Copyright Year\r
+//\r
+#ifndef VER_LEGALCOPYRIGHT_YEARS\r
+#define VER_LEGALCOPYRIGHT_YEARS    "2007"\r
+#endif\r
+\r
+//\r
+// Copyright String\r
+//\r
+#ifndef VER_LEGALCOPYRIGHT_STR\r
+#if defined(RC_INVOKED) && !defined(WIN16)\r
+#define VER_LEGALCOPYRIGHT_STR L"\251 ReactOS Foundation. All rights reserved."\r
+#else\r
+#define VER_LEGALCOPYRIGHT_STR "Copyright (c) ReactOS Foundation. All rights reserved."\r
+#endif\r
+#endif\r
+\r
+//\r
+// Product Name String\r
+//\r
+#ifndef VER_PRODUCTNAME_STR\r
+#ifdef RC_INVOKED\r
+#define VER_PRODUCTNAME_STR L"ReactOS\256 Operating System"\r
+#else\r
+#define VER_PRODUCTNAME_STR "ReactOS (R) Operating System"\r
+#endif\r
+#endif\r
+\r
+//\r
+// The File Version is the same as the Product Version\r
+//\r
+#ifndef VER_FILEVERSION\r
+#define VER_FILEVERSION VER_PRODUCTVERSION\r
+#endif\r
+#ifndef VER_FILEVERSION_STR\r
+#define VER_FILEVERSION_STR VER_PRODUCTVERSION_STR\r
+#endif\r
+\r
+//\r
+// If no Original Name was given, use the Internal NAme\r
+//\r
+#ifndef VER_ORIGINALFILENAME_STR\r
+#define VER_ORIGINALFILENAME_STR VER_INTERNALNAME_STR\r
+#endif\r
+\r
+//\r
+// Allow tagging a Build by Machine/Date\r
+//\r
+#if defined(__BUILDMACHINE__)\r
+#if defined(__BUILDDATE__)\r
+#define B2(x,y) " (" #x "." #y ")"\r
+#define B1(x,y) B2(x, y)\r
+#define BUILD_MACHINE_TAG B1(__BUILDMACHINE__, __BUILDDATE__)\r
+#else\r
+#define B2(x) " built by: " #x\r
+#define B1(x) B2(x)\r
+#define BUILD_MACHINE_TAG B1(__BUILDMACHINE__)\r
+#endif\r
+#if defined(__BUILDMACHINE_LEN__)\r
+#if __BUILDMACHINE_LEN__ >= 25\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG\r
+#elif __BUILDMACHINE_LEN__ == 24\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG " "\r
+#elif __BUILDMACHINE_LEN__ == 23\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "  "\r
+#elif __BUILDMACHINE_LEN__ == 22\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "   "\r
+#elif __BUILDMACHINE_LEN__ == 21\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "    "\r
+#elif __BUILDMACHINE_LEN__ == 20\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "     "\r
+#elif __BUILDMACHINE_LEN__ == 19\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "      "\r
+#elif __BUILDMACHINE_LEN__ == 18\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "       "\r
+#elif __BUILDMACHINE_LEN__ == 17\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "        "\r
+#elif __BUILDMACHINE_LEN__ == 16\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "         "\r
+#elif __BUILDMACHINE_LEN__ == 15                       \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "          "\r
+#elif __BUILDMACHINE_LEN__ == 14                               \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "           "\r
+#elif __BUILDMACHINE_LEN__ == 13                                 \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "            "\r
+#elif __BUILDMACHINE_LEN__ == 12                               \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "             "\r
+#elif __BUILDMACHINE_LEN__ == 11                               \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "              "\r
+#elif __BUILDMACHINE_LEN__ == 10                               \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "               "\r
+#elif __BUILDMACHINE_LEN__ == 9                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                "\r
+#elif __BUILDMACHINE_LEN__ == 8                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                 "\r
+#elif __BUILDMACHINE_LEN__ == 7                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                  "\r
+#elif __BUILDMACHINE_LEN__ == 6                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                   "\r
+#elif __BUILDMACHINE_LEN__ == 5                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                    "\r
+#elif __BUILDMACHINE_LEN__ == 4                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                     "\r
+#elif __BUILDMACHINE_LEN__ == 3                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                      "\r
+#elif __BUILDMACHINE_LEN__ == 2                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                       "\r
+#elif __BUILDMACHINE_LEN__ == 1                                \r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG "                        "\r
+#else\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG\r
+#endif\r
+#else\r
+#define BUILD_MACHINE_TAG_PADDED BUILD_MACHINE_TAG\r
+#endif\r
+#else\r
+#define BUILD_MACHINE_TAG\r
+#define BUILD_MACHINE_TAG_PADDED\r
+#endif\r
+\r
+//\r
+// Set default neutral Unicode Language ID\r
+//\r
+#ifndef VER_VERSION_UNICODE_LANG\r
+#define VER_VERSION_UNICODE_LANG  "000004B0"\r
+#endif\r
+\r
+//\r
+// Set default netural ANSI Language ID\r
+//\r
+#ifndef VER_VERSION_ANSI_LANG\r
+#define VER_VERSION_ANSI_LANG     "000004E4"\r
+#endif\r
+\r
+//\r
+// Set default netural translation ID\r
+//\r
+#ifndef VER_VERSION_TRANSLATION\r
+#define VER_VERSION_TRANSLATION   0x0000, 0x04B0\r
+#endif\r
+\r
+//\r
+// Make sure the Resource Compiler called us.\r
+// If so, then build the actual version resource.\r
+//\r
+#ifdef RC_INVOKED\r
+\r
+VS_VERSION_INFO VERSIONINFO\r
+FILEVERSION    VER_FILEVERSION\r
+PRODUCTVERSION VER_PRODUCTVERSION\r
+FILEFLAGSMASK  VER_FILEFLAGSMASK\r
+FILEFLAGS      VER_FILEFLAGS\r
+FILEOS         VER_FILEOS\r
+FILETYPE       VER_FILETYPE\r
+FILESUBTYPE    VER_FILESUBTYPE\r
+BEGIN\r
+    BLOCK "StringFileInfo"\r
+    BEGIN\r
+        BLOCK VER_VERSION_UNICODE_LANG\r
+        BEGIN\r
+            VALUE "CompanyName",     VER_COMPANYNAME_STR\r
+            VALUE "FileDescription", VER_FILEDESCRIPTION_STR\r
+            VALUE "FileVersion",     VER_FILEVERSION_STR BUILD_MACHINE_TAG_PADDED\r
+            VALUE "InternalName",    VER_INTERNALNAME_STR\r
+            VALUE "LegalCopyright",  VER_LEGALCOPYRIGHT_STR\r
+            VALUE "OriginalFilename",VER_ORIGINALFILENAME_STR\r
+            VALUE "ProductName",     VER_PRODUCTNAME_STR\r
+            VALUE "ProductVersion",  VER_PRODUCTVERSION_STR\r
+#ifdef VER_OLESELFREGISTER\r
+            VALUE "OleSelfRegister", "\0"\r
+#endif\r
+        END\r
+\r
+#ifdef VER_ANSICP\r
+    BLOCK VER_VERSION_ANSI_LANG\r
+        BEGIN\r
+            VALUE "CompanyName",     VER_COMPANYNAME_STR\r
+            VALUE "FileDescription", VER_FILEDESCRIPTION_STR EXPORT_TAG\r
+            VALUE "FileVersion",     VER_FILEVERSION_STR\r
+            VALUE "InternalName",    VER_INTERNALNAME_STR\r
+            VALUE "LegalCopyright",  VER_LEGALCOPYRIGHT_STR\r
+            VALUE "OriginalFilename",VER_ORIGINALFILENAME_STR\r
+            VALUE "ProductName",     VER_PRODUCTNAME_STR\r
+            VALUE "ProductVersion",  VER_PRODUCTVERSION_STR\r
+#ifdef VER_OLESELFREGISTER\r
+            VALUE "OleSelfRegister", "\0"\r
+#endif\r
+        END\r
+#endif\r
+    END\r
+\r
+    BLOCK "VarFileInfo"\r
+    BEGIN\r
+        VALUE "Translation", VER_VERSION_TRANSLATION\r
+    END\r
+END\r
+\r
+#endif\r
index 05d18b0..8938f46 100644 (file)
@@ -89,6 +89,21 @@ typedef struct _OBJECT_ATTRIBUTES {
   PVOID SecurityQualityOfService;
 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
 #endif
+
+typedef struct LIST_ENTRY32
+{
+    ULONG Flink;
+    ULONG Blink;
+} LIST_ENTRY32;
+typedef LIST_ENTRY32 *PLIST_ENTRY32;
+
+typedef struct LIST_ENTRY64
+{
+    ULONGLONG Flink;
+    ULONGLONG Blink;
+} LIST_ENTRY64;
+typedef LIST_ENTRY64 *PLIST_ENTRY64;
+
 #define NOTHING
 #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s }
 #define TYPE_ALIGNMENT( t ) FIELD_OFFSET( struct { char x; t test; }, test )
diff --git a/reactos/include/psdk/ntverp.h b/reactos/include/psdk/ntverp.h
new file mode 100644 (file)
index 0000000..bfcc432
--- /dev/null
@@ -0,0 +1,151 @@
+/*\r
+ * PROJECT:         ReactOS\r
+ * LICENSE:         GPL - See COPYING in the top level directory\r
+ * FILE:            include/psdk/ntverp.h\r
+ * PURPOSE:         Master Version File.\r
+ *                  This file should be modified only by the official builder\r
+ *                  to update VERSION, VER_PRODUCTVERSION, VER_PRODUCTVERSION_\r
+ *                  STR and VER_PRODUCTBETA_STR values.\r
+ *                  The VER_PRODUCTBUILD lines must contain the product\r
+ *                  comments and end with the build#<CR><LF>.\r
+ *                  The VER_PRODUCTBETA_STR lines must contain the product\r
+ *                  comments and end with "somestring"<CR><LF.\r
+ * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)\r
+ */\r
+\r
+//\r
+// Windows NT Build 3790.1830\r
+//\r
+#define VER_PRODUCTBUILD                    3790\r
+#define VER_PRODUCTBUILD_QFE                1830\r
+\r
+//\r
+// Windows NT Version 5.2\r
+//\r
+#define VER_PRODUCTMAJORVERSION             5\r
+#define VER_PRODUCTMINORVERSION             2\r
+#define VER_PRODUCTVERSION_W                (0x0502)\r
+#define VER_PRODUCTVERSION_DW               (0x05020000 | VER_PRODUCTBUILD)\r
+\r
+//\r
+// Not a beta\r
+//\r
+#define VER_PRODUCTBETA_STR                 ""\r
+\r
+//\r
+// ANSI String Generating Macros\r
+//\r
+#define VER_PRODUCTVERSION_MAJORMINOR2(x,y) \\r
+    #x "." #y\r
+#define VER_PRODUCTVERSION_MAJORMINOR1(x,y) \\r
+    VER_PRODUCTVERSION_MAJORMINOR2(x, y)\r
+#define VER_PRODUCTVERSION_STRING           \\r
+    VER_PRODUCTVERSION_MAJORMINOR1(VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION)\r
+\r
+//\r
+// Unicode String Generating Macros\r
+//\r
+#define LVER_PRODUCTVERSION_MAJORMINOR2(x,y)\\r
+    L#x L"." L#y\r
+#define LVER_PRODUCTVERSION_MAJORMINOR1(x,y)\\r
+    LVER_PRODUCTVERSION_MAJORMINOR2(x, y)\r
+#define LVER_PRODUCTVERSION_STRING          \\r
+    LVER_PRODUCTVERSION_MAJORMINOR1(VER_PRODUCTMAJORVERSION, VER_PRODUCTMINORVERSION)\r
+\r
+//\r
+// Full Product Version\r
+//\r
+#define VER_PRODUCTVERSION                  \\r
+    VER_PRODUCTMAJORVERSION,VER_PRODUCTMINORVERSION,VER_PRODUCTBUILD,VER_PRODUCTBUILD_QFE\r
+\r
+//\r
+// Padding for ANSI Version String\r
+//\r
+#if     (VER_PRODUCTBUILD < 10)\r
+#define VER_BPAD "000"\r
+#elif   (VER_PRODUCTBUILD < 100)\r
+#define VER_BPAD "00"\r
+#elif   (VER_PRODUCTBUILD < 1000)\r
+#define VER_BPAD "0"\r
+#else\r
+#define VER_BPAD\r
+#endif\r
+\r
+//\r
+// Padding for Unicode Version String\r
+//\r
+#if     (VER_PRODUCTBUILD < 10)\r
+#define LVER_BPAD L"000"\r
+#elif   (VER_PRODUCTBUILD < 100)\r
+#define LVER_BPAD L"00"\r
+#elif   (VER_PRODUCTBUILD < 1000)\r
+#define LVER_BPAD L"0"\r
+#else\r
+#define LVER_BPAD\r
+#endif\r
+\r
+//\r
+// ANSI Product Version String\r
+//\r
+#define VER_PRODUCTVERSION_STR2(x,y)        \\r
+    VER_PRODUCTVERSION_STRING "." VER_BPAD #x "." #y\r
+#define VER_PRODUCTVERSION_STR1(x,y)        \\r
+    VER_PRODUCTVERSION_STR2(x, y)\r
+#define VER_PRODUCTVERSION_STR              \\r
+    VER_PRODUCTVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)\r
+\r
+//\r
+// Unicode Product Version String\r
+//\r
+#define LVER_PRODUCTVERSION_STR2(x,y)       \\r
+    LVER_PRODUCTVERSION_STRING L"." LVER_BPAD L#x L"." L#y\r
+#define LVER_PRODUCTVERSION_STR1(x,y)       \\r
+    LVER_PRODUCTVERSION_STR2(x, y)\r
+#define LVER_PRODUCTVERSION_STR             \\r
+    LVER_PRODUCTVERSION_STR1(VER_PRODUCTBUILD, VER_PRODUCTBUILD_QFE)\r
+\r
+//\r
+// Debug Flag\r
+//\r
+#if DBG\r
+#define VER_DEBUG                           VS_FF_DEBUG\r
+#else\r
+#define VER_DEBUG                           0\r
+#endif\r
+\r
+//\r
+// Beta Flag\r
+//\r
+#if BETA\r
+#define VER_PRERELEASE                      VS_FF_PRERELEASE\r
+#else\r
+#define VER_PRERELEASE                      0\r
+#endif\r
+\r
+//\r
+// Internal Flag\r
+//\r
+#if OFFICIAL_BUILD\r
+#define VER_PRIVATE                         0\r
+#else\r
+#define VER_PRIVATE                         VS_FF_PRIVATEBUILD\r
+#endif\r
+\r
+//\r
+// Other Flags\r
+//\r
+#define VER_FILEFLAGSMASK                   VS_FFI_FILEFLAGSMASK\r
+#define VER_FILEOS                          VOS_NT_WINDOWS32\r
+#define VER_FILEFLAGS                       (VER_PRERELEASE | \\r
+                                             VER_DEBUG | \\r
+                                             VER_PRIVATE)\r
+\r
+//\r
+// Company and Trademarks\r
+//\r
+#define VER_COMPANYNAME_STR                 \\r
+    "ReactOS(R) Foundation"\r
+#define VER_PRODUCTNAME_STR                 \\r
+    "ReactOS(R) Operating System"\r
+#define VER_LEGALTRADEMARKS_STR             \\r
+    "ReactOS(R) is a registered trademark of the ReactOS Foundation."\r
diff --git a/reactos/include/psdk/wdbgexts.h b/reactos/include/psdk/wdbgexts.h
new file mode 100644 (file)
index 0000000..e1948c4
--- /dev/null
@@ -0,0 +1,191 @@
+#ifndef _WDBGEXTS_\r
+#define _WDBGEXTS_\r
+\r
+enum\r
+{\r
+    DBGKD_SIMULATION_NONE,\r
+    DBGKD_SIMULATION_EXDI\r
+};\r
+\r
+#define KD_SECONDARY_VERSION_DEFAULT                    0\r
+#define KD_SECONDARY_VERSION_AMD64_OBSOLETE_CONTEXT_1   0\r
+#define KD_SECONDARY_VERSION_AMD64_OBSOLETE_CONTEXT_2   1\r
+#define KD_SECONDARY_VERSION_AMD64_CONTEXT              2\r
+#define CURRENT_KD_SECONDARY_VERSION                    KD_SECONDARY_VERSION_DEFAULT\r
+\r
+#define DBGKD_VERS_FLAG_MP                              0x0001\r
+#define DBGKD_VERS_FLAG_DATA                            0x0002\r
+#define DBGKD_VERS_FLAG_PTR64                           0x0004\r
+#define DBGKD_VERS_FLAG_NOMM                            0x0008\r
+#define DBGKD_VERS_FLAG_HSS                             0x0010\r
+#define DBGKD_VERS_FLAG_PARTITIONS                      0x0020\r
+\r
+#define KDBG_TAG                                        TAG('K', 'D', 'B', 'G')\r
+\r
+typedef struct _DBGKD_GET_VERSION64\r
+{\r
+    USHORT MajorVersion;\r
+    USHORT MinorVersion;\r
+    UCHAR ProtocolVersion;\r
+    UCHAR KdSecondaryVersion;\r
+    USHORT Flags;\r
+    USHORT MachineType;\r
+    UCHAR MaxPacketType;\r
+    UCHAR MaxStateChange;\r
+    UCHAR MaxManipulate;\r
+    UCHAR Simulation;\r
+    USHORT Unused[1];\r
+    ULONG64 KernBase;\r
+    ULONG64 PsLoadedModuleList;\r
+    ULONG64 DebuggerDataList;\r
+} DBGKD_GET_VERSION64, *PDBGKD_GET_VERSION64;\r
+\r
+typedef struct _DBGKD_DEBUG_DATA_HEADER64\r
+{\r
+    LIST_ENTRY64 List;\r
+    ULONG OwnerTag;\r
+    ULONG Size;\r
+} DBGKD_DEBUG_DATA_HEADER64, *PDBGKD_DEBUG_DATA_HEADER64;\r
+\r
+typedef union _GCC_ULONG64\r
+{\r
+    ULONG_PTR Pointer;\r
+    ULONG64 RealPointer;\r
+} GCC_ULONG64, *PGCC_ULONG64;\r
+\r
+typedef struct _KDDEBUGGER_DATA64\r
+{\r
+    DBGKD_DEBUG_DATA_HEADER64 Header;\r
+    ULONG64 KernBase;\r
+    GCC_ULONG64 BreakpointWithStatus;\r
+    ULONG64 SavedContext;\r
+    USHORT ThCallbackStack;\r
+    USHORT NextCallback;\r
+    USHORT FramePointer;\r
+    USHORT PaeEnabled:1;\r
+    GCC_ULONG64 KiCallUserMode;\r
+    GCC_ULONG64 KeUserCallbackDispatcher;\r
+    GCC_ULONG64 PsLoadedModuleList;\r
+    GCC_ULONG64 PsActiveProcessHead;\r
+    GCC_ULONG64 PspCidTable;\r
+    GCC_ULONG64 ExpSystemResourcesList;\r
+    GCC_ULONG64 ExpPagedPoolDescriptor;\r
+    GCC_ULONG64 ExpNumberOfPagedPools;\r
+    GCC_ULONG64 KeTimeIncrement;\r
+    GCC_ULONG64 KeBugCheckCallbackListHead;\r
+    GCC_ULONG64 KiBugcheckData;\r
+    GCC_ULONG64 IopErrorLogListHead;\r
+    GCC_ULONG64 ObpRootDirectoryObject;\r
+    GCC_ULONG64 ObpTypeObjectType;\r
+    GCC_ULONG64 MmSystemCacheStart;\r
+    GCC_ULONG64 MmSystemCacheEnd;\r
+    GCC_ULONG64 MmSystemCacheWs;\r
+    GCC_ULONG64 MmPfnDatabase;\r
+    GCC_ULONG64 MmSystemPtesStart;\r
+    GCC_ULONG64 MmSystemPtesEnd;\r
+    GCC_ULONG64 MmSubsectionBase;\r
+    GCC_ULONG64 MmNumberOfPagingFiles;\r
+    GCC_ULONG64 MmLowestPhysicalPage;\r
+    GCC_ULONG64 MmHighestPhysicalPage;\r
+    GCC_ULONG64 MmNumberOfPhysicalPages;\r
+    GCC_ULONG64 MmMaximumNonPagedPoolInBytes;\r
+    GCC_ULONG64 MmNonPagedSystemStart;\r
+    GCC_ULONG64 MmNonPagedPoolStart;\r
+    GCC_ULONG64 MmNonPagedPoolEnd;\r
+    GCC_ULONG64 MmPagedPoolStart;\r
+    GCC_ULONG64 MmPagedPoolEnd;\r
+    GCC_ULONG64 MmPagedPoolInformation;\r
+    ULONG64 MmPageSize;\r
+    GCC_ULONG64 MmSizeOfPagedPoolInBytes;\r
+    GCC_ULONG64 MmTotalCommitLimit;\r
+    GCC_ULONG64 MmTotalCommittedPages;\r
+    GCC_ULONG64 MmSharedCommit;\r
+    GCC_ULONG64 MmDriverCommit;\r
+    GCC_ULONG64 MmProcessCommit;\r
+    GCC_ULONG64 MmPagedPoolCommit;\r
+    GCC_ULONG64 MmExtendedCommit;\r
+    GCC_ULONG64 MmZeroedPageListHead;\r
+    GCC_ULONG64 MmFreePageListHead;\r
+    GCC_ULONG64 MmStandbyPageListHead;\r
+    GCC_ULONG64 MmModifiedPageListHead;\r
+    GCC_ULONG64 MmModifiedNoWritePageListHead;\r
+    GCC_ULONG64 MmAvailablePages;\r
+    GCC_ULONG64 MmResidentAvailablePages;\r
+    GCC_ULONG64 PoolTrackTable;\r
+    GCC_ULONG64 NonPagedPoolDescriptor;\r
+    GCC_ULONG64 MmHighestUserAddress;\r
+    GCC_ULONG64 MmSystemRangeStart;\r
+    GCC_ULONG64 MmUserProbeAddress;\r
+    GCC_ULONG64 KdPrintCircularBuffer;\r
+    GCC_ULONG64 KdPrintCircularBufferEnd;\r
+    GCC_ULONG64 KdPrintWritePointer;\r
+    GCC_ULONG64 KdPrintRolloverCount;\r
+    GCC_ULONG64 MmLoadedUserImageList;\r
+    GCC_ULONG64 NtBuildLab;\r
+    GCC_ULONG64 KiNormalSystemCall;\r
+    GCC_ULONG64 KiProcessorBlock;\r
+    GCC_ULONG64 MmUnloadedDrivers;\r
+    GCC_ULONG64 MmLastUnloadedDriver;\r
+    GCC_ULONG64 MmTriageActionTaken;\r
+    GCC_ULONG64 MmSpecialPoolTag;\r
+    GCC_ULONG64 KernelVerifier;\r
+    GCC_ULONG64 MmVerifierData;\r
+    GCC_ULONG64 MmAllocatedNonPagedPool;\r
+    GCC_ULONG64 MmPeakCommitment;\r
+    GCC_ULONG64 MmTotalCommitLimitMaximum;\r
+    GCC_ULONG64 CmNtCSDVersion;\r
+    GCC_ULONG64 MmPhysicalMemoryBlock;\r
+    GCC_ULONG64 MmSessionBase;\r
+    GCC_ULONG64 MmSessionSize;\r
+    GCC_ULONG64 MmSystemParentTablePage;\r
+    GCC_ULONG64 MmVirtualTranslationBase;\r
+    USHORT OffsetKThreadNextProcessor;\r
+    USHORT OffsetKThreadTeb;\r
+    USHORT OffsetKThreadKernelStack;\r
+    USHORT OffsetKThreadInitialStack;\r
+    USHORT OffsetKThreadApcProcess;\r
+    USHORT OffsetKThreadState;\r
+    USHORT OffsetKThreadBStore;\r
+    USHORT OffsetKThreadBStoreLimit;\r
+    USHORT SizeEProcess;\r
+    USHORT OffsetEprocessPeb;\r
+    USHORT OffsetEprocessParentCID;\r
+    USHORT OffsetEprocessDirectoryTableBase;\r
+    USHORT SizePrcb;\r
+    USHORT OffsetPrcbDpcRoutine;\r
+    USHORT OffsetPrcbCurrentThread;\r
+    USHORT OffsetPrcbMhz;\r
+    USHORT OffsetPrcbCpuType;\r
+    USHORT OffsetPrcbVendorString;\r
+    USHORT OffsetPrcbProcStateContext;\r
+    USHORT OffsetPrcbNumber;\r
+    USHORT SizeEThread;\r
+    GCC_ULONG64 KdPrintCircularBufferPtr;\r
+    GCC_ULONG64 KdPrintBufferSize;\r
+    GCC_ULONG64 KeLoaderBlock;\r
+    USHORT SizePcr;\r
+    USHORT OffsetPcrSelfPcr;\r
+    USHORT OffsetPcrCurrentPrcb;\r
+    USHORT OffsetPcrContainedPrcb;\r
+    USHORT OffsetPcrInitialBStore;\r
+    USHORT OffsetPcrBStoreLimit;\r
+    USHORT OffsetPcrInitialStack;\r
+    USHORT OffsetPcrStackLimit;\r
+    USHORT OffsetPrcbPcrPage;\r
+    USHORT OffsetPrcbProcStateSpecialReg;\r
+    USHORT GdtR0Code;\r
+    USHORT GdtR0Data;\r
+    USHORT GdtR0Pcr;\r
+    USHORT GdtR3Code;\r
+    USHORT GdtR3Data;\r
+    USHORT GdtR3Teb;\r
+    USHORT GdtLdt;\r
+    USHORT GdtTss;\r
+    USHORT Gdt64R3CmCode;\r
+    USHORT Gdt64R3CmTeb;\r
+    GCC_ULONG64 IopNumTriageDumpDataBlocks;\r
+    GCC_ULONG64 IopTriageDumpDataBlocks;\r
+    GCC_ULONG64 VfCrashDataBlock;\r
+} KDDEBUGGER_DATA64, *PKDDEBUGGER_DATA64;\r
+\r
+#endif\r
diff --git a/reactos/include/reactos/kddll.h b/reactos/include/reactos/kddll.h
new file mode 100644 (file)
index 0000000..4d90999
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef _KDDLL_\r
+#define _KDDLL_\r
+\r
+typedef enum _KDSTATUS\r
+{\r
+    KdPacketReceived = 0,\r
+    KdPacketTimedOut,\r
+    KdPacketNeedsResend\r
+} KDSTATUS;\r
+\r
+NTSTATUS\r
+NTAPI\r
+KdDebuggerInitialize0(\r
+    IN PLOADER_PARAMETER_BLOCK LoaderBlock\r
+);\r
+\r
+NTSTATUS\r
+NTAPI\r
+KdDebuggerInitialize1(\r
+    IN PLOADER_PARAMETER_BLOCK LoaderBlock\r
+);\r
+\r
+KDSTATUS\r
+NTAPI\r
+KdReceivePacket(\r
+    IN ULONG PacketType,\r
+    OUT PSTRING MessageHeader,\r
+    OUT PSTRING MessageData,\r
+    OUT PULONG DataLength,\r
+    IN OUT PKD_CONTEXT Context\r
+);\r
+\r
+NTSTATUS\r
+NTAPI\r
+KdRestore(\r
+    IN BOOLEAN SleepTransition\r
+);\r
+\r
+NTSTATUS\r
+NTAPI\r
+KdSave(\r
+    IN BOOLEAN SleepTransition\r
+);\r
+\r
+VOID\r
+NTAPI\r
+KdSendPacket(\r
+    IN ULONG PacketType,\r
+    IN PSTRING MessageHeader,\r
+    IN PSTRING MessageData,\r
+    IN OUT PKD_CONTEXT Context\r
+);\r
+\r
+#endif\r
diff --git a/reactos/include/reactos/windbgkd.h b/reactos/include/reactos/windbgkd.h
new file mode 100644 (file)
index 0000000..582afbd
--- /dev/null
@@ -0,0 +1,488 @@
+#ifndef _WINDBGKD_\r
+#define _WINDBGKG_\r
+\r
+//\r
+// Dependencies\r
+//\r
+#include "wdbgexts.h"\r
+\r
+//\r
+// Conversion Macros\r
+//\r
+#define COPYSE(p64, p32, f)                 \\r
+    p64->f = (ULONG64)(LONG64)(LONG)p32->f\r
+\r
+//\r
+// Packet Size and Control Stream Size\r
+//\r
+#define PACKET_MAX_SIZE                     4000\r
+#define DBGKD_MAXSTREAM                     16\r
+\r
+//\r
+// Magic Packet IDs\r
+//\r
+#define INITIAL_PACKET_ID                   0x80800000\r
+#define SYNC_PACKET_ID                      0x00000800\r
+\r
+//\r
+// Magic Packet bytes\r
+//\r
+#define BREAKIN_PACKET                      0x62626262\r
+#define BREAKIN_PACKET_BYTE                 0x62\r
+#define PACKET_LEADER                       0x30303030\r
+#define PACKET_LEADER_BYTE                  0x30\r
+#define CONTROL_PACKET_LEADER               0x69696969\r
+#define CONTROL_PACKET_LEADER_BYTE          0x69\r
+#define PACKET_TRAILING_BYTE                0xAA\r
+\r
+//\r
+// Packet Types\r
+//\r
+#define PACKET_TYPE_UNUSED                  0\r
+#define PACKET_TYPE_KD_STATE_CHANGE32       1\r
+#define PACKET_TYPE_KD_STATE_MANIPULATE     2\r
+#define PACKET_TYPE_KD_DEBUG_IO             3\r
+#define PACKET_TYPE_KD_ACKNOWLEDGE          4\r
+#define PACKET_TYPE_KD_RESEND               5\r
+#define PACKET_TYPE_KD_RESET                6\r
+#define PACKET_TYPE_KD_STATE_CHANGE64       7\r
+#define PACKET_TYPE_KD_POLL_BREAKIN         8\r
+#define PACKET_TYPE_KD_TRACE_IO             9\r
+#define PACKET_TYPE_KD_CONTROL_REQUEST      10\r
+#define PACKET_TYPE_KD_FILE_IO              11\r
+#define PACKET_TYPE_MAX                     12\r
+\r
+//\r
+// Wait State Change Types\r
+//\r
+#define DbgKdMinimumStateChange             0x00003030\r
+#define DbgKdExceptionStateChange           0x00003030\r
+#define DbgKdLoadSymbolsStateChange         0x00003031\r
+#define DbgKdCommandStringStateChange       0x00003032\r
+#define DbgKdMaximumStateChange             0x00003033\r
+\r
+//\r
+// Manipulate Types\r
+//\r
+#define DbgKdMinimumManipulate              0x00003130\r
+#define DbgKdReadVirtualMemoryApi           0x00003130\r
+#define DbgKdWriteVirtualMemoryApi          0x00003131\r
+#define DbgKdGetContextApi                  0x00003132\r
+#define DbgKdSetContextApi                  0x00003133\r
+#define DbgKdWriteBreakPointApi             0x00003134\r
+#define DbgKdRestoreBreakPointApi           0x00003135\r
+#define DbgKdContinueApi                    0x00003136\r
+#define DbgKdReadControlSpaceApi            0x00003137\r
+#define DbgKdWriteControlSpaceApi           0x00003138\r
+#define DbgKdReadIoSpaceApi                 0x00003139\r
+#define DbgKdWriteIoSpaceApi                0x0000313A\r
+#define DbgKdRebootApi                      0x0000313B\r
+#define DbgKdContinueApi2                   0x0000313C\r
+#define DbgKdReadPhysicalMemoryApi          0x0000313D\r
+#define DbgKdWritePhysicalMemoryApi         0x0000313E\r
+#define DbgKdQuerySpecialCallsApi           0x0000313F\r
+#define DbgKdSetSpecialCallApi              0x00003140\r
+#define DbgKdClearSpecialCallsApi           0x00003141\r
+#define DbgKdSetInternalBreakPointApi       0x00003142\r
+#define DbgKdGetInternalBreakPointApi       0x00003143\r
+#define DbgKdReadIoSpaceExtendedApi         0x00003144\r
+#define DbgKdWriteIoSpaceExtendedApi        0x00003145\r
+#define DbgKdGetVersionApi                  0x00003146\r
+#define DbgKdWriteBreakPointExApi           0x00003147\r
+#define DbgKdRestoreBreakPointExApi         0x00003148\r
+#define DbgKdCauseBugCheckApi               0x00003149\r
+#define DbgKdSwitchProcessor                0x00003150\r
+#define DbgKdPageInApi                      0x00003151\r
+#define DbgKdReadMachineSpecificRegister    0x00003152\r
+#define DbgKdWriteMachineSpecificRegister   0x00003153\r
+#define OldVlm1                             0x00003154\r
+#define OldVlm2                             0x00003155\r
+#define DbgKdSearchMemoryApi                0x00003156\r
+#define DbgKdGetBusDataApi                  0x00003157\r
+#define DbgKdSetBusDataApi                  0x00003158\r
+#define DbgKdCheckLowMemoryApi              0x00003159\r
+#define DbgKdClearAllInternalBreakpointsApi 0x0000315A\r
+#define DbgKdFillMemoryApi                  0x0000315B\r
+#define DbgKdQueryMemoryApi                 0x0000315C\r
+#define DbgKdSwitchPartition                0x0000315D\r
+#define DbgKdMaximumManipulate              0x0000315E\r
+\r
+//\r
+// Debug I/O Types\r
+//\r
+#define DbgKdPrintStringApi                 0x00003230\r
+#define DbgKdGetStringApi                   0x00003231\r
+\r
+//\r
+// Control Report Flags\r
+//\r
+#define REPORT_INCLUDES_SEGS                0x0001\r
+#define REPORT_INCLUDES_CS                  0x0002\r
+\r
+//\r
+// Protocol Versions\r
+//\r
+#define DBGKD_64BIT_PROTOCOL_VERSION1       5\r
+#define DBGKD_64BIT_PROTOCOL_VERSION2       6\r
+\r
+//\r
+// KD Packet Structure\r
+//\r
+typedef struct _KD_PACKET\r
+{\r
+    ULONG PacketLeader;\r
+    USHORT PacketType;\r
+    USHORT ByteCount;\r
+    ULONG PacketId;\r
+    ULONG Checksum;\r
+} KD_PACKET, *PKD_PACKET;\r
+\r
+//\r
+// KD Context\r
+//\r
+typedef struct _KD_CONTEXT\r
+{\r
+    ULONG KdpDefaultRetries;\r
+    BOOLEAN KdpControlCPending;\r
+} KD_CONTEXT, *PKD_CONTEXT;\r
+\r
+//\r
+// Control Sets for Supported Architectures\r
+//\r
+#include <pshpack4.h>\r
+typedef struct _X86_DBGKD_CONTROL_SET\r
+{\r
+    ULONG TraceFlag;\r
+    ULONG Dr7;\r
+    ULONG CurrentSymbolStart;\r
+    ULONG CurrentSymbolEnd;\r
+} X86_DBGKD_CONTROL_SET, *PX86_DBGKD_CONTROL_SET;\r
+\r
+typedef struct _IA64_DBGKD_CONTROL_SET\r
+{\r
+    ULONG Continue;\r
+    ULONG64 CurrentSymbolStart;\r
+    ULONG64 CurrentSymbolEnd;\r
+} IA64_DBGKD_CONTROL_SET, *PIA64_DBGKD_CONTROL_SET;\r
+\r
+typedef struct _AMD64_DBGKD_CONTROL_SET\r
+{\r
+    ULONG TraceFlag;\r
+    ULONG64 Dr7;\r
+    ULONG64 CurrentSymbolStart;\r
+    ULONG64 CurrentSymbolEnd;\r
+} AMD64_DBGKD_CONTROL_SET, *PAMD64_DBGKD_CONTROL_SET;\r
+\r
+typedef struct _DBGKD_ANY_CONTROL_SET\r
+{\r
+    union\r
+    {\r
+        X86_DBGKD_CONTROL_SET X86ControlSet;\r
+        IA64_DBGKD_CONTROL_SET IA64ControlSet;\r
+        AMD64_DBGKD_CONTROL_SET Amd64ControlSet;\r
+    };\r
+} DBGKD_ANY_CONTROL_SET, *PDBGKD_ANY_CONTROL_SET;\r
+#include <poppack.h>\r
+\r
+typedef X86_DBGKD_CONTROL_SET DBGKD_CONTROL_SET;\r
+\r
+//\r
+// DBGKM Structure for Exceptions\r
+//\r
+typedef struct _DBGKM_EXCEPTION64\r
+{\r
+    EXCEPTION_RECORD64 ExceptionRecord;\r
+    ULONG FirstChance;\r
+} DBGKM_EXCEPTION64, *PDBGKM_EXCEPTION64;\r
+\r
+//\r
+// DBGKD Structure for State Change\r
+//\r
+typedef struct _DBGKD_CONTROL_REPORT\r
+{\r
+    ULONG Dr6;\r
+    ULONG Dr7;\r
+    USHORT InstructionCount;\r
+    USHORT ReportFlags;\r
+    UCHAR InstructionStream[DBGKD_MAXSTREAM];\r
+    USHORT SegCs;\r
+    USHORT SegDs;\r
+    USHORT SegEs;\r
+    USHORT SegFs;\r
+    ULONG EFlags;\r
+} DBGKD_CONTROL_REPORT, *PDBGKD_CONTROL_REPORT;\r
+\r
+//\r
+// DBGKD Structure for Debug I/O Type Print String\r
+//\r
+typedef struct _DBGKD_PRINT_STRING\r
+{\r
+    ULONG LengthOfString;\r
+} DBGKD_PRINT_STRING, *PDBGKD_PRINT_STRING;\r
+\r
+//\r
+// DBGKD Structure for Debug I/O Type Get String\r
+//\r
+typedef struct _DBGKD_GET_STRING\r
+{\r
+    ULONG LengthOfPromptString;\r
+    ULONG LengthOfStringRead;\r
+} DBGKD_GET_STRING, *PDBGKD_GET_STRING;\r
+\r
+//\r
+// DBGKD Structure for Debug I/O\r
+//\r
+typedef struct _DBGKD_DEBUG_IO\r
+{\r
+    ULONG ApiNumber;\r
+    USHORT ProcessorLevel;\r
+    USHORT Processor;\r
+    union\r
+    {\r
+        DBGKD_PRINT_STRING PrintString;\r
+        DBGKD_GET_STRING GetString;\r
+    } u;\r
+} DBGKD_DEBUG_IO, *PDBGKD_DEBUG_IO;\r
+\r
+//\r
+// DBGKD Structure for Load Symbols\r
+//\r
+typedef struct _DBGKD_LOAD_SYMBOLS64\r
+{\r
+    ULONG PathNameLength;\r
+    ULONG64 BaseOfDll;\r
+    ULONG64 ProcessId;\r
+    ULONG CheckSum;\r
+    ULONG SizeOfImage;\r
+    BOOLEAN UnloadSymbols;\r
+} DBGKD_LOAD_SYMBOLS64, *PDBGKD_LOAD_SYMBOLS64;\r
+\r
+//\r
+// DBGKD Structure for Wait State Change\r
+//\r
+typedef struct _DBGKD_WAIT_STATE_CHANGE64\r
+{\r
+    ULONG NewState;\r
+    USHORT ProcessorLevel;\r
+    USHORT Processor;\r
+    ULONG NumberProcessors;\r
+    ULONG64 Thread;\r
+    ULONG64 ProgramCounter;\r
+    union\r
+    {\r
+        DBGKM_EXCEPTION64 Exception;\r
+        DBGKD_LOAD_SYMBOLS64 LoadSymbols;\r
+    } u;\r
+    DBGKD_CONTROL_REPORT ControlReport;\r
+    CONTEXT Context;\r
+} DBGKD_WAIT_STATE_CHANGE64, *PDBGKD_WAIT_STATE_CHANGE64;\r
+\r
+//\r
+// DBGKD Manipulate Structures\r
+//\r
+typedef struct _DBGKD_READ_MEMORY64\r
+{\r
+    ULONG64 TargetBaseAddress;\r
+    ULONG TransferCount;\r
+    ULONG ActualBytesRead;\r
+} DBGKD_READ_MEMORY64, *PDBGKD_READ_MEMORY64;\r
+\r
+typedef struct _DBGKD_WRITE_MEMORY64\r
+{\r
+    ULONG64 TargetBaseAddress;\r
+    ULONG TransferCount;\r
+    ULONG ActualBytesWritten;\r
+} DBGKD_WRITE_MEMORY64, *PDBGKD_WRITE_MEMORY64;\r
+\r
+typedef struct _DBGKD_GET_CONTEXT\r
+{\r
+    ULONG Unused;\r
+} DBGKD_GET_CONTEXT, *PDBGKD_GET_CONTEXT;\r
+\r
+typedef struct _DBGKD_SET_CONTEXT\r
+{\r
+    ULONG ContextFlags;\r
+} DBGKD_SET_CONTEXT, *PDBGKD_SET_CONTEXT;\r
+\r
+typedef struct _DBGKD_WRITE_BREAKPOINT64\r
+{\r
+    ULONG64 BreakPointAddress;\r
+    ULONG BreakPointHandle;\r
+} DBGKD_WRITE_BREAKPOINT64, *PDBGKD_WRITE_BREAKPOINT64;\r
+\r
+typedef struct _DBGKD_RESTORE_BREAKPOINT\r
+{\r
+    ULONG BreakPointHandle;\r
+} DBGKD_RESTORE_BREAKPOINT, *PDBGKD_RESTORE_BREAKPOINT;\r
+\r
+typedef struct _DBGKD_CONTINUE\r
+{\r
+    NTSTATUS ContinueStatus;\r
+} DBGKD_CONTINUE, *PDBGKD_CONTINUE;\r
+\r
+#include <pshpack4.h>\r
+typedef struct _DBGKD_CONTINUE2\r
+{\r
+    NTSTATUS ContinueStatus;\r
+    union\r
+    {\r
+        DBGKD_CONTROL_SET ControlSet;\r
+        DBGKD_ANY_CONTROL_SET AnyControlSet;\r
+    };\r
+} DBGKD_CONTINUE2, *PDBGKD_CONTINUE2;\r
+#include <poppack.h>\r
+\r
+typedef struct _DBGKD_READ_WRITE_IO64\r
+{\r
+    ULONG64 IoAddress;\r
+    ULONG DataSize;\r
+    ULONG DataValue;\r
+} DBGKD_READ_WRITE_IO64, *PDBGKD_READ_WRITE_IO64;\r
+\r
+typedef struct _DBGKD_READ_WRITE_IO_EXTENDED64\r
+{\r
+    ULONG DataSize;\r
+    ULONG InterfaceType;\r
+    ULONG BusNumber;\r
+    ULONG AddressSpace;\r
+    ULONG64 IoAddress;\r
+    ULONG DataValue;\r
+} DBGKD_READ_WRITE_IO_EXTENDED64, *PDBGKD_READ_WRITE_IO_EXTENDED64;\r
+\r
+typedef struct _DBGKD_READ_WRITE_MSR\r
+{\r
+    ULONG Msr;\r
+    ULONG DataValueLow;\r
+    ULONG DataValueHigh;\r
+} DBGKD_READ_WRITE_MSR, *PDBGKD_READ_WRITE_MSR;\r
+\r
+typedef struct _DBGKD_QUERY_SPECIAL_CALLS\r
+{\r
+    ULONG NumberOfSpecialCalls;\r
+} DBGKD_QUERY_SPECIAL_CALLS, *PDBGKD_QUERY_SPECIAL_CALLS;\r
+\r
+typedef struct _DBGKD_SET_SPECIAL_CALL64\r
+{\r
+    ULONG64 SpecialCall;\r
+} DBGKD_SET_SPECIAL_CALL64, *PDBGKD_SET_SPECIAL_CALL64;\r
+\r
+typedef struct _DBGKD_SET_INTERNAL_BREAKPOINT64\r
+{\r
+    ULONG64 BreakpointAddress;\r
+    ULONG Flags;\r
+} DBGKD_SET_INTERNAL_BREAKPOINT64, *PDBGKD_SET_INTERNAL_BREAKPOINT64;\r
+\r
+typedef struct _DBGKD_GET_INTERNAL_BREAKPOINT64\r
+{\r
+    ULONG64 BreakpointAddress;\r
+    ULONG Flags;\r
+    ULONG Calls;\r
+    ULONG MaxCallsPerPeriod;\r
+    ULONG MinInstructions;\r
+    ULONG MaxInstructions;\r
+    ULONG TotalInstructions;\r
+} DBGKD_GET_INTERNAL_BREAKPOINT64, *PDBGKD_GET_INTERNAL_BREAKPOINT64;\r
+\r
+typedef struct _DBGKD_BREAKPOINTEX\r
+{\r
+    ULONG BreakPointCount;\r
+    NTSTATUS ContinueStatus;\r
+} DBGKD_BREAKPOINTEX, *PDBGKD_BREAKPOINTEX;\r
+\r
+typedef struct _DBGKD_SEARCH_MEMORY\r
+{\r
+    union\r
+    {\r
+        ULONG64 SearchAddress;\r
+        ULONG64 FoundAddress;\r
+    };\r
+    ULONG64 SearchLength;\r
+    ULONG PatternLength;\r
+} DBGKD_SEARCH_MEMORY, *PDBGKD_SEARCH_MEMORY;\r
+\r
+typedef struct _DBGKD_GET_SET_BUS_DATA\r
+{\r
+    ULONG BusDataType;\r
+    ULONG BusNumber;\r
+    ULONG SlotNumber;\r
+    ULONG Offset;\r
+    ULONG Length;\r
+} DBGKD_GET_SET_BUS_DATA, *PDBGKD_GET_SET_BUS_DATA;\r
+\r
+typedef struct _DBGKD_FILL_MEMORY\r
+{\r
+    ULONG64 Address;\r
+    ULONG Length;\r
+    USHORT Flags;\r
+    USHORT PatternLength;\r
+} DBGKD_FILL_MEMORY, *PDBGKD_FILL_MEMORY;\r
+\r
+typedef struct _DBGKD_QUERY_MEMORY\r
+{\r
+    ULONG64 Address;\r
+    ULONG64 Reserved;\r
+    ULONG AddressSpace;\r
+    ULONG Flags;\r
+} DBGKD_QUERY_MEMORY, *PDBGKD_QUERY_MEMORY;\r
+\r
+typedef struct _DBGKD_SWITCH_PARTITION\r
+{\r
+    ULONG Partition;\r
+} DBGKD_SWITCH_PARTITION;\r
+\r
+//\r
+// DBGKD Structure for Manipulate\r
+//\r
+typedef struct _DBGKD_MANIPULATE_STATE64\r
+{\r
+    ULONG ApiNumber;\r
+    USHORT ProcessorLevel;\r
+    USHORT Processor;\r
+    NTSTATUS ReturnStatus;\r
+    union\r
+    {\r
+        DBGKD_READ_MEMORY64 ReadMemory;\r
+        DBGKD_WRITE_MEMORY64 WriteMemory;\r
+        DBGKD_GET_CONTEXT GetContext;\r
+        DBGKD_SET_CONTEXT SetContext;\r
+        DBGKD_WRITE_BREAKPOINT64 WriteBreakPoint;\r
+        DBGKD_RESTORE_BREAKPOINT RestoreBreakPoint;\r
+        DBGKD_CONTINUE Continue;\r
+        DBGKD_CONTINUE2 Continue2;\r
+        DBGKD_READ_WRITE_IO64 ReadWriteIo;\r
+        DBGKD_READ_WRITE_IO_EXTENDED64 ReadWriteIoExtended;\r
+        DBGKD_QUERY_SPECIAL_CALLS QuerySpecialCalls;\r
+        DBGKD_SET_SPECIAL_CALL64 SetSpecialCall;\r
+        DBGKD_SET_INTERNAL_BREAKPOINT64 SetInternalBreakpoint;\r
+        DBGKD_GET_INTERNAL_BREAKPOINT64 GetInternalBreakpoint;\r
+        DBGKD_GET_VERSION64 GetVersion64;\r
+        DBGKD_BREAKPOINTEX BreakPointEx;\r
+        DBGKD_READ_WRITE_MSR ReadWriteMsr;\r
+        DBGKD_SEARCH_MEMORY SearchMemory;\r
+        DBGKD_GET_SET_BUS_DATA GetSetBusData;\r
+        DBGKD_FILL_MEMORY FillMemory;\r
+        DBGKD_QUERY_MEMORY QueryMemory;\r
+        DBGKD_SWITCH_PARTITION SwitchPartition;\r
+    } u;\r
+} DBGKD_MANIPULATE_STATE64, *PDBGKD_MANIPULATE_STATE64;\r
+\r
+FORCEINLINE\r
+VOID\r
+ExceptionRecord32To64(IN PEXCEPTION_RECORD32 Ex32,\r
+                      OUT PEXCEPTION_RECORD64 Ex64)\r
+{\r
+    ULONG i;\r
+\r
+    Ex64->ExceptionCode = Ex32->ExceptionCode;\r
+    Ex64->ExceptionFlags = Ex32->ExceptionFlags;\r
+    Ex64->ExceptionRecord = Ex32->ExceptionRecord;\r
+    COPYSE(Ex64,Ex32,ExceptionAddress);\r
+    Ex64->NumberParameters = Ex32->NumberParameters;\r
+\r
+    for (i = 0; i < EXCEPTION_MAXIMUM_PARAMETERS; i++)\r
+    {\r
+        COPYSE(Ex64,Ex32,ExceptionInformation[i]);\r
+    }\r
+}\r
+\r
+#endif\r
index d846a3b..16d091b 100644 (file)
@@ -328,7 +328,7 @@ DbgLoadImageSymbols(IN PANSI_STRING Name,
 
     /* Setup the symbol data */
     SymbolInfo.BaseOfDll = Base;
-    SymbolInfo.ProcessId = UlongToPtr(ProcessId);
+    SymbolInfo.ProcessId = (ULONG)ProcessId;
 
     /* Get NT Headers */
     NtHeader = NULL; //RtlImageNtHeader(Base);
@@ -362,7 +362,7 @@ DbgUnLoadImageSymbols(IN PANSI_STRING Name,
 
     /* Setup the symbol data */
     SymbolInfo.BaseOfDll = Base;
-    SymbolInfo.ProcessId = (PVOID)ProcessId;
+    SymbolInfo.ProcessId = (ULONG)ProcessId;
     SymbolInfo.CheckSum = SymbolInfo.SizeOfImage = 0;
 
     /* Load the symbols */
index 832502d..79b7bad 100644 (file)
@@ -16,6 +16,7 @@
 .globl _DebugService@20
 .globl _DebugService2@12
 .globl _DbgBreakPointNoBugCheck@0
+.globl _RtlpBreakWithStatusInstruction@0
 
 /* FUNCTIONS ***************************************************************/
 
@@ -35,6 +36,8 @@ _DbgUserBreakPoint@0:
 .func DbgBreakPointWithStatus@4
 _DbgBreakPointWithStatus@4:
     mov eax, [esp+4]
+
+_RtlpBreakWithStatusInstruction@0:
     int 3
     ret 4
 .endfunc
index 2dc92f9..a762a27 100644 (file)
@@ -172,11 +172,11 @@ CmFindObject(POBJECT_CREATE_INFORMATION ObjectCreateInfo,
 
     if (ObjectCreateInfo->RootDirectory == NULL)
     {
-        ObReferenceObjectByPointer(NameSpaceRoot,
+        ObReferenceObjectByPointer(ObpRootDirectoryObject,
             DIRECTORY_TRAVERSE,
             CmiKeyType,
             ObjectCreateInfo->ProbeMode);
-        CurrentObject = NameSpaceRoot;
+        CurrentObject = ObpRootDirectoryObject;
     }
     else
     {
@@ -312,7 +312,7 @@ Next:
         if (Status == STATUS_REPARSE)
         {
             /* reparse the object path */
-            NextObject = NameSpaceRoot;
+            NextObject = ObpRootDirectoryObject;
             current = PathString.Buffer;
 
             ObReferenceObjectByPointer(NextObject,
index b82aff9..268c21c 100644 (file)
 #include <debug.h>
 //#include <ntoskrnl/cm/newcm.h>
 #include "ntoskrnl/cm/cm.h"
+#include <ntverp.h>
 
 /* DATA **********************************************************************/
 
-#define BUILD_OSCSDVERSION(major, minor) (((major & 0xFF) << 8) | (minor & 0xFF))
-
 /* NT Version Info */
-ULONG NtMajorVersion = 5;
-ULONG NtMinorVersion = 0;
-ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(4, 0);
-ULONG NtBuildNumber = KERNEL_VERSION_BUILD;
+ULONG NtMajorVersion = VER_PRODUCTMAJORVERSION;
+ULONG NtMinorVersion = VER_PRODUCTMINORVERSION;
+#if DBG
+ULONG NtBuildNumber = VER_PRODUCTBUILD | 0xC0000000;
+#else
+ULONG NtBuildNumber = VER_PRODUCTBUILD;
+#endif
+
+/* NT System Info */
 ULONG NtGlobalFlag;
 ULONG ExSuiteMask;
 
+/* Cm Version Info */
+ULONG CmNtSpBuildNumber;
+ULONG CmNtCSDVersion;
+ULONG CmNtCSDReleaseType;
+UNICODE_STRING CmVersionString;
+UNICODE_STRING CmCSDVersionString;
+CHAR NtBuildLab[] = KERNEL_VERSION_BUILD_STR;
+
 /* Init flags and settings */
 ULONG ExpInitializationPhase;
 BOOLEAN ExpInTextModeSetup;
@@ -671,11 +683,12 @@ ExpLoadBootSymbols(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
                 else
                 {
                     /* Copy the name */
-                    for (Count = 0; Count < Length; Count++, Name++)
+                    Count = 0;
+                    do
                     {
                         /* Copy the character */
-                        NameBuffer[Count] = (CHAR)*Name;
-                    }
+                        NameBuffer[Count++] = (CHAR)*Name++;
+                    } while (Count < Length);
 
                     /* Null-terminate */
                     NameBuffer[Count] = ANSI_NULL;
@@ -692,13 +705,14 @@ ExpLoadBootSymbols(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
                 {
                     /* Buffer too small */
                     OverFlow = TRUE;
+                    while (TRUE);
                 }
                 else
                 {
                     /* Otherwise build the name. HACKED for GCC :( */
                     sprintf(NameBuffer,
-                            "%c\\System32\\Drivers\\%S",
-                            SharedUserData->NtSystemRoot[2],
+                            "%S\\System32\\Drivers\\%S",
+                            &SharedUserData->NtSystemRoot[2],
                             LdrEntry->BaseDllName.Buffer);
                 }
             }
index e3a6963..86ceef4 100644 (file)
@@ -23,9 +23,45 @@ ULONG ExpLastTimeZoneBias = -1;
 LARGE_INTEGER ExpTimeZoneBias;
 ULONG ExpTimeZoneId;
 ULONG ExpTickCountMultiplier;
+ERESOURCE ExpTimeRefreshLock;
 
 /* FUNCTIONS ****************************************************************/
 
+BOOLEAN
+NTAPI
+ExAcquireTimeRefreshLock(BOOLEAN Wait)
+{
+    /* Simply acquire the Resource */
+    KeEnterCriticalRegion();
+    if (!(ExAcquireResourceExclusiveLite(&ExpTimeRefreshLock, Wait)))
+    {
+        /* We failed! */
+        KeLeaveCriticalRegion();
+        return FALSE;
+    }
+
+    /* Success */
+    return TRUE;
+}
+
+VOID
+NTAPI
+ExReleaseTimeRefreshLock(VOID)
+{
+    /* Simply release the Resource */
+    ExReleaseResourceLite(&ExpTimeRefreshLock);
+    KeLeaveCriticalRegion();
+}
+
+VOID
+NTAPI
+ExUpdateSystemTimeFromCmos(IN BOOLEAN UpdateInterruptTime,
+                           IN ULONG MaxSepInSeconds)
+{
+    /* FIXME: TODO */
+    return;
+}
+
 BOOLEAN
 NTAPI
 ExRefreshTimeZoneInformation(IN PLARGE_INTEGER CurrentBootTime)
index b1188b6..22c227a 100644 (file)
@@ -17,9 +17,13 @@ extern FAST_MUTEX ExpEnvironmentLock;
 extern ERESOURCE ExpFirmwareTableResource;
 extern LIST_ENTRY ExpFirmwareTableProviderListHead;
 extern BOOLEAN ExpIsWinPEMode;
+extern LIST_ENTRY ExpSystemResourcesList;
 ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
 ULONG ExpUnicodeCaseTableDataOffset;
 PVOID ExpNlsSectionPointer;
+extern CHAR NtBuildLab[];
+extern ULONG CmNtCSDVersion;
+extern ULONG NtGlobalFlag;
 extern ULONG ExpInitializationPhase;
 
 typedef struct _EXHANDLE
@@ -911,7 +915,7 @@ ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
 
     /* Unlock the pushlock */
     OldValue.Value = InterlockedExchangeAddSizeT((PLONG)PushLock,
-                                                 -EX_PUSH_LOCK_LOCK);
+                                                 -(LONG)EX_PUSH_LOCK_LOCK);
 
     /* Sanity checks */
     ASSERT(OldValue.Locked);
@@ -990,6 +994,19 @@ ExfpInterlockedExchange64(
 NTSTATUS
 ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation);
 
+BOOLEAN
+NTAPI
+ExAcquireTimeRefreshLock(BOOLEAN Wait);
+
+VOID
+NTAPI
+ExReleaseTimeRefreshLock(VOID);
+
+VOID
+NTAPI
+ExUpdateSystemTimeFromCmos(IN BOOLEAN UpdateInterruptTime,
+                           IN ULONG MaxSepInSeconds);
+
 NTSTATUS
 NTAPI
 ExpAllocateLocallyUniqueId(OUT LUID *LocallyUniqueId);
index a96e405..15c78d8 100644 (file)
@@ -80,18 +80,26 @@ static inline void Ki386Cpuid(ULONG Op, PULONG Eax, PULONG Ebx, PULONG Ecx, PULO
 
 #define Ke386FnInit()               __asm__("fninit\n\t");
 
+//
+// CR Macros
+//
+#define Ke386SetCr2(X)              __asm__ __volatile__("movl %0,%%cr2" : :"r" (X));
+
 //
 // DR Macros
 //
 #define Ke386GetDr0()               _Ke386GetDr(0)
 #define Ke386GetDr1()               _Ke386GetDr(1)
 #define Ke386SetDr0(X)              _Ke386SetDr(0,X)
+#define Ke386SetDr1(X)              _Ke386SetDr(1,X)
 #define Ke386GetDr2()               _Ke386GetDr(2)
 #define Ke386SetDr2(X)              _Ke386SetDr(2,X)
 #define Ke386GetDr3()               _Ke386GetDr(3)
+#define Ke386SetDr3(X)              _Ke386SetDr(3,X)
 #define Ke386GetDr4()               _Ke386GetDr(4)
 #define Ke386SetDr4(X)              _Ke386SetDr(4,X)
 #define Ke386GetDr6()               _Ke386GetDr(6)
+#define Ke386SetDr6(X)              _Ke386SetDr(6,X)
 #define Ke386GetDr7()               _Ke386GetDr(7)
 #define Ke386SetDr7(X)              _Ke386SetDr(7,X)
 
@@ -192,6 +200,17 @@ Ke386GetTr(IN USHORT Tr)
     __asm str Tr;
 }
 
+//
+// CR Macros
+//
+VOID
+FORCEINLINE
+Ke386SetCr2(IN ULONG Value)
+{
+    __asm mov eax, Value;
+    __asm mov cr2, eax;
+}
+
 //
 // DR Macros
 //
@@ -245,6 +264,14 @@ Ke386SetDr0(IN ULONG Value)
     __asm mov dr0, eax;
 }
 
+VOID
+FORCEINLINE
+Ke386SetDr1(IN ULONG Value)
+{
+    __asm mov eax, Value;
+    __asm mov dr1, eax;
+}
+
 VOID
 FORCEINLINE
 Ke386SetDr2(IN ULONG Value)
index c189288..a8feb0d 100644 (file)
@@ -63,10 +63,16 @@ Ki386InitializeTss(
 
 VOID
 NTAPI
-KiSaveProcessorControlState(
+KiRestoreProcessorControlState(
     IN PKPROCESSOR_STATE ProcessorState
 );
 
+VOID
+NTAPI
+KiSaveProcessorControlState(
+    OUT PKPROCESSOR_STATE ProcessorState
+);
+
 VOID
 FASTCALL
 KiIdleLoop(VOID);
index 30d31cd..5df46cd 100644 (file)
@@ -968,6 +968,7 @@ extern GENERIC_MAPPING IopCompletionMapping;
 extern GENERIC_MAPPING IopFileMapping;
 extern POBJECT_TYPE _IoFileObjectType;
 extern HAL_DISPATCH _HalDispatchTable;
+extern LIST_ENTRY IopErrorLogListHead;
 
 //
 // Inlined Functions
index a10789a..fcabe24 100644 (file)
@@ -71,11 +71,6 @@ typedef PCHAR
     IN ULONG Length
 );
 
-struct _KIRQ_TRAPFRAME;
-struct _KPCR;
-struct _KPRCB;
-struct _KEXCEPTION_FRAME;
-
 extern ULONG_PTR MmFreeLdrFirstKrnlPhysAddr;
 extern ULONG_PTR MmFreeLdrLastKrnlPhysAddr;
 extern ULONG_PTR MmFreeLdrLastKernelAddress;
@@ -131,7 +126,7 @@ extern LARGE_INTEGER KiTimeIncrementReciprocal;
 extern UCHAR KiTimeIncrementShiftCount;
 extern ULONG KiTimeLimitIsrMicroseconds;
 extern ULONG KiServiceLimit;
-extern LIST_ENTRY BugcheckCallbackListHead, BugcheckReasonCallbackListHead;
+extern LIST_ENTRY KeBugcheckCallbackListHead, KeBugcheckReasonCallbackListHead;
 extern KSPIN_LOCK BugCheckCallbackLock;
 extern KDPC KiTimerExpireDpc;
 extern KTIMER_TABLE_ENTRY KiTimerTableListHead[TIMER_TABLE_SIZE];
@@ -154,6 +149,8 @@ extern PVOID KeUserExceptionDispatcher;
 extern PVOID KeRaiseUserExceptionDispatcher;
 extern UCHAR KiDebugRegisterTrapOffsets[9];
 extern UCHAR KiDebugRegisterContextOffsets[9];
+extern ULONG KeTimeIncrement;
+extern ULONG_PTR KiBugCheckData[5];
 
 /* MACROS *************************************************************************/
 
@@ -193,16 +190,6 @@ extern UCHAR KiDebugRegisterContextOffsets[9];
 
 /* INTERNAL KERNEL FUNCTIONS ************************************************/
 
-/* Readies a Thread for Execution. */
-BOOLEAN
-NTAPI
-KiDispatchThreadNoLock(ULONG NewThreadStatus);
-
-/* Readies a Thread for Execution. */
-VOID
-NTAPI
-KiDispatchThread(ULONG NewThreadStatus);
-
 /* Finds a new thread to run */
 NTSTATUS
 FASTCALL
@@ -393,10 +380,6 @@ KeProfileInterruptWithSource(
     IN KPROFILE_SOURCE Source
 );
 
-BOOLEAN
-NTAPI
-KiRosPrintAddress(PVOID Address);
-
 VOID
 NTAPI
 KeUpdateRunTime(
@@ -520,13 +503,6 @@ KiSetPriorityThread(
     IN KPRIORITY Priority
 );
 
-BOOLEAN
-NTAPI
-KiDispatcherObjectWake(
-    DISPATCHER_HEADER* hdr,
-    KPRIORITY increment
-);
-
 VOID
 FASTCALL
 KiUnlinkThread(
@@ -534,15 +510,6 @@ KiUnlinkThread(
     IN NTSTATUS WaitStatus
 );
 
-VOID
-NTAPI
-KeExpireTimers(
-    PKDPC Apc,
-    PVOID Arg1,
-    PVOID Arg2,
-    PVOID Arg3
-);
-
 VOID
 NTAPI
 KeDumpStackFrames(PULONG Frame);
@@ -724,10 +691,6 @@ VOID
 NTAPI
 KiInitializeBugCheck(VOID);
 
-VOID
-NTAPI
-KiInitializeSystemClock(VOID);
-
 VOID
 NTAPI
 KiSystemStartup(
@@ -949,6 +912,15 @@ WRMSR(
     IN LONGLONG Value
 );
 
+BOOLEAN
+NTAPI
+KeFreezeExecution(IN PKTRAP_FRAME TrapFrame,
+                  IN PKEXCEPTION_FRAME ExceptionFrame);
+
+VOID
+NTAPI
+KeThawExecution(IN BOOLEAN Enable);
+
 #include "ke_x.h"
 
 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */
index a4e7fa9..176cb1d 100644 (file)
@@ -503,8 +503,8 @@ extern ULONG ObpTraceLevel;
 extern KEVENT ObpDefaultObject;
 extern POBJECT_TYPE ObpTypeObjectType;
 extern POBJECT_TYPE ObSymbolicLinkType;
-extern POBJECT_TYPE ObTypeObjectType;
-extern POBJECT_DIRECTORY NameSpaceRoot;
+extern POBJECT_TYPE ObpTypeObjectType;
+extern POBJECT_DIRECTORY ObpRootDirectoryObject;
 extern POBJECT_DIRECTORY ObpTypeDirectoryObject;
 extern PHANDLE_TABLE ObpKernelHandleTable;
 extern WORK_QUEUE_ITEM ObpReaperWorkItem;
index 2a73841..563c461 100644 (file)
@@ -385,6 +385,7 @@ extern POBJECT_TYPE PsJobType;
 extern LARGE_INTEGER ShortPsLockDelay;
 extern UNICODE_STRING PsNtDllPathName;
 extern LIST_ENTRY PsLoadedModuleList;
+extern ULONG PsNtosImageBase;
 
 //
 // Inlined Functions
index f43dba3..ba53306 100644 (file)
@@ -8,12 +8,16 @@
 
 /* INCLUDES ******************************************************************/
 
-/* Always target Windows 2003 Service Pack 1 */
+/* Version Data */
+#include <ntverp.h>
 #define _WIN32_WINNT _WIN32_WINNT_WS03
 #define NTDDI_VERSION NTDDI_WS03SP1
 #define NTKERNELAPI
+#define NOEXTAPI
 
 /* DDK/IFS/NDK Headers */
+#define NTKERNELAPI
+#define NOEXTAPI
 #include <ntifs.h>
 #undef _KPROCESS
 #undef _EPROCESS
 #include <pseh/pseh.h>
 
 /* ReactOS Headers */
-#include <reactos/version.h>
-#include <reactos/resource.h>
+#include <reactos/buildno.h>
 #include <reactos/bugcodes.h>
-#include <reactos/rossym.h>
 #define ExRaiseStatus RtlRaiseStatus
 #include <reactos/probe.h>
+#include <reactos/rossym.h>
 
 /* SetupLDR Support */
 #include <arc/setupblk.h>
 
+/* KD Support */
+#include <windbgkd.h>
+#include <wdbgexts.h>
+#include <kddll.h>
+
 /* PNP GUIDs */
 #include <umpnpmgr/sysguid.h>
 
index 84382de..d64de87 100644 (file)
@@ -23,7 +23,7 @@ typedef struct _IOP_ERROR_LOG_WORKER_DPC
 /* GLOBALS *******************************************************************/
 
 LONG IopTotalLogSize;
-LIST_ENTRY IopLogListHead;
+LIST_ENTRY IopErrorLogListHead;
 KSPIN_LOCK IopLogListLock;
 
 BOOLEAN IopLogWorkerRunning;
@@ -59,7 +59,7 @@ IopGetErrorLogEntry(VOID)
 
     /* Acquire the lock and check if the list is empty */
     KeAcquireSpinLock(&IopLogListLock, &OldIrql);
-    if (IsListEmpty(&IopLogListHead))
+    if (IsListEmpty(&IopErrorLogListHead))
     {
         /* List is empty, disable the worker and return NULL */
         IopLogWorkerRunning = FALSE;
@@ -68,7 +68,7 @@ IopGetErrorLogEntry(VOID)
     else
     {
         /* Otherwise, remove an entry */
-        ListEntry = RemoveHeadList(&IopLogListHead);
+        ListEntry = RemoveHeadList(&IopErrorLogListHead);
     }
 
     /* Release the lock and return the entry */
@@ -420,7 +420,7 @@ IopLogWorker(IN PVOID Parameter)
         if (!NT_SUCCESS(Status))
         {
             /* Requeue log message and restart the worker */
-            ExInterlockedInsertTailList(&IopLogListHead,
+            ExInterlockedInsertTailList(&IopErrorLogListHead,
                                         &LogEntry->ListEntry,
                                         &IopLogListLock);
             IopLogWorkerRunning = FALSE;
@@ -581,7 +581,7 @@ IoWriteErrorLogEntry(IN PVOID ElEntry)
 
     /* Acquire the lock and insert this write in the list */
     KeAcquireSpinLock(&IopLogListLock, &Irql);
-    InsertHeadList(&IopLogListHead, &LogEntry->ListEntry);
+    InsertHeadList(&IopErrorLogListHead, &LogEntry->ListEntry);
 
     /* Check if the worker is runnign */
     if (!IopLogWorkerRunning)
index 2ffc7ea..c90778a 100644 (file)
@@ -70,7 +70,7 @@ extern LIST_ENTRY DriverBootReinitListHead;
 extern LIST_ENTRY DriverReinitListHead;
 extern LIST_ENTRY PnpNotifyListHead;
 extern LIST_ENTRY FsChangeNotifyListHead;
-extern LIST_ENTRY IopLogListHead;
+extern LIST_ENTRY IopErrorLogListHead;
 extern LIST_ENTRY IopTimerQueueHead;
 extern KDPC IopTimerDpc;
 extern KTIMER IopTimer;
@@ -467,7 +467,7 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
     InitializeListHead(&PnpNotifyListHead);
     InitializeListHead(&ShutdownListHead);
     InitializeListHead(&FsChangeNotifyListHead);
-    InitializeListHead(&IopLogListHead);
+    InitializeListHead(&IopErrorLogListHead);
     KeInitializeSpinLock(&CancelSpinLock);
     KeInitializeSpinLock(&IoVpbLock);
     KeInitializeSpinLock(&IoStatisticsLock);
index f781f18..603829d 100644 (file)
@@ -18,7 +18,6 @@ BOOLEAN KdEnteredDebugger = FALSE;
 BOOLEAN KdDebuggerNotPresent = TRUE;
 BOOLEAN KiEnableTimerWatchdog = FALSE;
 BOOLEAN KdBreakAfterSymbolLoad = FALSE;
-ULONG KiBugCheckData;
 BOOLEAN KdpBreakPending;
 VOID STDCALL PspDumpThreads(BOOLEAN SystemThreads);
 
index 5f9fb21..dd19977 100644 (file)
@@ -18,8 +18,8 @@
 
 /* GLOBALS *******************************************************************/
 
-LIST_ENTRY BugcheckCallbackListHead;
-LIST_ENTRY BugcheckReasonCallbackListHead;
+LIST_ENTRY KeBugcheckCallbackListHead;
+LIST_ENTRY KeBugcheckReasonCallbackListHead;
 KSPIN_LOCK BugCheckCallbackLock;
 ULONG KeBugCheckActive, KeBugCheckOwner;
 LONG KeBugCheckOwnerRecursionCount;
@@ -209,7 +209,7 @@ KiDoBugCheckCallbacks(VOID)
     ULONG_PTR Checksum;
 
     /* First make sure that the list is Initialized... it might not be */
-    ListHead = &BugcheckCallbackListHead;
+    ListHead = &KeBugcheckCallbackListHead;
     if ((ListHead->Flink) && (ListHead->Blink))
     {
         /* Loop the list */
@@ -427,13 +427,27 @@ KiDisplayBlueScreen(IN ULONG MessageId,
 {
     CHAR AnsiName[75];
 
+    /* Check if bootvid is installed */
+    if (InbvIsBootDriverInstalled())
+    {
+        /* Acquire ownership and reset the display */
+        InbvAcquireDisplayOwnership();
+        InbvResetDisplay();
+
+        /* Display blue screen */
+        InbvSolidColorFill(0, 0, 639, 479, 4);
+        InbvSetTextColor(15);
+        InbvInstallDisplayStringFilter(NULL);
+        InbvEnableDisplayString(TRUE);
+        InbvSetScrollRegion(0, 0, 639, 479);
+    }
+
     /* Check if this is a hard error */
     if (IsHardError)
     {
         /* Display caption and message */
         if (HardErrCaption) InbvDisplayString(HardErrCaption);
         if (HardErrMessage) InbvDisplayString(HardErrMessage);
-        return;
     }
 
     /* Begin the display */
@@ -514,7 +528,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
     CONTEXT Context;
     ULONG MessageId;
     CHAR AnsiName[128];
-    BOOLEAN IsSystem, IsHardError = FALSE;
+    BOOLEAN IsSystem, IsHardError = FALSE, Reboot = FALSE;
     PCHAR HardErrCaption = NULL, HardErrMessage = NULL;
     PVOID Eip = NULL, Memory;
     PVOID DriverBase;
@@ -543,9 +557,10 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
 
     /* Capture the CPU Context */
     RtlCaptureContext(&Prcb->ProcessorState.ContextFrame);
+    KiSaveProcessorControlState(&Prcb->ProcessorState);
     Context = Prcb->ProcessorState.ContextFrame;
 
-    /* FIXME: Call the Watchdog if it's regsitered */
+    /* FIXME: Call the Watchdog if it's registered */
 
     /* Check which bugcode this is */
     switch (BugCheckCode)
@@ -560,7 +575,6 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
         case FAT_FILE_SYSTEM:
         case NO_MORE_SYSTEM_PTES:
         case INACCESSIBLE_BOOT_DEVICE:
-        case KMODE_EXCEPTION_NOT_HANDLED:
 
             /* Keep the same code */
             MessageId = BugCheckCode;
@@ -568,33 +582,40 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
 
         /* Check if this is a kernel-mode exception */
         case KERNEL_MODE_EXCEPTION_NOT_HANDLED:
+        //case SYSTEM_THREAD_EXCEPTION_NOT_HANDLED:
+        case KMODE_EXCEPTION_NOT_HANDLED:
 
             /* Use the generic text message */
             MessageId = KMODE_EXCEPTION_NOT_HANDLED;
+            break;
 
         /* File-system errors */
         case NTFS_FILE_SYSTEM:
 
             /* Use the generic message for FAT */
             MessageId = FAT_FILE_SYSTEM;
+            break;
 
         /* Check if this is a coruption of the Mm's Pool */
         case DRIVER_CORRUPTED_MMPOOL:
 
             /* Use generic corruption message */
             MessageId = DRIVER_CORRUPTED_EXPOOL;
+            break;
 
         /* Check if this is a signature check failure */
         case STATUS_SYSTEM_IMAGE_BAD_SIGNATURE:
 
             /* Use the generic corruption message */
             MessageId = BUGCODE_PSS_MESSAGE_SIGNATURE;
+            break;
 
         /* All other codes */
         default:
 
             /* Use the default bugcheck message */
             MessageId = BUGCODE_PSS_MESSAGE;
+            break;
     }
 
     /* Save bugcheck data */
@@ -721,9 +742,13 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
             {
                 /* Get EIP */
                 Eip = (PVOID)TrapFrame->Eip;
+                KiBugCheckData[3] = (ULONG)Eip;
 
                 /* Find out if was in the kernel or drivers */
-                DriverBase = KiPcToFileHeader(Eip, &LdrEntry, FALSE, &IsSystem);
+                DriverBase = KiPcToFileHeader(Eip,
+                                              &LdrEntry,
+                                              FALSE,
+                                              &IsSystem);
             }
 
             /*
@@ -732,8 +757,8 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
              * and update the bugcheck code appropriately.
              */
 
-            /* Check if we had a driver base */
-            if (DriverBase)
+            /* Check if we didn't have a driver base */
+            if (!DriverBase)
             {
                 /* Find the driver that unloaded at this address */
                 KiBugCheckDriver = NULL; // FIXME: ROS can't locate
@@ -757,10 +782,9 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
         /* Check if the driver consumed too many PTEs */
         case DRIVER_USED_EXCESSIVE_PTES:
 
-            /* Driver base is in parameter 1 */
-            DriverBase = (PVOID)BugCheckParameter1;
-            /* FIXME: LdrEntry is uninitialized for god's sake!!!
-               KiBugCheckDriver = &LdrEntry->BaseDllName; */
+            /* Loader entry is in parameter 1 */
+            LdrEntry = (PVOID)BugCheckParameter1;
+            KiBugCheckDriver = &LdrEntry->BaseDllName;
             break;
 
         /* Check if the driver has a stuck thread */
@@ -794,7 +818,7 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
         }
     }
 
-    /* FIXME: Check if we need to save the context for KD */
+    /* Check if we need to save the context for KD */
 
     /* Check if a debugger is connected */
     if ((BugCheckCode != MANUALLY_INITIATED_CRASH) && (KdDebuggerEnabled))
@@ -840,24 +864,11 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
         }
     }
 
-    /* Use the boot video driver to clear, fill and write to screen. */
-    if (InbvIsBootDriverInstalled())
-    {
-        /* FIXME: This should happen in KiDisplayBlueScreen!!! */
-        InbvAcquireDisplayOwnership();
-        InbvResetDisplay();
-        InbvSolidColorFill(0, 0, 639, 479, 4);
-        InbvSetTextColor(15);
-        InbvInstallDisplayStringFilter(NULL);
-        InbvEnableDisplayString(TRUE);
-        InbvSetScrollRegion(0, 0, 639, 479);
-    }
-
     /* Raise IRQL to HIGH_LEVEL */
     _disable();
     KeRaiseIrql(HIGH_LEVEL, &OldIrql);
 
-    /* Unlock the Kernel Adress Space if we own it */
+    /* ROS HACK: Unlock the Kernel Address Space if we own it */
     if (KernelAddressSpaceLock.Owner == KeGetCurrentThread())
     {
         MmUnlockAddressSpace(MmGetKernelAddressSpace());
@@ -866,10 +877,10 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
     /* Avoid recursion */
     if (!InterlockedDecrement((PLONG)&KeBugCheckCount))
     {
+#ifdef CONFIG_SMP
         /* Set CPU that is bug checking now */
         KeBugCheckOwner = Prcb->Number;
 
-#ifdef CONFIG_SMP
         /* Freeze the other CPUs */
         for (i = 0; i < KeNumberProcessors; i++)
         {
@@ -889,10 +900,17 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
                             HardErrMessage,
                             AnsiName);
 
-        /* FIXME: Enable debugger if it was pending */
-
-        /* Print the last line */
-        InbvDisplayString("\r\n");
+        /* Check if the debugger is disabled but we can enable it */
+        //if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
+        {
+            /* Enable it */
+            //KdEnableDebuggerWithLock(FALSE);
+        }
+        //else
+        {
+            /* Otherwise, print the last line */
+            InbvDisplayString("\r\n");
+        }
 
         /* Save the context */
         Prcb->ProcessorState.ContextFrame = Context;
@@ -907,18 +925,20 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
                            KiBugCheckData[3],
                            TrapFrame);
     }
-
-    /* Increase recursioun count */
-    KeBugCheckOwnerRecursionCount++;
-    if (KeBugCheckOwnerRecursionCount == 2)
-    {
-        /* Break in the debugger */
-        KiBugCheckDebugBreak(DBG_STATUS_BUGCHECK_SECOND);
-    }
-    else if (KeBugCheckOwnerRecursionCount > 2)
+    else
     {
-        /* Halt the CPU */
-        for (;;) Ke386HaltProcessor();
+        /* Increase recursion count */
+        KeBugCheckOwnerRecursionCount++;
+        if (KeBugCheckOwnerRecursionCount == 2)
+        {
+            /* Break in the debugger */
+            KiBugCheckDebugBreak(DBG_STATUS_BUGCHECK_SECOND);
+        }
+        else if (KeBugCheckOwnerRecursionCount > 2)
+        {
+            /* Halt the CPU */
+            for (;;) Ke386HaltProcessor();
+        }
     }
 
     /* Call the Callbacks */
@@ -926,6 +946,14 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
 
     /* FIXME: Call Watchdog if enabled */
 
+    /* Check if we have to reboot */
+    if (Reboot)
+    {
+        /* Unload symbols */
+        DbgUnLoadImageSymbols(NULL, NtCurrentProcess(), 0);
+        HalReturnToFirmware(HalRebootRoutine);
+    }
+
     /* Attempt to break in the debugger (otherwise halt CPU) */
     KiBugCheckDebugBreak(DBG_STATUS_BUGCHECK_SECOND);
 }
@@ -1013,7 +1041,7 @@ KeRegisterBugCheckCallback(IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
         CallbackRecord->Component = Component;
         CallbackRecord->CallbackRoutine = CallbackRoutine;
         CallbackRecord->State = BufferInserted;
-        InsertTailList(&BugcheckCallbackListHead, &CallbackRecord->Entry);
+        InsertTailList(&KeBugcheckCallbackListHead, &CallbackRecord->Entry);
         Status = TRUE;
     }
 
@@ -1047,7 +1075,7 @@ KeRegisterBugCheckReasonCallback(
         CallbackRecord->CallbackRoutine = CallbackRoutine;
         CallbackRecord->State = BufferInserted;
         CallbackRecord->Reason = Reason;
-        InsertTailList(&BugcheckReasonCallbackListHead,
+        InsertTailList(&KeBugcheckReasonCallbackListHead,
                        &CallbackRecord->Entry);
         Status = TRUE;
     }
index ab34875..b994d07 100644 (file)
@@ -143,24 +143,22 @@ KiRaiseException(IN PEXCEPTION_RECORD ExceptionRecord,
         Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
+    if (!NT_SUCCESS(Status)) return Status;
 
-    /* Make sure we didn't crash in SEH */
-    if (NT_SUCCESS(Status))
-    {
-        /* Convert the context record */
-        KeContextToTrapFrame(Context,
-                             ExceptionFrame,
-                             TrapFrame,
-                             Context->ContextFlags,
-                             PreviousMode);
-
-        /* Dispatch the exception */
-        KiDispatchException(ExceptionRecord,
-                            ExceptionFrame,
-                            TrapFrame,
-                            PreviousMode,
-                            SearchFrames);
-    }
+    /* Convert the context record */
+    KeContextToTrapFrame(Context,
+                         ExceptionFrame,
+                         TrapFrame,
+                         Context->ContextFlags,
+                         PreviousMode);
+
+    /* Dispatch the exception */
+    ExceptionRecord->ExceptionCode &= ~KI_EXCEPTION_INTERNAL;
+    KiDispatchException(ExceptionRecord,
+                        ExceptionFrame,
+                        TrapFrame,
+                        PreviousMode,
+                        SearchFrames);
 
     /* Return the status */
     return Status;
index 67702c3..afcf673 100644 (file)
@@ -74,6 +74,10 @@ KAFFINITY KeActiveProcessors = 1;
 BOOLEAN KiI386PentiumLockErrataPresent;
 BOOLEAN KiSMTProcessorsPresent;
 
+/* Freeze data */
+KIRQL KiOldIrql;
+ULONG KiFreezeFlag;
+
 /* CPU Signatures */
 static const CHAR CmpIntelID[]       = "GenuineIntel";
 static const CHAR CmpAmdID[]         = "AuthenticAMD";
@@ -672,13 +676,43 @@ KeFlushCurrentTb(VOID)
 
 VOID
 NTAPI
-KiSaveProcessorControlState(IN PKPROCESSOR_STATE ProcessorState)
+KiRestoreProcessorControlState(PKPROCESSOR_STATE ProcessorState)
+{
+    /* Restore the CR registers */
+    __writecr0(ProcessorState->SpecialRegisters.Cr0);
+    Ke386SetCr2(ProcessorState->SpecialRegisters.Cr2);
+    __writecr3(ProcessorState->SpecialRegisters.Cr3);
+    if (KeFeatureBits & KF_CR4) __writecr4(ProcessorState->SpecialRegisters.Cr4);
+
+    //
+    // Restore the DR registers
+    //
+    Ke386SetDr0(ProcessorState->SpecialRegisters.KernelDr0);
+    Ke386SetDr1(ProcessorState->SpecialRegisters.KernelDr1);
+    Ke386SetDr2(ProcessorState->SpecialRegisters.KernelDr2);
+    Ke386SetDr3(ProcessorState->SpecialRegisters.KernelDr3);
+    Ke386SetDr6(ProcessorState->SpecialRegisters.KernelDr6);
+    Ke386SetDr7(ProcessorState->SpecialRegisters.KernelDr7);
+
+    //
+    // Restore GDT, IDT, LDT and TSS
+    //
+    Ke386SetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr.Base);
+    Ke386SetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr.Base);
+    Ke386SetTr(ProcessorState->SpecialRegisters.Tr);
+    Ke386SetLocalDescriptorTable(ProcessorState->SpecialRegisters.Ldtr);
+}
+
+VOID
+NTAPI
+KiSaveProcessorControlState(OUT PKPROCESSOR_STATE ProcessorState)
 {
     /* Save the CR registers */
     ProcessorState->SpecialRegisters.Cr0 = __readcr0();
     ProcessorState->SpecialRegisters.Cr2 = __readcr2();
     ProcessorState->SpecialRegisters.Cr3 = __readcr3();
-    ProcessorState->SpecialRegisters.Cr4 = __readcr4();
+    ProcessorState->SpecialRegisters.Cr4 = (KeFeatureBits & KF_CR4) ?
+                                           __readcr4() : 0;
 
     /* Save the DR registers */
     ProcessorState->SpecialRegisters.KernelDr0 = Ke386GetDr0();
@@ -690,8 +724,8 @@ KiSaveProcessorControlState(IN PKPROCESSOR_STATE ProcessorState)
     Ke386SetDr7(0);
 
     /* Save GDT, IDT, LDT and TSS */
-    Ke386GetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr);
-    Ke386GetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr);
+    Ke386GetGlobalDescriptorTable(ProcessorState->SpecialRegisters.Gdtr.Base);
+    Ke386GetInterruptDescriptorTable(ProcessorState->SpecialRegisters.Idtr.Base);
     Ke386GetTr(ProcessorState->SpecialRegisters.Tr);
     Ke386GetLocalDescriptorTable(ProcessorState->SpecialRegisters.Ldtr);
 }
@@ -807,6 +841,39 @@ KiI386PentiumLockErrataFixup(VOID)
     MmSetPageProtect(NULL, NewIdt, PAGE_READONLY);
 }
 
+BOOLEAN
+NTAPI
+KeFreezeExecution(IN PKTRAP_FRAME TrapFrame,
+                  IN PKEXCEPTION_FRAME ExceptionFrame)
+{
+    ULONG Flags;
+
+    /* Disable interrupts and get previous state */
+    Ke386SaveFlags(Flags);
+    //Flags = __getcallerseflags();
+    _disable();
+
+    /* Save freeze flag */
+    KiFreezeFlag = 4;
+
+    /* Save the old IRQL */
+    KiOldIrql = KeGetCurrentIrql();
+
+    /* Return whether interrupts were enabled */
+    return (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE: FALSE;
+}
+
+VOID
+NTAPI
+KeThawExecution(IN BOOLEAN Enable)
+{
+    /* Cleanup CPU caches */
+    KeFlushCurrentTb();
+
+    /* Re-enable interrupts */
+    if (Enable) _enable();
+}
+
 /* PUBLIC FUNCTIONS **********************************************************/
 
 /*
index 8a33723..500a1db 100644 (file)
@@ -90,7 +90,7 @@ KiUpdateDr7(IN ULONG Dr7)
     ULONG DebugMask = KeGetCurrentThread()->DispatcherHeader.DebugActive;
 
     /* Check if debugging is enabled */
-    if (DebugMask & DR_ACTIVE_MASK)
+    if (DebugMask & DR_MASK(DR7_OVERRIDE_V))
     {
         /* Sanity checks */
         ASSERT((DebugMask & DR_REG_MASK) != 0);
@@ -133,11 +133,11 @@ KiRecordDr7(OUT PULONG Dr7Ptr,
         Result = FALSE;
 
         /* Check the DR mask */
-        NewMask &= 0x7F;
+        NewMask &= ~(DR_MASK(7));
         if (NewMask & DR_REG_MASK)
         {
             /* Set the active mask */
-            NewMask |= DR_ACTIVE_MASK;
+            NewMask |= DR_MASK(DR7_OVERRIDE_V);
 
             /* Set DR7 override */
             *DrMask = DR7_OVERRIDE_MASK;
@@ -154,8 +154,8 @@ KiRecordDr7(OUT PULONG Dr7Ptr,
         Result = NewMask ? TRUE: FALSE;
 
         /* Update the mask to disable debugging */
-        NewMask &= ~DR_ACTIVE_MASK;
-        NewMask |= 0x80;
+        NewMask &= ~(DR_MASK(DR7_OVERRIDE_V));
+        NewMask |= DR_MASK(7);
     }
 
     /* Check if caller wants the new mask */
index 3bc2597..2a0a0e7 100644 (file)
@@ -783,5 +783,3 @@ AppCpuInit:
     /* Jump into the idle loop */
     KiIdleLoop();
 }
-
-
index 174fc19..abb36b7 100644 (file)
@@ -487,7 +487,7 @@ _KiDebugService:
     /* Call debug service dispatcher */
     mov eax, [ebp+KTRAP_FRAME_EAX]
     mov ecx, [ebp+KTRAP_FRAME_ECX]
-    mov edx, [ebp+KTRAP_FRAME_EAX]
+    mov edx, [ebp+KTRAP_FRAME_EDX]
 
     /* Check for V86 mode */
     test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK
@@ -642,7 +642,7 @@ _CommonDispatchException:
     mov [esp+EXCEPTION_RECORD_NUMBER_PARAMETERS], ecx
 
     /* Check parameter count */
-    cmp eax, 0
+    cmp ecx, 0
     jz NoParams
 
     /* Get information */
@@ -664,9 +664,11 @@ NoParams:
 
 SetPreviousMode:
 
-    /* Calculate the previous mode */
+    /* Get the caller's CS */
     mov eax, [ebp+KTRAP_FRAME_CS]
+
 MaskMode:
+    /* Check if it was user-mode or kernel-mode */
     and eax, MODE_MASK
 
     /* Dispatch the exception */
@@ -844,8 +846,8 @@ PrepInt3:
     /* Setup EIP, NTSTATUS and parameter count, then dispatch */
     mov ebx, [ebp+KTRAP_FRAME_EIP]
     dec ebx
-    mov eax, STATUS_BREAKPOINT
     mov ecx, 3
+    mov eax, STATUS_BREAKPOINT
     call _CommonDispatchException
 
 V86Int3:
index 4a35240..ee8c2fc 100644 (file)
@@ -62,8 +62,8 @@ KiInitSystem(VOID)
     ULONG i;
 
     /* Initialize Bugcheck Callback data */
-    InitializeListHead(&BugcheckCallbackListHead);
-    InitializeListHead(&BugcheckReasonCallbackListHead);
+    InitializeListHead(&KeBugcheckCallbackListHead);
+    InitializeListHead(&KeBugcheckReasonCallbackListHead);
     KeInitializeSpinLock(&BugCheckCallbackLock);
 
     /* Initialize the Timer Expiration DPC */
index 0a63414..00a910b 100644 (file)
@@ -165,6 +165,40 @@ KiReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
     KxReleaseSpinLock(SpinLock);
 }
 
+/*
+ * @implemented
+ */
+BOOLEAN
+FASTCALL
+KeTryToAcquireSpinLockAtDpcLevel(IN OUT PKSPIN_LOCK SpinLock)
+{
+#ifdef CONFIG_SMP
+    /* Check if it's already acquired */
+    if (!(*SpinLock))
+    {
+        /* Try to acquire it */
+        if (InterlockedBitTestAndSet((PLONG)SpinLock, 0))
+        {
+            /* Someone else acquired it */
+            return FALSE;
+        }
+    }
+    else
+    {
+        /* It was already acquired */
+        return FALSE;
+    }
+
+#ifdef DBG
+    /* On debug builds, we OR in the KTHREAD */
+    *SpinLock = (ULONG_PTR)KeGetCurrentThread() | 1;
+#endif
+#endif
+
+    /* All is well, return TRUE */
+    return TRUE;
+}
+
 /*
  * @implemented
  */
index 9d5d783..1346262 100644 (file)
@@ -15,8 +15,8 @@
 
 extern ULONG NtMajorVersion;
 extern ULONG NtMinorVersion;
-extern ULONG NtOSCSDVersion;
-extern ULONG NtGlobalFlag;
+extern ULONG CmNtCSDVersion;
+extern ULONG NtBuildNumber;
 extern MM_SYSTEMSIZE MmSystemSize;
 
 #define MM_HIGHEST_VAD_ADDRESS \
@@ -329,9 +329,9 @@ MmCreatePeb(PEPROCESS Process)
     /* Default Version Data (could get changed below) */
     Peb->OSMajorVersion = NtMajorVersion;
     Peb->OSMinorVersion = NtMinorVersion;
-    Peb->OSBuildNumber = 2195;
+    Peb->OSBuildNumber = (USHORT)(NtBuildNumber & 0x3FFF);
     Peb->OSPlatformId = 2; /* VER_PLATFORM_WIN32_NT */
-    Peb->OSCSDVersion = NtOSCSDVersion;
+    Peb->OSCSDVersion = CmNtCSDVersion;
 
     /* Heap and Debug Data */
     Peb->NumberOfProcessors = KeNumberProcessors;
index 1cf52d4..8b42de6 100644 (file)
@@ -143,7 +143,7 @@ RiPrintLastOwner ( PR_USED Block )
                if ( Block->LastOwnerStack[i] != 0xDEADBEEF )
                {
                        R_DEBUG(" ");
-                       if (!R_PRINT_ADDRESS ((PVOID)Block->LastOwnerStack[i]) )
+                       //if (!R_PRINT_ADDRESS ((PVOID)Block->LastOwnerStack[i]) )
                        {
                                R_DEBUG("<%X>", Block->LastOwnerStack[i] );
                        }
index ef40fed..d67d4a4 100644 (file)
@@ -16,7 +16,7 @@
 \r
 LIST_ENTRY PsLoadedModuleList;\r
 KSPIN_LOCK PsLoadedModuleSpinLock;\r
-PVOID PsNtosImageBase;\r
+ULONG PsNtosImageBase;\r
 KMUTANT MmSystemLoadLock;\r
 extern ULONG NtGlobalFlag;\r
 \r
@@ -1218,7 +1218,7 @@ MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
     LdrEntry = CONTAINING_RECORD(NextEntry,\r
                                  LDR_DATA_TABLE_ENTRY,\r
                                  InLoadOrderLinks);\r
-    PsNtosImageBase = LdrEntry->DllBase;\r
+    PsNtosImageBase = (ULONG)LdrEntry->DllBase;\r
 \r
     /* Loop the loader block */\r
     while (NextEntry != ListHead)\r
index 6d47232..df1a3f2 100644 (file)
@@ -1,22 +1,38 @@
-/* $Id$ */
+/*
+ * PROJECT:         ReactOS
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * FILE:            ntoskrnl/ntoskrnl.rc
+ * PURPOSE:         Kernel Resource File
+ * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
+ */
+#include <winver.h>
+#include <ntverp.h>
 
-#define REACTOS_STR_FILE_DESCRIPTION   "ReactOS Kernel & System\0"
-#define REACTOS_STR_INTERNAL_NAME      "ntoskrnl\0"
-#define REACTOS_STR_ORIGINAL_FILENAME  "ntoskrnl.exe\0"
-#include <reactos/version.rc>
+//
+// Version Data
+//
+#define VER_FILETYPE                VFT_DRV
+#define VER_FILESUBTYPE             VFT2_DRV_SYSTEM
+#define VER_FILEDESCRIPTION_STR     "NT Kernel & System"
+#define VER_INTERNALNAME_STR        "ntoskrnl.exe"
+#define VER_ORIGINALFILENAME_STR    "ntoskrnl.exe"
+#define VER_LANGNEUTRAL
+#include "common.ver"
 
+//
+// Bug Codes and Bitmaps
+//
 #include "bugcodes.rc"
-
-1    BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/1.bmp"
-2    BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/2.bmp"
-3    BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/3.bmp"
-4    BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/4.bmp"
-5    BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/5.bmp"
-6    BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/6.bmp"
-7    BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/7.bmp"
-8    BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/8.bmp"
-13   BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/13.bmp"
-14   BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/14.bmp"
-15   BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/15.bmp"
-16   BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/16.bmp"
-17   BITMAP  DISCARDABLE   "ntoskrnl/inbv/logo/17.bmp"
+1   BITMAP DISCARDABLE "ntoskrnl/inbv/logo/1.bmp"
+2   BITMAP DISCARDABLE "ntoskrnl/inbv/logo/2.bmp"
+3   BITMAP DISCARDABLE "ntoskrnl/inbv/logo/3.bmp"
+4   BITMAP DISCARDABLE "ntoskrnl/inbv/logo/4.bmp"
+5   BITMAP DISCARDABLE "ntoskrnl/inbv/logo/5.bmp"
+6   BITMAP DISCARDABLE "ntoskrnl/inbv/logo/6.bmp"
+7   BITMAP DISCARDABLE "ntoskrnl/inbv/logo/7.bmp"
+8   BITMAP DISCARDABLE "ntoskrnl/inbv/logo/8.bmp"
+13  BITMAP DISCARDABLE "ntoskrnl/inbv/logo/13.bmp"
+14  BITMAP DISCARDABLE "ntoskrnl/inbv/logo/14.bmp"
+15  BITMAP DISCARDABLE "ntoskrnl/inbv/logo/15.bmp"
+16  BITMAP DISCARDABLE "ntoskrnl/inbv/logo/16.bmp"
+17  BITMAP DISCARDABLE "ntoskrnl/inbv/logo/17.bmp"
index d3c7042..89fb834 100644 (file)
@@ -198,7 +198,7 @@ ObInit(VOID)
     ObjectTypeInitializer.GenericMapping = ObpTypeMapping;
     ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(OBJECT_TYPE);
     ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
-    ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObTypeObjectType);
+    ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ObpTypeObjectType);
 
     /* Create the Directory Type */
     RtlInitUnicodeString(&Name, L"Directory");
@@ -247,7 +247,7 @@ ObPostPhase0:
                                        0,
                                        ObDirectoryType,
                                        KernelMode,
-                                       (PVOID*)&NameSpaceRoot,
+                                       (PVOID*)&ObpRootDirectoryObject,
                                        NULL);
     if (!NT_SUCCESS(Status)) return FALSE;
 
@@ -289,7 +289,7 @@ ObPostPhase0:
     ObpAcquireDirectoryLockExclusive(ObpTypeDirectoryObject, &Context);
 
     /* Loop the object types */
-    ListHead = &ObTypeObjectType->TypeList;
+    ListHead = &ObpTypeObjectType->TypeList;
     NextEntry = ListHead->Flink;
     while (ListHead != NextEntry)
     {
index 77cad1d..085d811 100644 (file)
@@ -19,7 +19,7 @@
 
 extern ULONG NtGlobalFlag;
 
-POBJECT_TYPE ObTypeObjectType = NULL;
+POBJECT_TYPE ObpTypeObjectType = NULL;
 KEVENT ObpDefaultObject;
 
 NPAGED_LOOKASIDE_LIST ObpNmLookasideList, ObpCiLookasideList;
@@ -1074,7 +1074,7 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
     /* Allocate the Object */
     Status = ObpAllocateObject(NULL,
                                &ObjectName,
-                               ObTypeObjectType,
+                               ObpTypeObjectType,
                                sizeof(OBJECT_TYPE),
                                KernelMode,
                                (POBJECT_HEADER*)&Header);
@@ -1098,11 +1098,11 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
     LocalObjectType->HighWaterNumberOfHandles = 0;
 
     /* Check if this is the first Object Type */
-    if (!ObTypeObjectType)
+    if (!ObpTypeObjectType)
     {
         /* It is, so set this as the type object */
-        ObTypeObjectType = LocalObjectType;
-        Header->Type = ObTypeObjectType;
+        ObpTypeObjectType = LocalObjectType;
+        Header->Type = ObpTypeObjectType;
 
         /* Set the hard-coded key and object count */
         LocalObjectType->TotalNumberOfObjects = 1;
@@ -1195,11 +1195,11 @@ ObCreateObjectType(IN PUNICODE_STRING TypeName,
 
     /* Get creator info and insert it into the type list */
     CreatorInfo = OBJECT_HEADER_TO_CREATOR_INFO(Header);
-    if (CreatorInfo) InsertTailList(&ObTypeObjectType->TypeList,
+    if (CreatorInfo) InsertTailList(&ObpTypeObjectType->TypeList,
                                     &CreatorInfo->TypeList);
 
     /* Set the index and the entry into the object type array */
-    LocalObjectType->Index = ObTypeObjectType->TotalNumberOfObjects;
+    LocalObjectType->Index = ObpTypeObjectType->TotalNumberOfObjects;
     if (LocalObjectType->Index < 32)
     {
         /* It fits, insert it */
index 2ffd720..32dec08 100644 (file)
@@ -16,7 +16,7 @@
 #include <debug.h>
 
 BOOLEAN ObpCaseInsensitive = TRUE;
-POBJECT_DIRECTORY NameSpaceRoot;
+POBJECT_DIRECTORY ObpRootDirectoryObject;
 POBJECT_DIRECTORY ObpTypeDirectoryObject;
 
 /* DOS Device Prefix \??\ and \?? */
@@ -407,7 +407,7 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL,
                 {
                     /* Reparsed to the root directory, so start over */
                     ObDereferenceObject(RootDirectory);
-                    RootDirectory = NameSpaceRoot;
+                    RootDirectory = ObpRootDirectoryObject;
 
                     /* Don't use this anymore, since we're starting at root */
                     RootHandle = NULL;
@@ -448,7 +448,7 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL,
     else
     {
         /* We did not get a Root Directory, so use the root */
-        RootDirectory = NameSpaceRoot;
+        RootDirectory = ObpRootDirectoryObject;
 
         /* It must start with a path separator */
         if (!(ObjectName->Length) ||
@@ -811,7 +811,7 @@ ReparseObject:
 
                         /* Start at Root */
                         ParentDirectory = NULL;
-                        RootDirectory = NameSpaceRoot;
+                        RootDirectory = ObpRootDirectoryObject;
 
                         /* Check for reparse status */
                         if (Status == STATUS_REPARSE_OBJECT)
@@ -838,7 +838,7 @@ ReparseObject:
                             goto ParseFromRoot;
                         }
                     }
-                    else if (RootDirectory == NameSpaceRoot)
+                    else if (RootDirectory == ObpRootDirectoryObject)
                     {
                         /* We got STATUS_REPARSE but are at the Root Directory */
                         Object = NULL;
@@ -1025,7 +1025,7 @@ ObQueryNameString(IN PVOID Object,
      * enough right at the beginning, not work our way through
      * and find out at the end
      */
-    if (Object == NameSpaceRoot)
+    if (Object == ObpRootDirectoryObject)
     {
         /* Size of the '\' string */
         NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR);
@@ -1037,7 +1037,7 @@ ObQueryNameString(IN PVOID Object,
         NameSize = sizeof(OBJ_NAME_PATH_SEPARATOR) + LocalInfo->Name.Length;
 
         /* Loop inside the directory to get the top-most one (meaning root) */
-        while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory))
+        while ((ParentDirectory != ObpRootDirectoryObject) && (ParentDirectory))
         {
             /* Get the Name Information */
             LocalInfo = OBJECT_HEADER_TO_NAME_INFO(
@@ -1080,7 +1080,7 @@ ObQueryNameString(IN PVOID Object,
     *--ObjectName = UNICODE_NULL;
 
     /* Check if the object is actually the Root directory */
-    if (Object == NameSpaceRoot)
+    if (Object == ObpRootDirectoryObject)
     {
         /* This is already the Root Directory, return "\\" */
         *--ObjectName = OBJ_NAME_PATH_SEPARATOR;
@@ -1101,7 +1101,7 @@ ObQueryNameString(IN PVOID Object,
 
         /* Now parse the Parent directories until we reach the top */
         ParentDirectory = LocalInfo->Directory;
-        while ((ParentDirectory != NameSpaceRoot) && (ParentDirectory))
+        while ((ParentDirectory != ObpRootDirectoryObject) && (ParentDirectory))
         {
             /* Get the name information */
             LocalInfo = OBJECT_HEADER_TO_NAME_INFO(
index 5739852..9e2a565 100644 (file)
@@ -58,12 +58,12 @@ RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
       lpVersionInformation->dwMinorVersion = NtMinorVersion;
       lpVersionInformation->dwBuildNumber = NtBuildNumber;
       lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
-      if(((NtOSCSDVersion >> 8) & 0xFF) != 0)
+      if(((CmNtCSDVersion >> 8) & 0xFF) != 0)
       {
         int i = _snwprintf(lpVersionInformation->szCSDVersion,
                            (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0])) - 1,
                            L"Service Pack %d",
-                           ((NtOSCSDVersion >> 8) & 0xFF));
+                           ((CmNtCSDVersion >> 8) & 0xFF));
         lpVersionInformation->szCSDVersion[i] = L'\0';
       }
       else
@@ -73,8 +73,8 @@ RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation)
       if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW))
       {
          RTL_OSVERSIONINFOEXW *InfoEx = (RTL_OSVERSIONINFOEXW *)lpVersionInformation;
-         InfoEx->wServicePackMajor = (USHORT)(NtOSCSDVersion >> 8) & 0xFF;
-         InfoEx->wServicePackMinor = (USHORT)(NtOSCSDVersion & 0xFF);
+         InfoEx->wServicePackMajor = (USHORT)(CmNtCSDVersion >> 8) & 0xFF;
+         InfoEx->wServicePackMinor = (USHORT)(CmNtCSDVersion & 0xFF);
          InfoEx->wSuiteMask = (USHORT)SharedUserData->SuiteMask;
          InfoEx->wProductType = SharedUserData->NtProductType;
       }