- 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
This commit is contained in:
Aleksey Bragin 2007-10-30 20:24:27 +00:00
parent 3c89dc696e
commit 6a2986170b

View file

@ -278,7 +278,7 @@ CmiAddSubKey(
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
Storage = (CreateOptions & REG_OPTION_VOLATILE) ? Volatile : Stable; 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); NKBOffset = HvAllocateCell(&RegistryHive->Hive, NewBlockSize, Storage, HCELL_NIL);
if (NKBOffset == HCELL_NIL) if (NKBOffset == HCELL_NIL)
{ {
@ -450,7 +450,7 @@ CmiCompareKeyNames(
for (i = 0; i < KeyCell->NameLength; i++) 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; return FALSE;
} }
} }
@ -488,8 +488,8 @@ CmiCompareKeyNamesI(
/* FIXME: use _strnicmp */ /* FIXME: use _strnicmp */
for (i = 0; i < KeyCell->NameLength; i++) for (i = 0; i < KeyCell->NameLength; i++)
{ {
if (RtlUpcaseUnicodeChar(((PCHAR)KeyName->Buffer)[i]) != if (RtlUpcaseUnicodeChar(KeyName->Buffer[i]) !=
RtlUpcaseUnicodeChar((WCHAR)KeyCell->Name[i])) RtlUpcaseUnicodeChar(((PCHAR)KeyCell->Name)[i]))
return FALSE; return FALSE;
} }
} }