[ntoskrnl] Better fix for correct display of loaded drivers

svn path=/trunk/; revision=46200
This commit is contained in:
Hervé Poussineau 2010-03-14 19:21:38 +00:00
parent ee46cddad7
commit f9d9302445

View file

@ -149,6 +149,39 @@ IopGetDriverObject(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
/*
* RETURNS
* TRUE if String2 contains String1 as a suffix.
*/
BOOLEAN
NTAPI
IopSuffixUnicodeString(
IN PCUNICODE_STRING String1,
IN PCUNICODE_STRING String2)
{
PWCHAR pc1;
PWCHAR pc2;
ULONG Length;
if (String2->Length < String1->Length)
return FALSE;
Length = String1->Length / 2;
pc1 = String1->Buffer;
pc2 = &String2->Buffer[String2->Length / sizeof(WCHAR) - Length];
if (pc1 && pc2)
{
while (Length--)
{
if( *pc1++ != *pc2++ )
return FALSE;
}
return TRUE;
}
return FALSE;
}
/* /*
* IopDisplayLoadingMessage * IopDisplayLoadingMessage
* *
@ -161,19 +194,16 @@ INIT_FUNCTION
IopDisplayLoadingMessage(PUNICODE_STRING ServiceName) IopDisplayLoadingMessage(PUNICODE_STRING ServiceName)
{ {
CHAR TextBuffer[256]; CHAR TextBuffer[256];
UNICODE_STRING DotSys = RTL_CONSTANT_STRING(L".SYS");
if (ExpInTextModeSetup) return; if (ExpInTextModeSetup) return;
RtlUpcaseUnicodeString(ServiceName, ServiceName, FALSE); RtlUpcaseUnicodeString(ServiceName, ServiceName, FALSE);
snprintf(TextBuffer, sizeof(TextBuffer), snprintf(TextBuffer, sizeof(TextBuffer),
"%s%s%s\\%wZ", "%s%sSystem32\\Drivers\\%wZ%s\n",
KeLoaderBlock->ArcBootDeviceName, KeLoaderBlock->ArcBootDeviceName,
KeLoaderBlock->NtBootPathName, KeLoaderBlock->NtBootPathName,
"System32\\Drivers", ServiceName,
ServiceName); IopSuffixUnicodeString(&DotSys, ServiceName) ? "" : ".SYS");
if (!strstr(TextBuffer, ".sys"))
strcat(TextBuffer, ".sys\n");
else
strcat(TextBuffer, "\n");
HalDisplayString(TextBuffer); HalDisplayString(TextBuffer);
} }