[CMLIB] Adjust parameter types and annotations. Add diagnostic assertions.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 13 Oct 2018 22:16:04 +0000 (00:16 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 14 Oct 2018 13:59:31 +0000 (15:59 +0200)
sdk/lib/cmlib/cmlib.h
sdk/lib/cmlib/cmname.c
sdk/lib/cmlib/cmvalue.c

index 46676a2..b9431c7 100644 (file)
@@ -595,7 +595,7 @@ CmpFindNameInList(
     IN PHHIVE Hive,
     IN PCHILD_LIST ChildList,
     IN PUNICODE_STRING Name,
-    OUT PULONG ChildIndex,
+    OUT PULONG ChildIndex OPTIONAL,
     OUT PHCELL_INDEX CellIndex
 );
 
@@ -625,7 +625,7 @@ CmpSetValueDataNew(
     IN PHHIVE Hive,
     IN PVOID Data,
     IN ULONG DataSize,
-    IN ULONG StorageType,
+    IN HSTORAGE_TYPE StorageType,
     IN HCELL_INDEX ValueCell,
     OUT PHCELL_INDEX DataCell
 );
@@ -636,7 +636,7 @@ CmpAddValueToList(
     IN PHHIVE Hive,
     IN HCELL_INDEX ValueCell,
     IN ULONG Index,
-    IN ULONG Type,
+    IN HSTORAGE_TYPE StorageType,
     IN OUT PCHILD_LIST ChildList
 );
 
index 918cbb2..b123740 100644 (file)
@@ -149,7 +149,7 @@ NTAPI
 CmpFindNameInList(IN PHHIVE Hive,
                   IN PCHILD_LIST ChildList,
                   IN PUNICODE_STRING Name,
-                  OUT PULONG ChildIndex,
+                  OUT PULONG ChildIndex OPTIONAL,
                   OUT PHCELL_INDEX CellIndex)
 {
     PCELL_DATA CellData;
index a038c77..86344a7 100644 (file)
@@ -207,7 +207,7 @@ NTAPI
 CmpAddValueToList(IN PHHIVE Hive,
                   IN HCELL_INDEX ValueCell,
                   IN ULONG Index,
-                  IN ULONG Type,
+                  IN HSTORAGE_TYPE StorageType,
                   IN OUT PCHILD_LIST ChildList)
 {
     HCELL_INDEX ListCell;
@@ -223,6 +223,8 @@ CmpAddValueToList(IN PHHIVE Hive,
     ChildCount++;
     if (ChildCount > 1)
     {
+        ASSERT(ChildList->List != HCELL_NIL);
+
         /* The cell should be dirty at this point */
         ASSERT(HvIsCellDirty(Hive, ChildList->List));
 
@@ -249,7 +251,8 @@ CmpAddValueToList(IN PHHIVE Hive,
     else
     {
         /* This is our first child, so allocate a single cell */
-        ListCell = HvAllocateCell(Hive, sizeof(HCELL_INDEX), Type, HCELL_NIL);
+        ASSERT(ChildList->List == HCELL_NIL);
+        ListCell = HvAllocateCell(Hive, sizeof(HCELL_INDEX), StorageType, HCELL_NIL);
     }
 
     /* Fail if we couldn't get a cell */
@@ -286,7 +289,7 @@ NTAPI
 CmpSetValueDataNew(IN PHHIVE Hive,
                    IN PVOID Data,
                    IN ULONG DataSize,
-                   IN ULONG StorageType,
+                   IN HSTORAGE_TYPE StorageType,
                    IN HCELL_INDEX ValueCell,
                    OUT PHCELL_INDEX DataCell)
 {