[ros-diffs] [ion] 23583: - 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).

ion at svn.reactos.org ion at svn.reactos.org
Mon Aug 14 23:09:42 CEST 2006


Author: ion
Date: Tue Aug 15 01:09:41 2006
New Revision: 23583

URL: http://svn.reactos.org/svn/reactos?rev=23583&view=rev
Log:
- 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).

Modified:
    trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c
    trunk/reactos/lib/cmlib/cmlib.h
    trunk/reactos/lib/cmlib/hiveinit.c
    trunk/reactos/ntoskrnl/cm/import.c
    trunk/reactos/ntoskrnl/cm/regfile.c

Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c?rev=23583&r1=23582&r2=23583&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c Tue Aug 15 01:09:41 2006
@@ -715,7 +715,7 @@
 
   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))

Modified: trunk/reactos/lib/cmlib/cmlib.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/cmlib.h?rev=23583&r1=23582&r2=23583&view=diff
==============================================================================
--- trunk/reactos/lib/cmlib/cmlib.h (original)
+++ trunk/reactos/lib/cmlib/cmlib.h Tue Aug 15 01:09:41 2006
@@ -142,7 +142,7 @@
    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,

Modified: trunk/reactos/lib/cmlib/hiveinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hiveinit.c?rev=23583&r1=23582&r2=23583&view=diff
==============================================================================
--- trunk/reactos/lib/cmlib/hiveinit.c (original)
+++ trunk/reactos/lib/cmlib/hiveinit.c Tue Aug 15 01:09:41 2006
@@ -137,15 +137,22 @@
 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 @@
 NTSTATUS CMAPI
 HvpInitializeMemoryInplaceHive(
    PHHIVE Hive,
-   ULONG_PTR ChunkBase,
-   SIZE_T ChunkSize)
-{
-   if (ChunkSize < sizeof(HBASE_BLOCK) ||
-       !HvpVerifyHiveHeader((PHBASE_BLOCK)ChunkBase))
+   ULONG_PTR ChunkBase)
+{
+   if (!HvpVerifyHiveHeader((PHBASE_BLOCK)ChunkBase))
    {
       return STATUS_REGISTRY_CORRUPT;
    }
@@ -301,8 +306,8 @@
 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 @@
          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:

Modified: trunk/reactos/ntoskrnl/cm/import.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/import.c?rev=23583&r1=23582&r2=23583&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cm/import.c (original)
+++ trunk/reactos/ntoskrnl/cm/import.c Tue Aug 15 01:09:41 2006
@@ -51,8 +51,9 @@
   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);

Modified: trunk/reactos/ntoskrnl/cm/regfile.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cm/regfile.c?rev=23583&r1=23582&r2=23583&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cm/regfile.c (original)
+++ trunk/reactos/ntoskrnl/cm/regfile.c Tue Aug 15 01:09:41 2006
@@ -569,8 +569,9 @@
     }
   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);




More information about the Ros-diffs mailing list