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

commit d1b3115afa62b73bf66480fa3b11441d55ffd3f3
Author:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
AuthorDate: Wed Feb 7 12:34:23 2024 +0100
Commit:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
CommitDate: Fri Feb 9 17:13:30 2024 +0100

    [NTOS:IO] IopDisplayLoadingMessage(): Display the loading messages only in 
SOS mode.
    
    - Make the boolean SosEnabled from ex/init.c visible globally so that
      it can be checked against by IopDisplayLoadingMessage().
    
    - Also use RtlString* function to construct the string.
---
 ntoskrnl/ex/init.c         |  3 ++-
 ntoskrnl/io/iomgr/driver.c | 22 +++++++++++-----------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/ntoskrnl/ex/init.c b/ntoskrnl/ex/init.c
index 0bbda8a62cd..00e5f453dd8 100644
--- a/ntoskrnl/ex/init.c
+++ b/ntoskrnl/ex/init.c
@@ -70,6 +70,7 @@ BOOLEAN ExpInTextModeSetup;
 BOOLEAN IoRemoteBootClient;
 ULONG InitSafeBootMode;
 BOOLEAN InitIsWinPEMode, InitWinPEModeType;
+BOOLEAN SosEnabled; // Used by driver.c!IopDisplayLoadingMessage()
 
 /* NT Boot Path */
 UNICODE_STRING NtSystemRoot;
@@ -1344,7 +1345,7 @@ Phase1InitializationDiscard(IN PVOID Context)
     NTSTATUS Status, MsgStatus;
     TIME_FIELDS TimeFields;
     LARGE_INTEGER SystemBootTime, UniversalBootTime, OldTime, Timeout;
-    BOOLEAN SosEnabled, NoGuiBoot, ResetBias = FALSE, AlternateShell = FALSE;
+    BOOLEAN NoGuiBoot, ResetBias = FALSE, AlternateShell = FALSE;
     PLDR_DATA_TABLE_ENTRY NtosEntry;
     PMESSAGE_RESOURCE_ENTRY MsgEntry;
     PCHAR CommandLine, Y2KHackRequired, SafeBoot, Environment;
diff --git a/ntoskrnl/io/iomgr/driver.c b/ntoskrnl/io/iomgr/driver.c
index ad84b4d714b..ac3ac0f3815 100644
--- a/ntoskrnl/io/iomgr/driver.c
+++ b/ntoskrnl/io/iomgr/driver.c
@@ -33,7 +33,6 @@ static const WCHAR ServicesKeyName[] = 
L"\\Registry\\Machine\\System\\CurrentCon
 
 POBJECT_TYPE IoDriverObjectType = NULL;
 
-extern BOOLEAN ExpInTextModeSetup;
 extern BOOLEAN PnpSystemInit;
 extern BOOLEAN PnPBootDriversLoaded;
 extern KEVENT PiEnumerationFinished;
@@ -305,25 +304,26 @@ IopSuffixUnicodeString(
 }
 
 /**
- * @brief   Displays a driver loading message on the screen.
+ * @brief   Displays a driver-loading message in SOS mode.
  **/
 static VOID
 FASTCALL
 IopDisplayLoadingMessage(
     _In_ PUNICODE_STRING ServiceName)
 {
+    extern BOOLEAN SosEnabled; // See ex/init.c
     static const UNICODE_STRING DotSys = RTL_CONSTANT_STRING(L".SYS");
     CHAR TextBuffer[256];
 
-    if (ExpInTextModeSetup) return;
+    if (!SosEnabled) return;
     if (!KeLoaderBlock) return;
     RtlUpcaseUnicodeString(ServiceName, ServiceName, FALSE);
-    snprintf(TextBuffer, sizeof(TextBuffer),
-            "%s%sSystem32\\Drivers\\%wZ%s\r\n",
-            KeLoaderBlock->ArcBootDeviceName,
-            KeLoaderBlock->NtBootPathName,
-            ServiceName,
-            IopSuffixUnicodeString(&DotSys, ServiceName) ? "" : ".SYS");
+    RtlStringCbPrintfA(TextBuffer, sizeof(TextBuffer),
+                       "%s%sSystem32\\Drivers\\%wZ%s\r\n",
+                       KeLoaderBlock->ArcBootDeviceName,
+                       KeLoaderBlock->NtBootPathName,
+                       ServiceName,
+                       IopSuffixUnicodeString(&DotSys, ServiceName) ? "" : 
".SYS");
     HalDisplayString(TextBuffer);
 }
 
@@ -1196,8 +1196,8 @@ IopInitializeSystemDrivers(VOID)
 
     PiPerformSyncDeviceAction(IopRootDeviceNode->PhysicalDeviceObject, 
PiActionEnumDeviceTree);
 
-    /* No system drivers on the boot cd */
-    if (KeLoaderBlock->SetupLdrBlock) return; // ExpInTextModeSetup
+    /* HACK: No system drivers on the BootCD */
+    if (KeLoaderBlock->SetupLdrBlock) return;
 
     /* Get the driver list */
     SavedList = DriverList = CmGetSystemDriverList();

Reply via email to