Author: hbelusca
Date: Sat Jan 9 23:50:10 2016
New Revision: 70563
URL:
http://svn.reactos.org/svn/reactos?rev=70563&view=rev
Log:
[CMLIB]: Use the HvGetCell* macros where it's possible.
Modified:
trunk/reactos/lib/cmlib/hivecell.c
Modified: trunk/reactos/lib/cmlib/hivecell.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cmlib/hivecell.c?rev=7…
==============================================================================
--- trunk/reactos/lib/cmlib/hivecell.c [iso-8859-1] (original)
+++ trunk/reactos/lib/cmlib/hivecell.c [iso-8859-1] Sat Jan 9 23:50:10 2016
@@ -22,13 +22,10 @@
ASSERT(CellIndex != HCELL_NIL);
if (!RegistryHive->Flat)
{
- ULONG CellType;
- ULONG CellBlock;
- ULONG CellOffset;
-
- CellType = (CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
- CellBlock = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
- CellOffset = (CellIndex & HCELL_OFFSET_MASK) >> HCELL_OFFSET_SHIFT;
+ ULONG CellType = HvGetCellType(CellIndex);
+ ULONG CellBlock = HvGetCellBlock(CellIndex);
+ ULONG CellOffset = (CellIndex & HCELL_OFFSET_MASK) >>
HCELL_OFFSET_SHIFT;
+
ASSERT(CellBlock < RegistryHive->Storage[CellType].Length);
Block =
(PVOID)RegistryHive->Storage[CellType].BlockList[CellBlock].BlockAddress;
ASSERT(Block != NULL);
@@ -113,11 +110,11 @@
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)
+ if (HvGetCellType(CellIndex) != Stable)
return TRUE;
- CellBlock = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
- CellLastBlock = ((CellIndex + HBLOCK_SIZE - 1) & HCELL_BLOCK_MASK) >>
HCELL_BLOCK_SHIFT;
+ CellBlock = HvGetCellBlock(CellIndex);
+ CellLastBlock = HvGetCellBlock(CellIndex + HBLOCK_SIZE - 1);
RtlSetBits(&RegistryHive->DirtyVector,
CellBlock, CellLastBlock - CellBlock);
@@ -187,7 +184,7 @@
ASSERT(RegistryHive != NULL);
ASSERT(FreeBlock != NULL);
- Storage = (FreeIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
+ Storage = HvGetCellType(FreeIndex);
Index = HvpComputeFreeListIndex((ULONG)FreeBlock->Size);
FreeBlockData = (PHCELL_INDEX)(FreeBlock + 1);
@@ -212,7 +209,7 @@
ASSERT(RegistryHive->ReadOnly == FALSE);
- Storage = (CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
+ Storage = HvGetCellType(CellIndex);
Index = HvpComputeFreeListIndex((ULONG)CellBlock->Size);
pFreeCellOffset = &RegistryHive->Storage[Storage].FreeDisplay[Index];
@@ -410,7 +407,7 @@
CMLTRACE(CMLIB_HCELL_DEBUG, "%s - Hive %p, CellIndex %08lx, Size %x\n",
__FUNCTION__, RegistryHive, CellIndex, Size);
- Storage = (CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
+ Storage = HvGetCellType(CellIndex);
OldCell = HvGetCell(RegistryHive, CellIndex);
OldCellSize = HvGetCellSize(RegistryHive, OldCell);
@@ -462,8 +459,8 @@
Free->Size = -Free->Size;
- CellType = (CellIndex & HCELL_TYPE_MASK) >> HCELL_TYPE_SHIFT;
- CellBlock = (CellIndex & HCELL_BLOCK_MASK) >> HCELL_BLOCK_SHIFT;
+ CellType = HvGetCellType(CellIndex);
+ CellBlock = HvGetCellBlock(CellIndex);
/* FIXME: Merge free blocks */
Bin = (PHBIN)RegistryHive->Storage[CellType].BlockList[CellBlock].BinAddress;