[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 */ /* Get the cell data for it */
Node = HvGetCell(Hive, CellIndex); Node = (PCM_KEY_NODE)HvGetCell(Hive, CellIndex);
if (!Node) if (!Node)
{ {
Status = STATUS_REGISTRY_CORRUPT; Status = STATUS_REGISTRY_CORRUPT;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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