[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;
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;

View File

@ -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();