[SDK:CMLIB][MKHIVE][BOOT:ENVIRON][NTOS:CONFIG] Add missing HvGetCell casts. Replace some ASSERT(FALSE).

This commit is contained in:
Hermès Bélusca-Maïto 2022-03-27 17:41:16 +02:00
parent 641fdb342e
commit a4cad7be6b
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
8 changed files with 36 additions and 36 deletions

View file

@ -826,7 +826,7 @@ BiEnumerateSubKeys (
}
/* Get the cell data for it */
Node = HvGetCell(Hive, CellIndex);
Node = (PCM_KEY_NODE)HvGetCell(Hive, CellIndex);
if (!Node)
{
Status = STATUS_REGISTRY_CORRUPT;

View file

@ -180,7 +180,7 @@ CmpSetValueKeyNew(IN PHHIVE Hive,
/* Get the actual data for it */
CellData = HvGetCell(Hive, ValueCell);
if (!CellData) ASSERT(FALSE);
ASSERT(CellData);
/* Now we can release it, make sure it's also dirty */
HvReleaseCell(Hive, ValueCell);
@ -355,7 +355,7 @@ CmpSetValueKeyExisting(IN PHHIVE Hive,
/* Now get the actual data for our data cell */
CellData = HvGetCell(Hive, NewCell);
if (!CellData) ASSERT(FALSE);
ASSERT(CellData);
/* Release it immediately */
HvReleaseCell(Hive, NewCell);
@ -1378,7 +1378,7 @@ CmpQueryKeyDataFromCache(
#if DBG
/* Get the cell node */
Node = HvGetCell(KeyHive, KeyCell);
Node = (PCM_KEY_NODE)HvGetCell(KeyHive, KeyCell);
if (Node != NULL)
{
ULONG SubKeyCount;
@ -1457,7 +1457,7 @@ CmpQueryKeyDataFromCache(
DPRINT1("Kcb cache incoherency detected, kcb = %p\n", Kcb);
/* Get the cell node */
Node = HvGetCell(KeyHive, KeyCell);
Node = (PCM_KEY_NODE)HvGetCell(KeyHive, KeyCell);
if (Node == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
@ -2468,7 +2468,7 @@ CmpDeepCopyKeyInternal(IN PHHIVE SourceHive,
DestKeyCell);
/* Get the source cell node */
SrcNode = HvGetCell(SourceHive, SrcKeyCell);
SrcNode = (PCM_KEY_NODE)HvGetCell(SourceHive, SrcKeyCell);
ASSERT(SrcNode);
/* Sanity check */
@ -2487,7 +2487,7 @@ CmpDeepCopyKeyInternal(IN PHHIVE SourceHive,
}
/* Get the destination cell node */
DestNode = HvGetCell(DestinationHive, NewKeyCell);
DestNode = (PCM_KEY_NODE)HvGetCell(DestinationHive, NewKeyCell);
ASSERT(DestNode);
/* Set the parent and copy the flags */

View file

@ -961,8 +961,7 @@ CmpConstructName(IN PCM_KEY_CONTROL_BLOCK Kcb)
if the key is not deleted */
if (!DeletedKey && !MyKcb->Delete)
{
KeyNode = HvGetCell(MyKcb->KeyHive, MyKcb->KeyCell);
KeyNode = (PCM_KEY_NODE)HvGetCell(MyKcb->KeyHive, MyKcb->KeyCell);
if (!KeyNode)
{
/* Failure */

View file

@ -845,7 +845,7 @@ CmpCreateLinkNode(IN PHHIVE Hive,
HvMarkCellDirty(Context->ChildHive.KeyHive, ChildCell, FALSE);
/* Get the key node */
KeyNode = HvGetCell(Context->ChildHive.KeyHive, ChildCell);
KeyNode = (PCM_KEY_NODE)HvGetCell(Context->ChildHive.KeyHive, ChildCell);
if (!KeyNode)
{
/* Fail */
@ -862,7 +862,7 @@ CmpCreateLinkNode(IN PHHIVE Hive,
KeyNode->Flags |= KEY_HIVE_ENTRY | KEY_NO_DELETE;
/* Get the link node */
KeyNode = HvGetCell(Hive, LinkCell);
KeyNode = (PCM_KEY_NODE)HvGetCell(Hive, LinkCell);
if (!KeyNode)
{
/* Fail */
@ -895,7 +895,7 @@ CmpCreateLinkNode(IN PHHIVE Hive,
HvReleaseCell(Hive, LinkCell);
/* Get the parent node */
KeyNode = HvGetCell(Hive, Cell);
KeyNode = (PCM_KEY_NODE)HvGetCell(Hive, Cell);
if (!KeyNode)
{
/* Fail */
@ -1183,7 +1183,7 @@ CmpParseKey(IN PVOID ParseObject,
/* Get the new node */
Cell = NextCell;
Node = (PCM_KEY_NODE)HvGetCell(Hive, Cell);
if (!Node) ASSERT(FALSE);
ASSERT(Node);
/* Check if this was the last key */
if (Last)

View file

@ -87,7 +87,7 @@ CmpPrepareIndexOfKeys(
{
for (i = 0; i < IndexCell->Count; i++)
{
PCM_KEY_INDEX SubIndexCell = HvGetCell(RegistryHive, IndexCell->List[i]);
PCM_KEY_INDEX SubIndexCell = (PCM_KEY_INDEX)HvGetCell(RegistryHive, IndexCell->List[i]);
if (SubIndexCell->Signature == CM_KEY_NODE_SIGNATURE)
CmpPrepareKey(RegistryHive, (PCM_KEY_NODE)SubIndexCell);
else
@ -100,7 +100,7 @@ CmpPrepareIndexOfKeys(
PCM_KEY_FAST_INDEX HashCell = (PCM_KEY_FAST_INDEX)IndexCell;
for (i = 0; i < HashCell->Count; i++)
{
PCM_KEY_NODE SubKeyCell = HvGetCell(RegistryHive, HashCell->List[i].Cell);
PCM_KEY_NODE SubKeyCell = (PCM_KEY_NODE)HvGetCell(RegistryHive, HashCell->List[i].Cell);
CmpPrepareKey(RegistryHive, SubKeyCell);
}
}
@ -126,7 +126,7 @@ CmpPrepareKey(
/* Enumerate and add subkeys */
if (KeyCell->SubKeyCounts[Stable] > 0)
{
IndexCell = HvGetCell(RegistryHive, KeyCell->SubKeyLists[Stable]);
IndexCell = (PCM_KEY_INDEX)HvGetCell(RegistryHive, KeyCell->SubKeyLists[Stable]);
CmpPrepareIndexOfKeys(RegistryHive, IndexCell);
}
}
@ -137,6 +137,6 @@ CmPrepareHive(
{
PCM_KEY_NODE RootCell;
RootCell = HvGetCell(RegistryHive, RegistryHive->BaseBlock->RootCell);
RootCell = (PCM_KEY_NODE)HvGetCell(RegistryHive, RegistryHive->BaseBlock->RootCell);
CmpPrepareKey(RegistryHive, RootCell);
}

View file

@ -26,7 +26,7 @@ CmpMarkKeyDirty(IN PHHIVE Hive,
ULONG i;
/* Get the cell data for our target */
CellData = HvGetCell(Hive, Cell);
CellData = (PCM_KEY_NODE)HvGetCell(Hive, Cell);
if (!CellData) return FALSE;
/* Check if sanity checks requested */
@ -63,8 +63,8 @@ CmpMarkKeyDirty(IN PHHIVE Hive,
HvMarkCellDirty(Hive, CellData->Security, FALSE);
/* Get the security data and release it */
SecurityData = HvGetCell(Hive, CellData->Security);
if (!SecurityData) ASSERT(FALSE);
SecurityData = (PCM_KEY_SECURITY)HvGetCell(Hive, CellData->Security);
ASSERT(SecurityData);
HvReleaseCell(Hive, CellData->Security);
/* Mark the security links dirty too */
@ -81,7 +81,7 @@ CmpMarkKeyDirty(IN PHHIVE Hive,
/* Get the list data itself, and release it */
ListData = HvGetCell(Hive, CellData->ValueList.List);
if (!ListData) ASSERT(FALSE);
ASSERT(ListData);
HvReleaseCell(Hive, CellData->ValueList.List);
/* Loop all values */
@ -127,8 +127,8 @@ CmpFreeKeyBody(IN PHHIVE Hive,
PCM_KEY_NODE CellData;
/* Get the key node */
CellData = HvGetCell(Hive, Cell);
if (!CellData) ASSERT(FALSE);
CellData = (PCM_KEY_NODE)HvGetCell(Hive, Cell);
ASSERT(CellData);
/* Check if we can delete the child cells */
if (!(CellData->Flags & KEY_HIVE_EXIT))
@ -169,8 +169,8 @@ CmpFreeKeyByCell(IN PHHIVE Hive,
CmpMarkKeyDirty(Hive, Cell, TRUE);
/* Get the target node and release it */
CellData = HvGetCell(Hive, Cell);
if (!CellData) ASSERT(FALSE);
CellData = (PCM_KEY_NODE)HvGetCell(Hive, Cell);
ASSERT(CellData);
HvReleaseCell(Hive, Cell);
/* Make sure we don't have subkeys */
@ -184,8 +184,8 @@ CmpFreeKeyByCell(IN PHHIVE Hive,
if (!Result) return STATUS_INSUFFICIENT_RESOURCES;
/* Get the parent node and release it */
ParentData = HvGetCell(Hive, CellData->Parent);
if (!ParentData) ASSERT(FALSE);
ParentData = (PCM_KEY_NODE)HvGetCell(Hive, CellData->Parent);
ASSERT(ParentData);
HvReleaseCell(Hive, CellData->Parent);
/* Check if the parent node has no more subkeys */
@ -206,14 +206,15 @@ CmpFreeKeyByCell(IN PHHIVE Hive,
{
/* Get the value list and release it */
ListData = HvGetCell(Hive, CellData->ValueList.List);
if (!ListData) ASSERT(FALSE);
ASSERT(ListData);
HvReleaseCell(Hive, CellData->ValueList.List);
/* Loop every value */
for (i = 0; i < CellData->ValueList.Count; i++)
{
/* Free it */
if (!CmpFreeValue(Hive, ListData->u.KeyList[i])) ASSERT(FALSE);
Result = CmpFreeValue(Hive, ListData->u.KeyList[i]);
ASSERT(Result);
}
/* Free the value list */

View file

@ -25,17 +25,17 @@ CmpRemoveSecurityCellList(IN PHHIVE Hive,
// ASSERT( (((PCMHIVE)Hive)->HiveSecurityLockOwner == KeGetCurrentThread()) || (CmpTestRegistryLockExclusive() == TRUE) );
SecurityData = HvGetCell(Hive, SecurityCell);
SecurityData = (PCM_KEY_SECURITY)HvGetCell(Hive, SecurityCell);
if (!SecurityData) return;
FlinkCell = HvGetCell(Hive, SecurityData->Flink);
FlinkCell = (PCM_KEY_SECURITY)HvGetCell(Hive, SecurityData->Flink);
if (!FlinkCell)
{
HvReleaseCell(Hive, SecurityCell);
return;
}
BlinkCell = HvGetCell(Hive, SecurityData->Blink);
BlinkCell = (PCM_KEY_SECURITY)HvGetCell(Hive, SecurityData->Blink);
if (!BlinkCell)
{
HvReleaseCell(Hive, SecurityData->Flink);
@ -72,7 +72,7 @@ CmpFreeSecurityDescriptor(IN PHHIVE Hive,
// ASSERT( (((PCMHIVE)Hive)->HiveSecurityLockOwner == KeGetCurrentThread()) || (CmpTestRegistryLockExclusive() == TRUE) );
CellData = HvGetCell(Hive, Cell);
CellData = (PCM_KEY_NODE)HvGetCell(Hive, Cell);
if (!CellData) return;
ASSERT(CellData->Signature == CM_KEY_NODE_SIGNATURE);
@ -89,7 +89,7 @@ CmpFreeSecurityDescriptor(IN PHHIVE Hive,
return;
}
SecurityData = HvGetCell(Hive, CellData->Security);
SecurityData = (PCM_KEY_SECURITY)HvGetCell(Hive, CellData->Security);
if (!SecurityData)
{
HvReleaseCell(Hive, Cell);

View file

@ -733,7 +733,7 @@ RegSetValueExW(
else
{
/* The value already exists, use it. Get the value cell. */
ValueCell = HvGetCell(&Key->RegistryHive->Hive, CellIndex);
ValueCell = (PCM_KEY_VALUE)HvGetCell(&Key->RegistryHive->Hive, CellIndex);
ASSERT(ValueCell != NULL);
Status = STATUS_SUCCESS;
}
@ -887,7 +887,7 @@ RegQueryValueExW(
return ERROR_FILE_NOT_FOUND; // STATUS_OBJECT_NAME_NOT_FOUND;
/* Get the value cell */
ValueCell = HvGetCell(Hive, CellIndex);
ValueCell = (PCM_KEY_VALUE)HvGetCell(Hive, CellIndex);
ASSERT(ValueCell != NULL);
RepGetValueData(Hive, ValueCell, lpType, lpData, lpcbData);