https://git.reactos.org/?p=reactos.git;a=commitdiff;h=475098c8b16db212bdeaf…
commit 475098c8b16db212bdeaffe0b909b6bb6c870547
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Wed Feb 7 21:53:52 2024 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Fri Feb 9 17:16:20 2024 +0100
[NTOS:IO] Don't uppercase the ServiceName in IopDisplayLoadingMessage().
Problematic behaviour was added in commit a97f262ed (r26067), and
commit c39812d1b (r46193) converted to RtlUpcaseUnicodeString() call.
This was modifying the caller's given string. This is not really
a good practice to do so just to make display fancier.
For example, IopInitializeBuiltinDriver(), that calls the display
function, also uses the passed ServiceName later after.
Because IopDisplayLoadingMessage() executes only in SOS mode,
uppercasing the ServiceName in one case but not the other would
implicitly modify the observable OS behaviour.
IopSuffixUnicodeString() is adapted to be similar to RtlPrefixUnicodeString().
---
ntoskrnl/io/iomgr/driver.c | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/ntoskrnl/io/iomgr/driver.c b/ntoskrnl/io/iomgr/driver.c
index ff61b784a79..248140a0bf6 100644
--- a/ntoskrnl/io/iomgr/driver.c
+++ b/ntoskrnl/io/iomgr/driver.c
@@ -279,7 +279,8 @@ Cleanup:
static BOOLEAN
IopSuffixUnicodeString(
_In_ PCUNICODE_STRING String1,
- _In_ PCUNICODE_STRING String2)
+ _In_ PCUNICODE_STRING String2,
+ _In_ BOOLEAN CaseInSensitive)
{
PWCHAR pc1, pc2;
ULONG NumChars;
@@ -293,13 +294,29 @@ IopSuffixUnicodeString(
if (pc1 && pc2)
{
- while (NumChars--)
+ if (CaseInSensitive)
{
- if (*pc1++ != *pc2++)
- return FALSE;
+ while (NumChars--)
+ {
+ if (RtlUpcaseUnicodeChar(*pc1++) !=
+ RtlUpcaseUnicodeChar(*pc2++))
+ {
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ while (NumChars--)
+ {
+ if (*pc1++ != *pc2++)
+ return FALSE;
+ }
}
+
return TRUE;
}
+
return FALSE;
}
@@ -309,7 +326,7 @@ IopSuffixUnicodeString(
static VOID
FASTCALL
IopDisplayLoadingMessage(
- _In_ PUNICODE_STRING ServiceName)
+ _In_ PCUNICODE_STRING ServiceName)
{
extern BOOLEAN SosEnabled; // See ex/init.c
static const UNICODE_STRING DotSys = RTL_CONSTANT_STRING(L".SYS");
@@ -317,13 +334,13 @@ IopDisplayLoadingMessage(
if (!SosEnabled) return;
if (!KeLoaderBlock) return;
- RtlUpcaseUnicodeString(ServiceName, ServiceName, FALSE);
RtlStringCbPrintfA(TextBuffer, sizeof(TextBuffer),
"%s%sSystem32\\Drivers\\%wZ%s\r\n",
KeLoaderBlock->ArcBootDeviceName,
KeLoaderBlock->NtBootPathName,
ServiceName,
- IopSuffixUnicodeString(&DotSys, ServiceName) ? "" : ".SYS");
+ IopSuffixUnicodeString(&DotSys, ServiceName, TRUE)
+ ? "" : ".SYS");
HalDisplayString(TextBuffer);
}