__FUNCTION__, RegistryHive, CellIndex, HoldingLock);
if ((CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT != Stable)
- return FALSE;
+ return TRUE;
CellBlock = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
CellLastBlock = ((CellIndex + HV_BLOCK_SIZE - 1) & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
/* Something bad happened, print a useful trace info and bugcheck */
CMLTRACE(CMLIB_HCELL_DEBUG, "-- beginning of HvpRemoveFree trace --\n");
CMLTRACE(CMLIB_HCELL_DEBUG, "block we are about to free: %08x\n", CellIndex);
- CMLTRACE(CMLIB_HCELL_DEBUG, "chosen free list index: %d\n", Index);
+ CMLTRACE(CMLIB_HCELL_DEBUG, "chosen free list index: %u\n", Index);
for (FreeListIndex = 0; FreeListIndex < 24; FreeListIndex++)
{
- CMLTRACE(CMLIB_HCELL_DEBUG, "free list [%d]: ", FreeListIndex);
+ CMLTRACE(CMLIB_HCELL_DEBUG, "free list [%u]: ", FreeListIndex);
pFreeCellOffset = &RegistryHive->Storage[Storage].FreeDisplay[FreeListIndex];
while (*pFreeCellOffset != HCELL_NIL)
{
HCELL_INDEX CMAPI
HvAllocateCell(
PHHIVE RegistryHive,
- SIZE_T Size,
+ ULONG Size,
HSTORAGE_TYPE Storage,
HCELL_INDEX Vicinity)
{
if (CellType == Stable)
HvMarkCellDirty(RegistryHive, CellIndex, FALSE);
}
+
+BOOLEAN
+CMAPI
+HvTrackCellRef(PHV_TRACK_CELL_REF CellRef,
+ PHHIVE Hive,
+ HCELL_INDEX Cell)
+{
+ /* Sanity checks */
+ ASSERT(CellRef);
+ ASSERT(Hive );
+ ASSERT(Cell != HCELL_NIL);
+
+ /* Less than 4? */
+ if (CellRef->StaticCount < STATIC_CELL_PAIR_COUNT)
+ {
+ /* Add reference */
+ CellRef->StaticArray[CellRef->StaticCount].Hive = Hive;
+ CellRef->StaticArray[CellRef->StaticCount].Cell = Cell;
+ CellRef->StaticCount++;
+ return TRUE;
+ }
+
+ /* FIXME: TODO */
+ DPRINT1("ERROR: Too many references\n");
+ while (TRUE);
+ return FALSE;
+}
+
+VOID
+CMAPI
+HvReleaseFreeCellRefArray(PHV_TRACK_CELL_REF CellRef)
+{
+ ULONG i;
+ ASSERT(CellRef);
+
+ /* Any references? */
+ if (CellRef->StaticCount > 0)
+ {
+ /* Sanity check */
+ ASSERT(CellRef->StaticCount <= STATIC_CELL_PAIR_COUNT);
+
+ /* Loop them */
+ for (i = 0; i < CellRef->StaticCount;i++)
+ {
+ /* Release them */
+ HvReleaseCell(CellRef->StaticArray[i].Hive,
+ CellRef->StaticArray[i].Cell);
+ }
+
+ /* Free again */
+ CellRef->StaticCount = 0;
+ }
+}