- Get rid of "ChunkSize" through a sickening hack (however this should make the Hv* interface compatible enough for me to resume work on the cm branch).

svn path=/trunk/; revision=23583
This commit is contained in:
Alex Ionescu 2006-08-14 21:09:41 +00:00
parent 207e201632
commit 361a28608d
5 changed files with 22 additions and 15 deletions

View file

@ -715,7 +715,7 @@ RegImportBinaryHive(PCHAR ChunkBase,
CmHive = CmpAllocate(sizeof(EREGISTRY_HIVE), TRUE);
Status = HvInitialize (&CmHive->Hive, HV_OPERATION_MEMORY_INPLACE,
(ULONG_PTR)ChunkBase, ChunkSize,
(ULONG_PTR)ChunkBase, 0,
CmpAllocate, CmpFree,
NULL, NULL, NULL, NULL, NULL);
if (!NT_SUCCESS(Status))

View file

@ -142,7 +142,7 @@ HvInitialize(
PHHIVE RegistryHive,
ULONG Operation,
ULONG_PTR HiveData OPTIONAL,
SIZE_T Cluster, // HACK!!
ULONG Cluster OPTIONAL,
PALLOCATE_ROUTINE Allocate,
PFREE_ROUTINE Free,
PFILE_READ_ROUTINE FileRead,

View file

@ -137,15 +137,22 @@ HvpCreateHive(
NTSTATUS CMAPI
HvpInitializeMemoryHive(
PHHIVE Hive,
ULONG_PTR ChunkBase,
SIZE_T ChunkSize)
ULONG_PTR ChunkBase)
{
SIZE_T BlockIndex;
PHBIN Bin, NewBin;
ULONG i;
ULONG BitmapSize;
PULONG BitmapBuffer;
SIZE_T ChunkSize;
//
// This hack is similar in magnitude to the US's National Debt
//
ChunkSize = ((PHBASE_BLOCK)ChunkBase)->Length;
((PHBASE_BLOCK)ChunkBase)->Length = HV_BLOCK_SIZE;
DPRINT1("ChunkSize: %lx\n", ChunkSize);
if (ChunkSize < sizeof(HBASE_BLOCK) ||
!HvpVerifyHiveHeader((PHBASE_BLOCK)ChunkBase))
{
@ -250,11 +257,9 @@ HvpInitializeMemoryHive(
NTSTATUS CMAPI
HvpInitializeMemoryInplaceHive(
PHHIVE Hive,
ULONG_PTR ChunkBase,
SIZE_T ChunkSize)
ULONG_PTR ChunkBase)
{
if (ChunkSize < sizeof(HBASE_BLOCK) ||
!HvpVerifyHiveHeader((PHBASE_BLOCK)ChunkBase))
if (!HvpVerifyHiveHeader((PHBASE_BLOCK)ChunkBase))
{
return STATUS_REGISTRY_CORRUPT;
}
@ -301,8 +306,8 @@ NTSTATUS CMAPI
HvInitialize(
PHHIVE RegistryHive,
ULONG Operation,
ULONG_PTR ChunkBase,
SIZE_T ChunkSize,
ULONG_PTR HiveData OPTIONAL,
ULONG Cluster OPTIONAL,
PALLOCATE_ROUTINE Allocate,
PFREE_ROUTINE Free,
PFILE_READ_ROUTINE FileRead,
@ -334,11 +339,11 @@ HvInitialize(
break;
case HV_OPERATION_MEMORY:
Status = HvpInitializeMemoryHive(Hive, ChunkBase, ChunkSize);
Status = HvpInitializeMemoryHive(Hive, HiveData);
break;
case HV_OPERATION_MEMORY_INPLACE:
Status = HvpInitializeMemoryInplaceHive(Hive, ChunkBase, ChunkSize);
Status = HvpInitializeMemoryInplaceHive(Hive, HiveData);
break;
default:

View file

@ -51,8 +51,9 @@ CmImportBinaryHive (PCHAR ChunkBase,
Hive->Flags = Flags;
/* Allocate hive header */
((PHBASE_BLOCK)ChunkBase)->Length = ChunkSize;
Status = HvInitialize(&Hive->Hive, HV_OPERATION_MEMORY,
(ULONG_PTR)ChunkBase, ChunkSize,
(ULONG_PTR)ChunkBase, 0,
CmpAllocate, CmpFree,
CmpFileRead, CmpFileWrite, CmpFileSetSize,
CmpFileFlush, NULL);

View file

@ -569,8 +569,9 @@ CmiInitNonVolatileRegistryHive (PEREGISTRY_HIVE RegistryHive,
}
DPRINT("ViewBase %p ViewSize %lx\n", ViewBase, ViewSize);
((PHBASE_BLOCK)ViewBase)->Length = ViewSize;
Status = HvInitialize(&RegistryHive->Hive, HV_OPERATION_MEMORY,
(ULONG_PTR)ViewBase, ViewSize,
(ULONG_PTR)ViewBase, 0,
CmpAllocate, CmpFree,
CmpFileRead, CmpFileWrite, CmpFileSetSize,
CmpFileFlush, NULL);