mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Final preparations for hardware hive import.
svn path=/trunk/; revision=4526
This commit is contained in:
parent
4aa19f2392
commit
7b5e0bebdf
1 changed files with 118 additions and 64 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: import.c,v 1.15 2003/04/04 14:05:29 ekohl Exp $
|
||||
/* $Id: import.c,v 1.16 2003/04/12 18:41:43 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -613,8 +613,9 @@ CmImportTextHive(PCHAR ChunkBase,
|
|||
|
||||
|
||||
static BOOLEAN
|
||||
CmImportBinarySystemHive(PCHAR ChunkBase,
|
||||
CmImportBinaryHive (PCHAR ChunkBase,
|
||||
ULONG ChunkSize,
|
||||
ULONG Flags,
|
||||
PREGISTRY_HIVE *RegistryHive)
|
||||
{
|
||||
PREGISTRY_HIVE Hive;
|
||||
|
@ -644,6 +645,10 @@ CmImportBinarySystemHive(PCHAR ChunkBase,
|
|||
RtlZeroMemory (Hive,
|
||||
sizeof(REGISTRY_HIVE));
|
||||
|
||||
/* Set hive flags */
|
||||
Hive->Flags = Flags;
|
||||
|
||||
/* Allocate hive header */
|
||||
Hive->HiveHeader = (PHIVE_HEADER)ExAllocatePool (NonPagedPool,
|
||||
sizeof(HIVE_HEADER));
|
||||
if (Hive->HiveHeader == NULL)
|
||||
|
@ -753,6 +758,8 @@ CmImportBinarySystemHive(PCHAR ChunkBase,
|
|||
BlockOffset += Bin->BlockSize;
|
||||
}
|
||||
|
||||
if (!(Hive->Flags & HIVE_VOLATILE))
|
||||
{
|
||||
/* Calculate bitmap size in bytes (always a multiple of 32 bits) */
|
||||
BitmapSize = ROUND_UP (Hive->BlockListSize, sizeof(ULONG) * 8) / 8;
|
||||
DPRINT ("Hive->BlockListSize: %lu\n", Hive->BlockListSize);
|
||||
|
@ -777,7 +784,7 @@ CmImportBinarySystemHive(PCHAR ChunkBase,
|
|||
BitmapSize * 8);
|
||||
RtlClearAllBits (&Hive->DirtyBitMap);
|
||||
Hive->HiveDirty = FALSE;
|
||||
|
||||
}
|
||||
|
||||
/* Initialize the hive's executive resource */
|
||||
ExInitializeResourceLite(&Hive->HiveResource);
|
||||
|
@ -805,19 +812,26 @@ CmImportSystemHive(PCHAR ChunkBase,
|
|||
UNICODE_STRING KeyName;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT ("CmImportSystemHive() called\n");
|
||||
|
||||
if (strncmp (ChunkBase, "REGEDIT4", 8) == 0)
|
||||
{
|
||||
DPRINT ("Found 'REGEDIT4' magic\n");
|
||||
CmImportTextHive (ChunkBase, ChunkSize);
|
||||
return TRUE;
|
||||
}
|
||||
else if (strncmp (ChunkBase, "regf", 4) == 0)
|
||||
else if (strncmp (ChunkBase, "regf", 4) != 0)
|
||||
{
|
||||
DPRINT1 ("Found invalid '%.*s' magic\n", 4, ChunkBase);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT ("Found '%.*s' magic\n", 4, ChunkBase);
|
||||
|
||||
/* Import the binary system hive */
|
||||
if (!CmImportBinarySystemHive (ChunkBase, ChunkSize, &RegistryHive))
|
||||
/* Import the binary system hive (non-volatile, offset-based, permanent) */
|
||||
if (!CmImportBinaryHive (ChunkBase, ChunkSize, 0, &RegistryHive))
|
||||
{
|
||||
DPRINT1 ("CmiImportBinaryHive() failed\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -844,15 +858,55 @@ CmImportSystemHive(PCHAR ChunkBase,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
CmImportHardwareHive(PCHAR ChunkBase,
|
||||
ULONG ChunkSize)
|
||||
{
|
||||
DPRINT1("CmImportHardwareHive() called\n");
|
||||
#if 0
|
||||
PREGISTRY_HIVE RegistryHive;
|
||||
UNICODE_STRING KeyName;
|
||||
NTSTATUS Status;
|
||||
#endif
|
||||
|
||||
DPRINT ("CmImportHardwareHive() called\n");
|
||||
|
||||
#if 0
|
||||
if (strncmp (ChunkBase, "regf", 4) != 0)
|
||||
{
|
||||
DPRINT1 ("Found invalid '%.*s' magic\n", 4, ChunkBase);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DPRINT ("Found '%.*s' magic\n", 4, ChunkBase);
|
||||
|
||||
/* Import the binary system hive (volatile, offset-based, permanent) */
|
||||
if (!CmImportBinaryHive (ChunkBase, ChunkSize, HIVE_VOLATILE, &RegistryHive))
|
||||
{
|
||||
DPRINT1 ("CmiImportBinaryHive() failed\n", Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Attach it to the machine key */
|
||||
RtlInitUnicodeString (&KeyName,
|
||||
L"\\Registry\\Machine\\HARDWARE");
|
||||
Status = CmiConnectHive (RegistryHive,
|
||||
&KeyName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1 ("CmiConnectHive() failed (Status %lx)\n", Status);
|
||||
// CmiRemoveRegistryHive(RegistryHive);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set the hive filename */
|
||||
RtlCreateUnicodeString (&RegistryHive->HiveFileName,
|
||||
NULL);
|
||||
|
||||
/* Set the log filename */
|
||||
RtlCreateUnicodeString (&RegistryHive->LogFileName,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue