mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[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. svn path=/trunk/; revision=70565
This commit is contained in:
parent
a5ed535978
commit
1dba309628
|
@ -113,10 +113,8 @@ typedef struct _HBASE_BLOCK
|
||||||
/* Hive identifier "regf" (0x66676572) */
|
/* Hive identifier "regf" (0x66676572) */
|
||||||
ULONG Signature;
|
ULONG Signature;
|
||||||
|
|
||||||
/* Update counter */
|
/* Update counters */
|
||||||
ULONG Sequence1;
|
ULONG Sequence1;
|
||||||
|
|
||||||
/* Update counter */
|
|
||||||
ULONG Sequence2;
|
ULONG Sequence2;
|
||||||
|
|
||||||
/* When this hive file was last modified */
|
/* 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 */
|
If the hive is volatile, this is the actual pointer to the CM_KEY_NODE */
|
||||||
HCELL_INDEX RootCell;
|
HCELL_INDEX RootCell;
|
||||||
|
|
||||||
/* Size of each hive block ? */
|
/* Size in bytes of the full hive, minus the header */
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
|
|
||||||
/* (1?) */
|
/* (1?) */
|
||||||
|
|
|
@ -353,14 +353,14 @@ HvpGetHiveHeader(IN PHHIVE Hive,
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS CMAPI
|
NTSTATUS CMAPI
|
||||||
HvLoadHive(IN PHHIVE Hive,
|
HvLoadHive(IN PHHIVE Hive)
|
||||||
IN ULONG FileSize)
|
|
||||||
{
|
{
|
||||||
PHBASE_BLOCK BaseBlock = NULL;
|
PHBASE_BLOCK BaseBlock = NULL;
|
||||||
ULONG Result;
|
ULONG Result;
|
||||||
LARGE_INTEGER TimeStamp;
|
LARGE_INTEGER TimeStamp;
|
||||||
ULONG Offset = 0;
|
ULONG Offset = 0;
|
||||||
PVOID HiveData;
|
PVOID HiveData;
|
||||||
|
ULONG FileSize;
|
||||||
|
|
||||||
/* Get the hive header */
|
/* Get the hive header */
|
||||||
Result = HvpGetHiveHeader(Hive, &BaseBlock, &TimeStamp);
|
Result = HvpGetHiveHeader(Hive, &BaseBlock, &TimeStamp);
|
||||||
|
@ -394,6 +394,7 @@ HvLoadHive(IN PHHIVE Hive,
|
||||||
Hive->Version = Hive->BaseBlock->Minor;
|
Hive->Version = Hive->BaseBlock->Minor;
|
||||||
|
|
||||||
/* Allocate a buffer large enough to hold the hive */
|
/* Allocate a buffer large enough to hold the hive */
|
||||||
|
FileSize = HBLOCK_SIZE + BaseBlock->Length;
|
||||||
HiveData = Hive->Allocate(FileSize, TRUE, TAG_CM);
|
HiveData = Hive->Allocate(FileSize, TRUE, TAG_CM);
|
||||||
if (!HiveData) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!HiveData) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
@ -405,7 +406,7 @@ HvLoadHive(IN PHHIVE Hive,
|
||||||
FileSize);
|
FileSize);
|
||||||
if (!Result) return STATUS_NOT_REGISTRY_FILE;
|
if (!Result) return STATUS_NOT_REGISTRY_FILE;
|
||||||
|
|
||||||
|
// This is a HACK!
|
||||||
/* Free our base block... it's usless in this implementation */
|
/* Free our base block... it's usless in this implementation */
|
||||||
Hive->Free(BaseBlock, 0);
|
Hive->Free(BaseBlock, 0);
|
||||||
|
|
||||||
|
@ -480,7 +481,7 @@ HvInitialize(
|
||||||
Hive->StorageTypeCount = HTYPE_COUNT;
|
Hive->StorageTypeCount = HTYPE_COUNT;
|
||||||
Hive->Cluster = 1;
|
Hive->Cluster = 1;
|
||||||
Hive->Version = HSYS_MINOR;
|
Hive->Version = HSYS_MINOR;
|
||||||
Hive->HiveFlags = HiveFlags &~ HIVE_NOLAZYFLUSH;
|
Hive->HiveFlags = HiveFlags & ~HIVE_NOLAZYFLUSH;
|
||||||
|
|
||||||
switch (OperationType)
|
switch (OperationType)
|
||||||
{
|
{
|
||||||
|
@ -498,8 +499,7 @@ HvInitialize(
|
||||||
|
|
||||||
case HINIT_FILE:
|
case HINIT_FILE:
|
||||||
{
|
{
|
||||||
/* HACK of doom: Cluster is actually the file size. */
|
Status = HvLoadHive(Hive);
|
||||||
Status = HvLoadHive(Hive, Cluster);
|
|
||||||
if ((Status != STATUS_SUCCESS) &&
|
if ((Status != STATUS_SUCCESS) &&
|
||||||
(Status != STATUS_REGISTRY_RECOVERED))
|
(Status != STATUS_REGISTRY_RECOVERED))
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,6 @@ CmpInitializeHive(OUT PCMHIVE *CmHive,
|
||||||
IN ULONG CheckFlags)
|
IN ULONG CheckFlags)
|
||||||
{
|
{
|
||||||
PCMHIVE Hive;
|
PCMHIVE Hive;
|
||||||
FILE_STANDARD_INFORMATION FileInformation;
|
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
FILE_FS_SIZE_INFORMATION FileSizeInformation;
|
FILE_FS_SIZE_INFORMATION FileSizeInformation;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -169,21 +168,6 @@ CmpInitializeHive(OUT PCMHIVE *CmHive,
|
||||||
Hive->Flags = 0;
|
Hive->Flags = 0;
|
||||||
Hive->FlushCount = 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 */
|
/* Initialize it */
|
||||||
Status = HvInitialize(&Hive->Hive,
|
Status = HvInitialize(&Hive->Hive,
|
||||||
OperationType,
|
OperationType,
|
||||||
|
|
Loading…
Reference in a new issue