[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.
This commit is contained in:
Hermès Bélusca-Maïto 2024-02-07 12:34:23 +01:00
parent 17c59456cd
commit d1b3115afa
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 13 additions and 12 deletions

View file

@ -70,6 +70,7 @@ BOOLEAN ExpInTextModeSetup;
BOOLEAN IoRemoteBootClient; BOOLEAN IoRemoteBootClient;
ULONG InitSafeBootMode; ULONG InitSafeBootMode;
BOOLEAN InitIsWinPEMode, InitWinPEModeType; BOOLEAN InitIsWinPEMode, InitWinPEModeType;
BOOLEAN SosEnabled; // Used by driver.c!IopDisplayLoadingMessage()
/* NT Boot Path */ /* NT Boot Path */
UNICODE_STRING NtSystemRoot; UNICODE_STRING NtSystemRoot;
@ -1344,7 +1345,7 @@ Phase1InitializationDiscard(IN PVOID Context)
NTSTATUS Status, MsgStatus; NTSTATUS Status, MsgStatus;
TIME_FIELDS TimeFields; TIME_FIELDS TimeFields;
LARGE_INTEGER SystemBootTime, UniversalBootTime, OldTime, Timeout; LARGE_INTEGER SystemBootTime, UniversalBootTime, OldTime, Timeout;
BOOLEAN SosEnabled, NoGuiBoot, ResetBias = FALSE, AlternateShell = FALSE; BOOLEAN NoGuiBoot, ResetBias = FALSE, AlternateShell = FALSE;
PLDR_DATA_TABLE_ENTRY NtosEntry; PLDR_DATA_TABLE_ENTRY NtosEntry;
PMESSAGE_RESOURCE_ENTRY MsgEntry; PMESSAGE_RESOURCE_ENTRY MsgEntry;
PCHAR CommandLine, Y2KHackRequired, SafeBoot, Environment; PCHAR CommandLine, Y2KHackRequired, SafeBoot, Environment;

View file

@ -33,7 +33,6 @@ static const WCHAR ServicesKeyName[] = L"\\Registry\\Machine\\System\\CurrentCon
POBJECT_TYPE IoDriverObjectType = NULL; POBJECT_TYPE IoDriverObjectType = NULL;
extern BOOLEAN ExpInTextModeSetup;
extern BOOLEAN PnpSystemInit; extern BOOLEAN PnpSystemInit;
extern BOOLEAN PnPBootDriversLoaded; extern BOOLEAN PnPBootDriversLoaded;
extern KEVENT PiEnumerationFinished; 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 static VOID
FASTCALL FASTCALL
IopDisplayLoadingMessage( IopDisplayLoadingMessage(
_In_ PUNICODE_STRING ServiceName) _In_ PUNICODE_STRING ServiceName)
{ {
extern BOOLEAN SosEnabled; // See ex/init.c
static const UNICODE_STRING DotSys = RTL_CONSTANT_STRING(L".SYS"); static const UNICODE_STRING DotSys = RTL_CONSTANT_STRING(L".SYS");
CHAR TextBuffer[256]; CHAR TextBuffer[256];
if (ExpInTextModeSetup) return; if (!SosEnabled) return;
if (!KeLoaderBlock) return; if (!KeLoaderBlock) return;
RtlUpcaseUnicodeString(ServiceName, ServiceName, FALSE); RtlUpcaseUnicodeString(ServiceName, ServiceName, FALSE);
snprintf(TextBuffer, sizeof(TextBuffer), RtlStringCbPrintfA(TextBuffer, sizeof(TextBuffer),
"%s%sSystem32\\Drivers\\%wZ%s\r\n", "%s%sSystem32\\Drivers\\%wZ%s\r\n",
KeLoaderBlock->ArcBootDeviceName, KeLoaderBlock->ArcBootDeviceName,
KeLoaderBlock->NtBootPathName, KeLoaderBlock->NtBootPathName,
ServiceName, ServiceName,
IopSuffixUnicodeString(&DotSys, ServiceName) ? "" : ".SYS"); IopSuffixUnicodeString(&DotSys, ServiceName) ? "" : ".SYS");
HalDisplayString(TextBuffer); HalDisplayString(TextBuffer);
} }
@ -1196,8 +1196,8 @@ IopInitializeSystemDrivers(VOID)
PiPerformSyncDeviceAction(IopRootDeviceNode->PhysicalDeviceObject, PiActionEnumDeviceTree); PiPerformSyncDeviceAction(IopRootDeviceNode->PhysicalDeviceObject, PiActionEnumDeviceTree);
/* No system drivers on the boot cd */ /* HACK: No system drivers on the BootCD */
if (KeLoaderBlock->SetupLdrBlock) return; // ExpInTextModeSetup if (KeLoaderBlock->SetupLdrBlock) return;
/* Get the driver list */ /* Get the driver list */
SavedList = DriverList = CmGetSystemDriverList(); SavedList = DriverList = CmGetSystemDriverList();