[RTL][NTDLL] Implement and export RtlCompareUnicodeStrings

This commit is contained in:
Timo Kreuzer 2023-08-12 17:47:38 +03:00
parent c332b917dc
commit d00d883a21
2 changed files with 48 additions and 1 deletions

View file

@ -2222,6 +2222,53 @@ RtlCompareUnicodeString(
return ret;
}
/*
* @implemented
*/
_IRQL_requires_max_(PASSIVE_LEVEL)
_Must_inspect_result_
NTSYSAPI
LONG
NTAPI
RtlCompareUnicodeStrings(
_In_reads_(String1Length) PCWCH String1,
_In_ SIZE_T String1Length,
_In_reads_(String2Length) PCWCH String2,
_In_ SIZE_T String2Length,
_In_ BOOLEAN CaseInSensitive)
{
LONG Result = 0;
SIZE_T MinStringLength = min(String1Length, String2Length);
SIZE_T Index;
if (CaseInSensitive)
{
for (Index = 0; Index < MinStringLength; Index++)
{
WCHAR Char1 = RtlpUpcaseUnicodeChar(String1[Index]);
WCHAR Char2 = RtlpUpcaseUnicodeChar(String2[Index]);
Result = Char1 - Char2;
if (Result != 0)
{
return Result;
}
}
}
else
{
for (Index = 0; Index < MinStringLength; Index++)
{
Result = String1[Index] - String2[Index];
if (Result != 0)
{
return Result;
}
}
}
return String1Length - String2Length;
}
/*
* @implemented
*/