From 6a2986170bfd10a06088705dbf3cd618d2b0cee2 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 30 Oct 2007 20:24:27 +0000 Subject: [PATCH] - Fix my mistakes when changing type of the Name field. LiveCD / make install_registry now works again. - Convert one more sizeof to FIELD_OFFSET (though sizeof() was operating properly in this particular case). See issue #2780 for more details. svn path=/trunk/; revision=29985 --- reactos/tools/mkhive/cmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reactos/tools/mkhive/cmi.c b/reactos/tools/mkhive/cmi.c index 27313778a6d..98951957b67 100644 --- a/reactos/tools/mkhive/cmi.c +++ b/reactos/tools/mkhive/cmi.c @@ -278,7 +278,7 @@ CmiAddSubKey( Status = STATUS_SUCCESS; Storage = (CreateOptions & REG_OPTION_VOLATILE) ? Volatile : Stable; - NewBlockSize = sizeof(CM_KEY_NODE) + NameLength; + NewBlockSize = FIELD_OFFSET(CM_KEY_NODE, Name) + NameLength; NKBOffset = HvAllocateCell(&RegistryHive->Hive, NewBlockSize, Storage, HCELL_NIL); if (NKBOffset == HCELL_NIL) { @@ -450,7 +450,7 @@ CmiCompareKeyNames( for (i = 0; i < KeyCell->NameLength; i++) { - if (((PCHAR)KeyName->Buffer)[i] != (WCHAR)KeyCell->Name[i]) + if (KeyName->Buffer[i] != ((PCHAR)KeyCell->Name)[i]) return FALSE; } } @@ -488,8 +488,8 @@ CmiCompareKeyNamesI( /* FIXME: use _strnicmp */ for (i = 0; i < KeyCell->NameLength; i++) { - if (RtlUpcaseUnicodeChar(((PCHAR)KeyName->Buffer)[i]) != - RtlUpcaseUnicodeChar((WCHAR)KeyCell->Name[i])) + if (RtlUpcaseUnicodeChar(KeyName->Buffer[i]) != + RtlUpcaseUnicodeChar(((PCHAR)KeyCell->Name)[i])) return FALSE; } }