From a4c1f7e52aeec090ac1d5ea9a40f52401889d9cc Mon Sep 17 00:00:00 2001 From: Rafal Harabien Date: Wed, 7 Sep 2011 09:51:13 +0000 Subject: [PATCH] [MKHIVE] - Fix max key name length, max value name length, max value data length properties of registry key not being set correctly - Fixes #6042 - regedit on LiveCD shows keys and values now svn path=/trunk/; revision=53614 --- reactos/tools/mkhive/cmi.c | 23 +++++++++++++++++++++++ reactos/tools/mkhive/registry.c | 3 +++ 2 files changed, 26 insertions(+) diff --git a/reactos/tools/mkhive/cmi.c b/reactos/tools/mkhive/cmi.c index 98914edbf3f..bb8f48fba9c 100644 --- a/reactos/tools/mkhive/cmi.c +++ b/reactos/tools/mkhive/cmi.c @@ -388,6 +388,19 @@ CmiAddSubKey( if (NT_SUCCESS(Status)) { ParentKeyCell->SubKeyCounts[Storage]++; + if (Packable) + { + if (NameLength*sizeof(WCHAR) > ParentKeyCell->MaxNameLen) + ParentKeyCell->MaxNameLen = NameLength*sizeof(WCHAR); + } + else + { + if (NameLength > ParentKeyCell->MaxNameLen) + ParentKeyCell->MaxNameLen = NameLength; + } + if (NewKeyCell->ClassLength > ParentKeyCell->MaxClassLen) + ParentKeyCell->MaxClassLen = NewKeyCell->ClassLength; + *pSubKeyCell = NewKeyCell; *pBlockOffset = NKBOffset; } @@ -720,6 +733,16 @@ CmiAddValueKey( ValueListCell->ValueOffset[KeyCell->ValueList.Count] = NewValueCellOffset; KeyCell->ValueList.Count++; + if (NewValueCell->Flags & VALUE_COMP_NAME) + { + if (NewValueCell->NameLength*sizeof(WCHAR) > KeyCell->MaxValueNameLen) + KeyCell->MaxValueNameLen = NewValueCell->NameLength*sizeof(WCHAR); + } + else + { + if (NewValueCell->NameLength > KeyCell->MaxValueNameLen) + KeyCell->MaxValueNameLen = NewValueCell->NameLength; + } HvMarkCellDirty(&RegistryHive->Hive, KeyCellOffset, FALSE); HvMarkCellDirty(&RegistryHive->Hive, KeyCell->ValueList.List, FALSE); diff --git a/reactos/tools/mkhive/registry.c b/reactos/tools/mkhive/registry.c index 07339afe3f1..82915eb1fb0 100644 --- a/reactos/tools/mkhive/registry.c +++ b/reactos/tools/mkhive/registry.c @@ -448,6 +448,9 @@ RegSetValueExW( HvMarkCellDirty(&Key->RegistryHive->Hive, ValueCellOffset, FALSE); } + if (cbData > Key->KeyCell->MaxValueDataLen) + Key->KeyCell->MaxValueDataLen = cbData; + HvMarkCellDirty(&Key->RegistryHive->Hive, Key->KeyCellOffset, FALSE); DPRINT("Return status 0x%08x\n", Status);