https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a43bfe2916814cb521dd2109f950adb0fdebb8f6

commit a43bfe2916814cb521dd2109f950adb0fdebb8f6
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Fri Aug 9 17:39:00 2024 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Sun Dec 15 22:12:22 2024 +0100

    [NTOS:CM/IO/KE] Implement minimal support for CrashControl:AutoReboot
    
    The REG_DWORD value `AutoReboot` stored in the registry key
    `HKLM\SYSTEM\CurrentControlSet\Control\CrashControl`
    (used as a boolean value), controls whether to automatically reboot
    the operating system at the end of the crash dump, after a bugcheck.
    
    ReactOS doesn't currently implement crash dumps, so only the auto-reboot
    is done. (The reason of the apparent redundant `Reboot` variable in
    KeBugCheckWithTf() is because that variable would be updated on return
    by the not-yet-existing crash-dump helper routines called from there.)
---
 ntoskrnl/config/cmdata.c       | 9 +++++++--
 ntoskrnl/include/internal/io.h | 1 +
 ntoskrnl/io/iomgr/iomgr.c      | 1 +
 ntoskrnl/ke/bug.c              | 2 ++
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ntoskrnl/config/cmdata.c b/ntoskrnl/config/cmdata.c
index 693c9ac7b26..4656fe85cdd 100644
--- a/ntoskrnl/config/cmdata.c
+++ b/ntoskrnl/config/cmdata.c
@@ -624,8 +624,6 @@ DATA_SEG("INITDATA") CM_SYSTEM_CONTROL_VECTOR 
CmControlVector[] =
         NULL,
         NULL
     },
-
-
     {
         L"ProductOptions",
         L"ProductSuite",
@@ -926,6 +924,13 @@ DATA_SEG("INITDATA") CM_SYSTEM_CONTROL_VECTOR 
CmControlVector[] =
         NULL,
         NULL
     },
+    {
+        L"CrashControl",
+        L"AutoReboot",
+        &IopAutoReboot,
+        NULL,
+        NULL
+    },
     {
         NULL,
         NULL,
diff --git a/ntoskrnl/include/internal/io.h b/ntoskrnl/include/internal/io.h
index 10dc76bc2ba..f78c05a14be 100644
--- a/ntoskrnl/include/internal/io.h
+++ b/ntoskrnl/include/internal/io.h
@@ -1453,6 +1453,7 @@ extern GENERIC_MAPPING IopFileMapping;
 extern POBJECT_TYPE _IoFileObjectType;
 extern HAL_DISPATCH _HalDispatchTable;
 extern LIST_ENTRY IopErrorLogListHead;
+extern ULONG IopAutoReboot;
 extern ULONG IopNumTriageDumpDataBlocks;
 extern PVOID IopTriageDumpDataBlocks[64];
 extern PIO_BUS_TYPE_GUID_LIST PnpBusTypeGuidList;
diff --git a/ntoskrnl/io/iomgr/iomgr.c b/ntoskrnl/io/iomgr/iomgr.c
index b982414e270..249d93b6cae 100644
--- a/ntoskrnl/io/iomgr/iomgr.c
+++ b/ntoskrnl/io/iomgr/iomgr.c
@@ -43,6 +43,7 @@ LARGE_INTEGER IoWriteTransferCount = {{0, 0}};
 ULONG IoOtherOperationCount = 0;
 LARGE_INTEGER IoOtherTransferCount = {{0, 0}};
 KSPIN_LOCK IoStatisticsLock = 0;
+ULONG IopAutoReboot;
 ULONG IopNumTriageDumpDataBlocks;
 PVOID IopTriageDumpDataBlocks[64];
 
diff --git a/ntoskrnl/ke/bug.c b/ntoskrnl/ke/bug.c
index 297de556fe4..7cb9c1c2e67 100644
--- a/ntoskrnl/ke/bug.c
+++ b/ntoskrnl/ke/bug.c
@@ -1134,6 +1134,8 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
         /* FIXME: Support Triage Dump */
 
         /* FIXME: Write the crash dump */
+        // TODO: The crash-dump helper must set the Reboot variable.
+        Reboot = !!IopAutoReboot;
     }
     else
     {

Reply via email to