Author: fireball
Date: Tue Dec 11 18:50:30 2007
New Revision: 31146
URL:
http://svn.reactos.org/svn/reactos?rev=31146&view=rev
Log:
- Remove all registry-writing code from FreeLDR.
- Create an empty volatile HARDWARE hive in the Kernel, and build it based on the ARC
tree.
Modified:
trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c
trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
trunk/reactos/boot/freeldr/freeldr/reactos/registry.c
trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c
trunk/reactos/ntoskrnl/config/cmconfig.c
trunk/reactos/ntoskrnl/config/cmsysini.c
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c Tue Dec 11 18:50:30 2007
@@ -43,485 +43,6 @@
return MmFreeMemory(Ptr);
}
-
-static BOOLEAN
-CmiAllocateHashTableCell (PHHIVE Hive,
- PHCELL_INDEX HBOffset,
- ULONG SubKeyCount)
-{
- PCM_KEY_FAST_INDEX HashCell;
- ULONG NewHashSize;
-
- NewHashSize = sizeof(CM_KEY_FAST_INDEX) +
- (SubKeyCount * sizeof(CM_INDEX));
- *HBOffset = HvAllocateCell (Hive, NewHashSize, Stable, HCELL_NIL);
- if (*HBOffset == HCELL_NIL)
- {
- return FALSE;
- }
-
- HashCell = (PCM_KEY_FAST_INDEX)HvGetCell (Hive, *HBOffset);
- HashCell->Signature = CM_KEY_FAST_LEAF;
- HashCell->Count = SubKeyCount;
-
- return TRUE;
-}
-
-
-static BOOLEAN
-CmiAddKeyToParentHashTable (PHHIVE Hive,
- HCELL_INDEX Parent,
- PCM_KEY_NODE NewKeyCell,
- HCELL_INDEX NKBOffset)
-{
- PCM_KEY_FAST_INDEX HashBlock;
- PCM_KEY_NODE ParentKeyCell;
- ULONG i;
-
- ParentKeyCell = (PVOID)HvGetCell (Hive, Parent);
- HashBlock = (PVOID)HvGetCell (Hive, ParentKeyCell->SubKeyLists[Stable]);
-
- for (i = 0; i < HashBlock->Count; i++)
- {
- if (HashBlock->List[i].Cell == 0)
- {
- HashBlock->List[i].Cell = NKBOffset;
- memcpy (&HashBlock->List[i].HashKey,
- NewKeyCell->Name,
- min(NewKeyCell->NameLength, sizeof(ULONG)));
- ParentKeyCell->SubKeyCounts[Stable]++;
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-static BOOLEAN
-CmiAllocateValueListCell (PHHIVE Hive,
- PHCELL_INDEX ValueListOffset,
- ULONG ValueCount)
-{
- ULONG ValueListSize;
-
- ValueListSize = sizeof(VALUE_LIST_CELL) +
- (ValueCount * sizeof(HCELL_INDEX));
- *ValueListOffset = HvAllocateCell (Hive, ValueListSize, Stable, HCELL_NIL);
- if (*ValueListOffset == HCELL_NIL)
- {
- DbgPrint((DPRINT_REGISTRY, "HvAllocateCell() failed\n"));
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-static BOOLEAN
-CmiAllocateValueCell(PHHIVE Hive,
- PCM_KEY_VALUE *ValueCell,
- HCELL_INDEX *ValueCellOffset,
- PWCHAR ValueName)
-{
- PCM_KEY_VALUE NewValueCell;
- ULONG NameLength;
- BOOLEAN Packable = TRUE;
- ULONG i;
-
- NameLength = (ValueName == NULL) ? 0 : wcslen (ValueName);
- for (i = 0; i < NameLength; i++)
- {
- if (ValueName[i] & 0xFF00)
- {
- NameLength *= sizeof(WCHAR);
- Packable = FALSE;
- break;
- }
- }
- *ValueCellOffset = HvAllocateCell (Hive, sizeof(CM_KEY_VALUE) + NameLength, Stable,
HCELL_NIL);
- if (*ValueCellOffset == HCELL_NIL)
- {
- DbgPrint((DPRINT_REGISTRY, "CmiAllocateCell() failed\n"));
- return FALSE;
- }
-
- NewValueCell = (PCM_KEY_VALUE) HvGetCell (Hive, *ValueCellOffset);
- NewValueCell->Signature = CM_KEY_VALUE_SIGNATURE;
- NewValueCell->NameLength = NameLength;
- NewValueCell->Flags = 0;
- if (NameLength > 0)
- {
- if (Packable)
- {
- for (i = 0; i < NameLength; i++)
- {
- ((PCHAR)NewValueCell->Name)[i] = (CHAR)ValueName[i];
- }
- NewValueCell->Flags |= VALUE_COMP_NAME;
- }
- else
- {
- memcpy (NewValueCell->Name,
- ValueName,
- NameLength);
- }
- }
- NewValueCell->Type = 0;
- NewValueCell->DataLength = 0;
- NewValueCell->Data = -1;
-
- *ValueCell = NewValueCell;
-
- return TRUE;
-}
-
-
-static BOOLEAN
-CmiAddValueToKeyValueList(PHHIVE Hive,
- HCELL_INDEX KeyCellOffset,
- HCELL_INDEX ValueCellOffset)
-{
- PVALUE_LIST_CELL ValueListCell;
- PCM_KEY_NODE KeyCell;
-
- KeyCell = (PCM_KEY_NODE)HvGetCell (Hive, KeyCellOffset);
- if (KeyCell == NULL)
- {
- DbgPrint((DPRINT_REGISTRY, "HvGetCell() failed\n"));
- return FALSE;
- }
-
- ValueListCell = (PVALUE_LIST_CELL)HvGetCell (Hive, KeyCell->ValueList.List);
- if (ValueListCell == NULL)
- {
- DbgPrint((DPRINT_REGISTRY, "HvGetCell() failed\n"));
- return FALSE;
- }
-
- ValueListCell->ValueOffset[KeyCell->ValueList.Count] = ValueCellOffset;
- KeyCell->ValueList.Count++;
-
- return TRUE;
-}
-
-static BOOLEAN
-CmiExportValue (PHHIVE Hive,
- HCELL_INDEX KeyCellOffset,
- FRLDRHKEY Key,
- PVALUE Value)
-{
- HCELL_INDEX ValueCellOffset;
- HCELL_INDEX DataCellOffset;
- PCM_KEY_VALUE ValueCell;
- PVOID DataCell;
- ULONG DataLength;
- ULONG Type;
- PCHAR Data;
-
- DbgPrint((DPRINT_REGISTRY, "CmiExportValue('%S') called\n",
- (Value == NULL) ? "<default>" : (PCHAR)Value->Name));
- DbgPrint((DPRINT_REGISTRY, "DataLength %lu\n",
- (Value == NULL) ? Key->DataSize : Value->DataSize));
-
- /* Allocate value cell */
- if (!CmiAllocateValueCell(Hive, &ValueCell, &ValueCellOffset, (Value == NULL) ?
NULL : Value->Name))
- {
- return FALSE;
- }
-
- if (!CmiAddValueToKeyValueList(Hive, KeyCellOffset, ValueCellOffset))
- {
- return FALSE;
- }
-
- if (Value == NULL)
- {
- Type = Key->DataType;
- DataLength = Key->DataSize;
- Data = Key->Data;
- }
- else
- {
- Type = Value->DataType;
- DataLength = Value->DataSize;
- Data = Value->Data;
- }
-
- if (DataLength <= sizeof(HCELL_INDEX))
- {
- ValueCell->DataLength = DataLength | REG_DATA_IN_OFFSET;
- ValueCell->Type = Type;
- memcpy (&ValueCell->Data,
- &Data,
- DataLength);
- }
- else
- {
- /* Allocate data cell */
- DataCellOffset = HvAllocateCell (Hive, DataLength, Stable, HCELL_NIL);
- if (DataCellOffset == HCELL_NIL)
- {
- return FALSE;
- }
-
- ValueCell->Data = DataCellOffset;
- ValueCell->DataLength = DataLength;
- ValueCell->Type = Type;
-
- DataCell = (PVOID)HvGetCell (Hive, DataCellOffset);
- memcpy (DataCell,
- Data,
- DataLength);
- }
-
- return TRUE;
-}
-
-
-static BOOLEAN
-CmiExportSubKey (PHHIVE Hive,
- HCELL_INDEX Parent,
- FRLDRHKEY ParentKey,
- FRLDRHKEY Key)
-{
- HCELL_INDEX NKBOffset;
- PCM_KEY_NODE NewKeyCell;
- ULONG KeyCellSize;
- ULONG SubKeyCount;
- ULONG ValueCount;
- PLIST_ENTRY Entry;
- FRLDRHKEY SubKey;
- PVALUE Value;
- BOOLEAN Packable = TRUE;
- ULONG i;
- ULONG NameLength;
-
- DbgPrint((DPRINT_REGISTRY, "CmiExportSubKey('%S') called\n",
Key->Name));
-
- /* Don't export links */
- if (Key->DataType == REG_LINK)
- return TRUE;
-
- NameLength = (Key->NameSize - sizeof(WCHAR)) / sizeof(WCHAR);
- for (i = 0; i < NameLength; i++)
- {
- if (Key->Name[i] & 0xFF00)
- {
- Packable = FALSE;
- NameLength *= sizeof(WCHAR);
- break;
- }
- }
-
- /* Allocate key cell */
- KeyCellSize = sizeof(CM_KEY_NODE) + NameLength;
- NKBOffset = HvAllocateCell (Hive, KeyCellSize, Stable, HCELL_NIL);
- if (NKBOffset == HCELL_NIL)
- {
- DbgPrint((DPRINT_REGISTRY, "HvAllocateCell() failed\n"));
- return FALSE;
- }
-
- /* Initialize key cell */
- NewKeyCell = (PCM_KEY_NODE) HvGetCell (Hive, NKBOffset);
- NewKeyCell->Signature = CM_KEY_NODE_SIGNATURE;
- NewKeyCell->Flags = 0;
- NewKeyCell->LastWriteTime.QuadPart = 0ULL;
- NewKeyCell->Parent = Parent;
- NewKeyCell->SubKeyCounts[Stable] = 0;
- NewKeyCell->SubKeyLists[Stable] = -1;
- NewKeyCell->ValueList.Count = 0;
- NewKeyCell->ValueList.List = -1;
- NewKeyCell->Security = -1;
- NewKeyCell->Class = -1;
- NewKeyCell->NameLength = NameLength;
- NewKeyCell->ClassLength = 0;
- if (Packable)
- {
- for (i = 0; i < NameLength; i++)
- {
- ((PCHAR)NewKeyCell->Name)[i] = (CHAR)Key->Name[i];
- }
- NewKeyCell->Flags |= KEY_COMP_NAME;
-
- }
- else
- {
- memcpy (NewKeyCell->Name,
- Key->Name,
- NameLength);
- }
-
- /* Add key cell to the parent key's hash table */
- if (!CmiAddKeyToParentHashTable (Hive,
- Parent,
- NewKeyCell,
- NKBOffset))
- {
- DbgPrint((DPRINT_REGISTRY, "CmiAddKeyToParentHashTable() failed\n"));
- return FALSE;
- }
-
- ValueCount = RegGetValueCount (Key);
- DbgPrint((DPRINT_REGISTRY, "ValueCount: %u\n", ValueCount));
- if (ValueCount > 0)
- {
- /* Allocate value list cell */
- if (!CmiAllocateValueListCell (Hive,
- &NewKeyCell->ValueList.List,
- ValueCount))
- {
- DbgPrint((DPRINT_REGISTRY, "CmiAllocateValueListCell() failed\n"));
- return FALSE;
- }
-
- if (Key->DataSize != 0)
- {
- if (!CmiExportValue (Hive, NKBOffset, Key, NULL))
- return FALSE;
- }
-
- /* Enumerate values */
- Entry = Key->ValueList.Flink;
- while (Entry != &Key->ValueList)
- {
- Value = CONTAINING_RECORD(Entry,
- VALUE,
- ValueList);
-
- if (!CmiExportValue (Hive, NKBOffset, Key, Value))
- return FALSE;
-
- Entry = Entry->Flink;
- }
- }
-
- SubKeyCount = RegGetSubKeyCount (Key);
- DbgPrint((DPRINT_REGISTRY, "SubKeyCount: %u\n", SubKeyCount));
- if (SubKeyCount > 0)
- {
- /* Allocate hash table cell */
- if (!CmiAllocateHashTableCell (Hive,
- &NewKeyCell->SubKeyLists[Stable],
- SubKeyCount))
- {
- DbgPrint((DPRINT_REGISTRY, "CmiAllocateHashTableCell() failed\n"));
- return FALSE;
- }
-
- /* Enumerate subkeys */
- Entry = Key->SubKeyList.Flink;
- while (Entry != &Key->SubKeyList)
- {
- SubKey = CONTAINING_RECORD(Entry,
- KEY,
- KeyList);
-
- if (!CmiExportSubKey (Hive, NKBOffset, Key, SubKey))
- return FALSE;
-
- Entry = Entry->Flink;
- }
- }
-
- return TRUE;
-}
-
-
-static BOOLEAN
-CmiExportHive (PHHIVE Hive,
- PCWSTR KeyName)
-{
- PCM_KEY_NODE KeyCell;
- FRLDRHKEY Key;
- ULONG SubKeyCount;
- ULONG ValueCount;
- PLIST_ENTRY Entry;
- FRLDRHKEY SubKey;
- PVALUE Value;
-
- DbgPrint((DPRINT_REGISTRY, "CmiExportHive(%x, '%S') called\n", Hive,
KeyName));
-
- if (RegOpenKey (NULL, KeyName, &Key) != ERROR_SUCCESS)
- {
- DbgPrint((DPRINT_REGISTRY, "RegOpenKey() failed\n"));
- return FALSE;
- }
-
- KeyCell = (PCM_KEY_NODE)HvGetCell (Hive, Hive->BaseBlock->RootCell);
- if (KeyCell == NULL)
- {
- DbgPrint((DPRINT_REGISTRY, "HvGetCell() failed\n"));
- return FALSE;
- }
-
- ValueCount = RegGetValueCount (Key);
- DbgPrint((DPRINT_REGISTRY, "ValueCount: %u\n", ValueCount));
- if (ValueCount > 0)
- {
- /* Allocate value list cell */
- if (!CmiAllocateValueListCell (Hive,
- &KeyCell->ValueList.List,
- ValueCount))
- {
- DbgPrint((DPRINT_REGISTRY, "CmiAllocateValueListCell() failed\n"));
- return FALSE;
- }
-
- if (Key->DataSize != 0)
- {
- if (!CmiExportValue (Hive, Hive->BaseBlock->RootCell, Key, NULL))
- return FALSE;
- }
-
- /* Enumerate values */
- Entry = Key->ValueList.Flink;
- while (Entry != &Key->ValueList)
- {
- Value = CONTAINING_RECORD(Entry,
- VALUE,
- ValueList);
-
- if (!CmiExportValue (Hive, Hive->BaseBlock->RootCell, Key, Value))
- return FALSE;
-
- Entry = Entry->Flink;
- }
- }
-
- SubKeyCount = RegGetSubKeyCount (Key);
- DbgPrint((DPRINT_REGISTRY, "SubKeyCount: %u\n", SubKeyCount));
- if (SubKeyCount > 0)
- {
- /* Allocate hash table cell */
- if (!CmiAllocateHashTableCell (Hive,
- &KeyCell->SubKeyLists[Stable],
- SubKeyCount))
- {
- DbgPrint((DPRINT_REGISTRY, "CmiAllocateHashTableCell() failed\n"));
- return FALSE;
- }
-
- /* Enumerate subkeys */
- Entry = Key->SubKeyList.Flink;
- while (Entry != &Key->SubKeyList)
- {
- SubKey = CONTAINING_RECORD(Entry,
- KEY,
- KeyList);
-
- if (!CmiExportSubKey (Hive, Hive->BaseBlock->RootCell, Key, SubKey))
- return FALSE;
-
- Entry = Entry->Flink;
- }
- }
-
- return TRUE;
-}
-
-
static BOOLEAN
RegImportValue (PHHIVE Hive,
PCM_KEY_VALUE ValueCell,
@@ -782,86 +303,4 @@
return TRUE;
}
-
-static VOID
-CmiWriteHive(PHHIVE Hive,
- PCHAR ChunkBase,
- ULONG* ChunkSize)
-{
- PHBIN Bin;
- ULONG i, Size;
-
- /* Write hive header */
- memcpy (ChunkBase, Hive->BaseBlock, HV_BLOCK_SIZE);
- Size = HV_BLOCK_SIZE;
-
- Bin = NULL;
- for (i = 0; i < Hive->Storage[Stable].Length; i++)
- {
- if (Hive->Storage[Stable].BlockList[i].BinAddress != (ULONG_PTR)Bin)
- {
- Bin = (PHBIN)Hive->Storage[Stable].BlockList[i].BinAddress;
- memcpy (ChunkBase + (i + 1) * HV_BLOCK_SIZE,
- Bin, Bin->Size);
- Size += Bin->Size;
- }
- }
-
- DbgPrint((DPRINT_REGISTRY, "ChunkSize: %x\n", Size));
-
- *ChunkSize = Size;
-}
-
-
-BOOLEAN
-RegExportBinaryHive(PCWSTR KeyName,
- PCHAR ChunkBase,
- ULONG* ChunkSize)
-{
- PCMHIVE CmHive;
- PHHIVE Hive;
- NTSTATUS Status;
-
- DbgPrint((DPRINT_REGISTRY, "Creating binary hardware hive\n"));
-
- CmHive = CmpAllocate(sizeof(CMHIVE), TRUE, 0);
- Status = HvInitialize (&CmHive->Hive,
- HINIT_CREATE,
- 0,
- 0,
- 0,
- CmpAllocate,
- CmpFree,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- NULL);
- Hive = &CmHive->Hive;
- if (!NT_SUCCESS(Status))
- {
- return FALSE;
- }
-
- /* Init root key cell */
- if (!CmCreateRootNode (Hive, KeyName))
- {
- HvFree (Hive);
- return FALSE;
- }
-
- if (!CmiExportHive (Hive, KeyName))
- {
- HvFree (Hive);
- return FALSE;
- }
-
- CmiWriteHive (Hive, ChunkBase, ChunkSize);
-
- HvFree (Hive);
-
- return TRUE;
-}
-
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c Tue Dec 11 18:50:30 2007
@@ -822,13 +822,6 @@
UiDrawProgressBarCenter(15, 100, szLoadingMsg);
- /*
- * Export the hardware hive
- */
- Base = FrLdrCreateModule ("HARDWARE");
- RegExportBinaryHive (L"\\Registry\\Machine\\HARDWARE", (PCHAR)Base,
&Size);
- FrLdrCloseModule (Base, Size);
-
UiDrawProgressBarCenter(20, 100, szLoadingMsg);
/*
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/registry.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/registry.c Tue Dec 11 18:50:30 2007
@@ -49,11 +49,6 @@
RegCreateKey (RootKey,
L"Registry\\Machine\\SYSTEM",
NULL);
-
- /* Create 'HARDWARE' key */
- RegCreateKey (RootKey,
- L"Registry\\Machine\\HARDWARE",
- NULL);
}
Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/react…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c Tue Dec 11 18:50:30 2007
@@ -160,8 +160,7 @@
VOID RunLoader(VOID)
{
- ULONG_PTR Base;
- ULONG Size, i;
+ ULONG i;
const char *SourcePath;
const char *LoadOptions = "", *DbgLoadOptions = "";
const char *sourcePaths[] = {
@@ -306,11 +305,6 @@
/* Load the kernel */
if (!FrLdrLoadKernel(szKernelName, 5)) return;
- /* Export the hardware hive */
- Base = FrLdrCreateModule ("HARDWARE");
- RegExportBinaryHive (L"\\Registry\\Machine\\HARDWARE", (PVOID)Base,
&Size);
- FrLdrCloseModule (Base, Size);
-
/* Insert boot disk 2 */
if (MachDiskBootingFromFloppy())
{
Modified: trunk/reactos/ntoskrnl/config/cmconfig.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmconfig.c…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmconfig.c (original)
+++ trunk/reactos/ntoskrnl/config/cmconfig.c Tue Dec 11 18:50:30 2007
@@ -87,7 +87,7 @@
/* Fail if the key couldn't be created, and make sure it's a new key */
if (!NT_SUCCESS(Status)) return Status;
- //ASSERT(Disposition == REG_CREATED_NEW_KEY);
+ ASSERT(Disposition == REG_CREATED_NEW_KEY);
}
/* Setup the component information key */
@@ -399,7 +399,7 @@
NtClose(KeyHandle);
/* Nobody should've created this key yet! */
- //ASSERT(Disposition == REG_CREATED_NEW_KEY);
+ ASSERT(Disposition == REG_CREATED_NEW_KEY);
/* Setup the key name */
RtlInitUnicodeString(&KeyName,
@@ -421,7 +421,7 @@
if (!NT_SUCCESS(Status)) return Status;
/* Nobody should've created this key yet! */
- //ASSERT(Disposition == REG_CREATED_NEW_KEY);
+ ASSERT(Disposition == REG_CREATED_NEW_KEY);
/* Allocate the configuration data buffer */
CmpConfigurationData = ExAllocatePoolWithTag(PagedPool,
@@ -454,3 +454,4 @@
+
Modified: trunk/reactos/ntoskrnl/config/cmsysini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsysini.c (original)
+++ trunk/reactos/ntoskrnl/config/cmsysini.c Tue Dec 11 18:50:30 2007
@@ -32,45 +32,6 @@
BOOLEAN CmpWasSetupBoot;
/* FUNCTIONS *****************************************************************/
-
-PVOID
-NTAPI
-CmpRosGetHardwareHive(OUT PULONG Length)
-{
- PLIST_ENTRY ListHead, NextEntry;
- PMEMORY_ALLOCATION_DESCRIPTOR MdBlock = NULL;
-
- /* Loop the memory descriptors */
- ListHead = &KeLoaderBlock->MemoryDescriptorListHead;
- NextEntry = ListHead->Flink;
- while (NextEntry != ListHead)
- {
- /* Get the current block */
- MdBlock = CONTAINING_RECORD(NextEntry,
- MEMORY_ALLOCATION_DESCRIPTOR,
- ListEntry);
-
- /* Check if this is an registry block */
- if (MdBlock->MemoryType == LoaderRegistryData)
- {
- /* Check if it's not the SYSTEM hive that we already initialized */
- if ((MdBlock->BasePage) !=
- (((ULONG_PTR)KeLoaderBlock->RegistryBase &~ KSEG0_BASE) >>
PAGE_SHIFT))
- {
- /* Hardware hive break out */
- break;
- }
- }
-
- /* Go to the next block */
- NextEntry = MdBlock->ListEntry.Flink;
- }
-
- /* We need a hardware hive */
- ASSERT(MdBlock);
- *Length = MdBlock->PageCount << PAGE_SHIFT;
- return (PVOID)((MdBlock->BasePage << PAGE_SHIFT) | KSEG0_BASE);
-}
VOID
NTAPI
@@ -1344,8 +1305,6 @@
HANDLE KeyHandle;
NTSTATUS Status;
PCMHIVE HardwareHive;
- PVOID BaseAddress;
- ULONG Length;
PSECURITY_DESCRIPTOR SecurityDescriptor;
PAGED_CODE();
@@ -1479,20 +1438,17 @@
KEBUGCHECKEX(CONFIG_INITIALIZATION_FAILED, 1, 8, Status, 0);
}
- /* Import the hardware hive (FIXME: We should create it from scratch) */
- BaseAddress = CmpRosGetHardwareHive(&Length);
- ((PHBASE_BLOCK)BaseAddress)->Length = Length;
+ /* Create the hardware hive */
Status = CmpInitializeHive((PCMHIVE*)&HardwareHive,
- HINIT_MEMORY, //HINIT_CREATE,
- HIVE_VOLATILE | HIVE_NOLAZYFLUSH,
+ HINIT_CREATE,
+ HIVE_VOLATILE,
HFILE_TYPE_PRIMARY,
- BaseAddress, // NULL,
+ NULL,
NULL,
NULL,
NULL,
NULL,
0);
- CmPrepareHive(&HardwareHive->Hive);
if (!NT_SUCCESS(Status))
{
/* Bugcheck */
@@ -1507,7 +1463,7 @@
Status = CmpLinkHiveToMaster(&KeyName,
NULL,
(PCMHIVE)HardwareHive,
- FALSE, // TRUE
+ TRUE,
SecurityDescriptor);
if (!NT_SUCCESS(Status))
{