[NTOS:IO] Minor formatting for IopSuffixUnicodeString and IopDisplayLoadingMessage.

- Doxygen comments;
- SAL annotations;
- These two functions are local to driver.c file only -> static'ify them.
- 2 -> sizeof(WCHAR);
- Rename Length to NumChars;
- static const'ify the L".SYS" string.
This commit is contained in:
Hermès Bélusca-Maïto 2024-02-07 12:23:32 +01:00
parent 08afb1f4b4
commit 17c59456cd
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -273,32 +273,30 @@ Cleanup:
return status;
}
/*
* RETURNS
* TRUE if String2 contains String1 as a suffix.
*/
BOOLEAN
NTAPI
/**
* @brief Determines whether String1 may be a suffix of String2.
* @return TRUE if String2 contains String1 as a suffix.
**/
static BOOLEAN
IopSuffixUnicodeString(
IN PCUNICODE_STRING String1,
IN PCUNICODE_STRING String2)
_In_ PCUNICODE_STRING String1,
_In_ PCUNICODE_STRING String2)
{
PWCHAR pc1;
PWCHAR pc2;
ULONG Length;
PWCHAR pc1, pc2;
ULONG NumChars;
if (String2->Length < String1->Length)
return FALSE;
Length = String1->Length / 2;
NumChars = String1->Length / sizeof(WCHAR);
pc1 = String1->Buffer;
pc2 = &String2->Buffer[String2->Length / sizeof(WCHAR) - Length];
pc2 = &String2->Buffer[String2->Length / sizeof(WCHAR) - NumChars];
if (pc1 && pc2)
{
while (Length--)
while (NumChars--)
{
if( *pc1++ != *pc2++ )
if (*pc1++ != *pc2++)
return FALSE;
}
return TRUE;
@ -306,17 +304,16 @@ IopSuffixUnicodeString(
return FALSE;
}
/*
* IopDisplayLoadingMessage
*
* Display 'Loading XXX...' message.
*/
VOID
/**
* @brief Displays a driver loading message on the screen.
**/
static VOID
FASTCALL
IopDisplayLoadingMessage(PUNICODE_STRING ServiceName)
IopDisplayLoadingMessage(
_In_ PUNICODE_STRING ServiceName)
{
static const UNICODE_STRING DotSys = RTL_CONSTANT_STRING(L".SYS");
CHAR TextBuffer[256];
UNICODE_STRING DotSys = RTL_CONSTANT_STRING(L".SYS");
if (ExpInTextModeSetup) return;
if (!KeLoaderBlock) return;