Author: hbelusca
Date: Sun Jan 10 02:16:39 2016
New Revision: 70565
URL: http://svn.reactos.org/svn/reactos?rev=70565&view=rev
Log:
[CMLIB][NTOS:CONFIG]
- The BaseBlock->Length member is really the size in bytes of the full hive, minus the header (base) block size.
- Remove the last remnents of the "hack of doom" aka. the one similar in magnitude to the US national debt, addendum to r61621 and r26712. The FileSize can be computed with BaseBlock->Length.
Modified:
trunk/reactos/lib/cmlib/hivedata.h
trunk/reactos/lib/cmlib/hiveinit.c
trunk/reactos/ntoskrnl/config/cminit.c
Modified: trunk/reactos/lib/cmlib/hivedata.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivedata.h?rev=7…
==============================================================================
--- trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hivedata.h [iso-8859-1] Sun Jan 10 02:16:39 2016
@@ -113,10 +113,8 @@
/* 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 @@
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?) */
Modified: trunk/reactos/lib/cmlib/hiveinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hiveinit.c?rev=7…
==============================================================================
--- trunk/reactos/lib/cmlib/hiveinit.c [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hiveinit.c [iso-8859-1] Sun Jan 10 02:16:39 2016
@@ -353,14 +353,14 @@
}
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 @@
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 @@
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 @@
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 @@
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))
{
Modified: trunk/reactos/ntoskrnl/config/cminit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cminit.c?r…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cminit.c [iso-8859-1] Sun Jan 10 02:16:39 2016
@@ -28,7 +28,6 @@
IN ULONG CheckFlags)
{
PCMHIVE Hive;
- FILE_STANDARD_INFORMATION FileInformation;
IO_STATUS_BLOCK IoStatusBlock;
FILE_FS_SIZE_INFORMATION FileSizeInformation;
NTSTATUS Status;
@@ -168,21 +167,6 @@
/* Setup flags */
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,