[NTOSKRNL]

Fix handling of compressed names in the registry.

svn path=/trunk/; revision=62036
This commit is contained in:
Timo Kreuzer 2014-02-08 14:54:57 +00:00
parent c135323120
commit dead0458d9

View file

@ -65,7 +65,7 @@ CmpCopyCompressedName(IN PWCHAR Destination,
for (i = 0; i < Length; i++) for (i = 0; i < Length; i++)
{ {
/* Copy each character */ /* Copy each character */
Destination[i] = (WCHAR)((PCHAR)Source)[i]; Destination[i] = (WCHAR)((PUCHAR)Source)[i];
} }
} }
@ -76,7 +76,7 @@ CmpNameSize(IN PHHIVE Hive,
{ {
ULONG i; ULONG i;
/* For old hives, just retun the length */ /* For old hives, just return the length */
if (Hive->Version == 1) return Name->Length; if (Hive->Version == 1) return Name->Length;
/* For new versions, check for compressed name */ /* For new versions, check for compressed name */
@ -111,27 +111,27 @@ CmpCompareCompressedName(IN PCUNICODE_STRING SearchName,
IN ULONG NameLength) IN ULONG NameLength)
{ {
WCHAR *p; WCHAR *p;
CHAR *pp; UCHAR *pp;
WCHAR p1, p2; WCHAR chr1, chr2;
USHORT SearchLength; USHORT SearchLength;
LONG Result; LONG Result;
/* Set the pointers and length and then loop */ /* Set the pointers and length and then loop */
p = SearchName->Buffer; p = SearchName->Buffer;
pp = (PCHAR)CompressedName; pp = (PUCHAR)CompressedName;
SearchLength = (SearchName->Length / sizeof(WCHAR)); SearchLength = (SearchName->Length / sizeof(WCHAR));
while ((SearchLength) && (NameLength)) while ((SearchLength) && (NameLength))
{ {
/* Get the characters */ /* Get the characters */
p1 = *p++; chr1 = *p++;
p2 = (WCHAR)(*pp++); chr2 = (WCHAR)(*pp++);
/* Check if we have a direct match */ /* Check if we have a direct match */
if (p1 != p2) if (chr1 != chr2)
{ {
/* See if they match and return result if they don't */ /* See if they match and return result if they don't */
Result = (LONG)RtlUpcaseUnicodeChar(p1) - Result = (LONG)RtlUpcaseUnicodeChar(chr1) -
(LONG)RtlUpcaseUnicodeChar(p2); (LONG)RtlUpcaseUnicodeChar(chr2);
if (Result) return Result; if (Result) return Result;
} }