ASSERT(RegistryHive->ReadOnly == FALSE);
- CMLTRACE(CMLIB_HCELL_DEBUG, "%s - Hive %p, CellIndex %08lx, HoldingLock %b\n",
+ CMLTRACE(CMLIB_HCELL_DEBUG, "%s - Hive %p, CellIndex %08lx, HoldingLock %u\n",
__FUNCTION__, RegistryHive, CellIndex, HoldingLock);
if ((CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT != Stable)
RtlSetBits(&RegistryHive->DirtyVector,
CellBlock, CellLastBlock - CellBlock);
+ RegistryHive->DirtyCount++;
return TRUE;
}
ULONG Size)
{
ULONG Index;
- static CCHAR FindFirstSet[256] = {
+ static CCHAR FindFirstSet[128] = {
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
+ ASSERT(Size >= (1 << 3));
Index = (Size >> 3) - 1;
if (Index >= 16)
{
- if (Index > 255)
+ if (Index > 127)
Index = 23;
else
- Index = FindFirstSet[Index] + 7;
+ Index = FindFirstSet[Index] + 16;
}
return Index;
/* 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)
{
Hive->Storage[Stable].FreeDisplay[Index] = HCELL_NIL;
Hive->Storage[Volatile].FreeDisplay[Index] = HCELL_NIL;
}
-
+//__debugbreak();
BlockOffset = 0;
BlockIndex = 0;
while (BlockIndex < Hive->Storage[Stable].Length)
HCELL_INDEX CMAPI
HvAllocateCell(
PHHIVE RegistryHive,
- SIZE_T Size,
+ ULONG Size,
HSTORAGE_TYPE Storage,
HCELL_INDEX Vicinity)
{
CellRef->StaticCount++;
return TRUE;
}
-
+
/* FIXME: TODO */
- DPRINT1("ERROR: Too many references\n");
- while (TRUE);
+ ASSERTMSG("ERROR: Too many references\n", FALSE);
return FALSE;
}
/* Any references? */
if (CellRef->StaticCount > 0)
- {
+ {
/* Sanity check */
ASSERT(CellRef->StaticCount <= STATIC_CELL_PAIR_COUNT);
-
+
/* Loop them */
for (i = 0; i < CellRef->StaticCount;i++)
{
/* Free again */
CellRef->StaticCount = 0;
}
-}
\ No newline at end of file
+}