mirror of
https://github.com/reactos/reactos.git
synced 2024-10-06 09:24:11 +00:00
Make HvIsCellAllocated working.
svn path=/trunk/; revision=32175
This commit is contained in:
parent
dbfe16d4c3
commit
9c1dc73ab3
|
@ -49,20 +49,18 @@ HvIsCellAllocated(IN PHHIVE RegistryHive,
|
||||||
ULONG Type, Block;
|
ULONG Type, Block;
|
||||||
|
|
||||||
/* If it's a flat hive, the cell is always allocated */
|
/* If it's a flat hive, the cell is always allocated */
|
||||||
if (RegistryHive->Flat) return TRUE;
|
if (RegistryHive->Flat)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
/* Otherwise, get the type and make sure it's valid */
|
/* Otherwise, get the type and make sure it's valid */
|
||||||
Type = HvGetCellType(CellIndex);
|
Type = HvGetCellType(CellIndex);
|
||||||
if (((CellIndex % ~HCELL_TYPE_MASK) > RegistryHive->Storage[Type].Length) ||
|
Block = HvGetCellBlock(CellIndex);
|
||||||
(CellIndex % (RegistryHive->Version >= 2 ? 8 : 16)))
|
if (Block >= RegistryHive->Storage[Type].Length)
|
||||||
{
|
|
||||||
/* Invalid cell index */
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
/* Try to get the cell block */
|
/* Try to get the cell block */
|
||||||
Block = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
|
if (RegistryHive->Storage[Type].BlockList[Block].BlockAddress)
|
||||||
if (RegistryHive->Storage[Type].BlockList[Block].BlockAddress) return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/* No valid block, fail */
|
/* No valid block, fail */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -130,7 +128,8 @@ HvIsCellDirty(IN PHHIVE Hive,
|
||||||
ASSERT(Hive->ReadOnly == FALSE);
|
ASSERT(Hive->ReadOnly == FALSE);
|
||||||
|
|
||||||
/* Volatile cells are always "dirty" */
|
/* Volatile cells are always "dirty" */
|
||||||
if (HvGetCellType(Cell) == Volatile) return TRUE;
|
if (HvGetCellType(Cell) == Volatile)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
/* Check if the dirty bit is set */
|
/* Check if the dirty bit is set */
|
||||||
return RtlCheckBit(&Hive->DirtyVector, Cell / HV_BLOCK_SIZE);
|
return RtlCheckBit(&Hive->DirtyVector, Cell / HV_BLOCK_SIZE);
|
||||||
|
|
|
@ -92,6 +92,8 @@ typedef ULONG HCELL_INDEX, *PHCELL_INDEX;
|
||||||
|
|
||||||
#define HvGetCellType(Cell) \
|
#define HvGetCellType(Cell) \
|
||||||
((ULONG)((Cell & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT))
|
((ULONG)((Cell & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT))
|
||||||
|
#define HvGetCellBlock(Cell) \
|
||||||
|
((ULONG)((Cell & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT))
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue