diff --git a/reactos/lib/cmlib/hivedata.h b/reactos/lib/cmlib/hivedata.h index 015aa06a85b..a4d8d620a25 100644 --- a/reactos/lib/cmlib/hivedata.h +++ b/reactos/lib/cmlib/hivedata.h @@ -113,10 +113,8 @@ typedef struct _HBASE_BLOCK /* Hive identifier "regf" (0x66676572) */ ULONG Signature; - /* Update counter */ + /* Update counters */ ULONG Sequence1; - - /* Update counter */ ULONG Sequence2; /* When this hive file was last modified */ @@ -139,7 +137,7 @@ typedef struct _HBASE_BLOCK If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */ HCELL_INDEX RootCell; - /* Size of each hive block ? */ + /* Size in bytes of the full hive, minus the header */ ULONG Length; /* (1?) */ diff --git a/reactos/lib/cmlib/hiveinit.c b/reactos/lib/cmlib/hiveinit.c index c3d5924dcbb..73672b24d24 100644 --- a/reactos/lib/cmlib/hiveinit.c +++ b/reactos/lib/cmlib/hiveinit.c @@ -353,14 +353,14 @@ HvpGetHiveHeader(IN PHHIVE Hive, } NTSTATUS CMAPI -HvLoadHive(IN PHHIVE Hive, - IN ULONG FileSize) +HvLoadHive(IN PHHIVE Hive) { PHBASE_BLOCK BaseBlock = NULL; ULONG Result; LARGE_INTEGER TimeStamp; ULONG Offset = 0; PVOID HiveData; + ULONG FileSize; /* Get the hive header */ Result = HvpGetHiveHeader(Hive, &BaseBlock, &TimeStamp); @@ -394,6 +394,7 @@ HvLoadHive(IN PHHIVE Hive, Hive->Version = Hive->BaseBlock->Minor; /* Allocate a buffer large enough to hold the hive */ + FileSize = HBLOCK_SIZE + BaseBlock->Length; HiveData = Hive->Allocate(FileSize, TRUE, TAG_CM); if (!HiveData) return STATUS_INSUFFICIENT_RESOURCES; @@ -405,7 +406,7 @@ HvLoadHive(IN PHHIVE Hive, FileSize); if (!Result) return STATUS_NOT_REGISTRY_FILE; - + // This is a HACK! /* Free our base block... it's usless in this implementation */ Hive->Free(BaseBlock, 0); @@ -480,7 +481,7 @@ HvInitialize( Hive->StorageTypeCount = HTYPE_COUNT; Hive->Cluster = 1; Hive->Version = HSYS_MINOR; - Hive->HiveFlags = HiveFlags &~ HIVE_NOLAZYFLUSH; + Hive->HiveFlags = HiveFlags & ~HIVE_NOLAZYFLUSH; switch (OperationType) { @@ -498,8 +499,7 @@ HvInitialize( case HINIT_FILE: { - /* HACK of doom: Cluster is actually the file size. */ - Status = HvLoadHive(Hive, Cluster); + Status = HvLoadHive(Hive); if ((Status != STATUS_SUCCESS) && (Status != STATUS_REGISTRY_RECOVERED)) { diff --git a/reactos/ntoskrnl/config/cminit.c b/reactos/ntoskrnl/config/cminit.c index 6a66345a458..cd8b94dd646 100644 --- a/reactos/ntoskrnl/config/cminit.c +++ b/reactos/ntoskrnl/config/cminit.c @@ -28,7 +28,6 @@ CmpInitializeHive(OUT PCMHIVE *CmHive, IN ULONG CheckFlags) { PCMHIVE Hive; - FILE_STANDARD_INFORMATION FileInformation; IO_STATUS_BLOCK IoStatusBlock; FILE_FS_SIZE_INFORMATION FileSizeInformation; NTSTATUS Status; @@ -169,21 +168,6 @@ CmpInitializeHive(OUT PCMHIVE *CmHive, Hive->Flags = 0; Hive->FlushCount = 0; - /* Set flags */ - Hive->Flags = HiveFlags; - - /* Check if this is a primary */ - if (Primary) - { - /* Check how large the file is */ - ZwQueryInformationFile(Primary, - &IoStatusBlock, - &FileInformation, - sizeof(FileInformation), - FileStandardInformation); - Cluster = FileInformation.EndOfFile.LowPart; - } - /* Initialize it */ Status = HvInitialize(&Hive->Hive, OperationType,