[NTOS]: Employ the simple CMP_ASSERT_KCB_LOCK() macro to perform these asserts.

svn path=/trunk/; revision=75070
This commit is contained in:
Hermès Bélusca-Maïto 2017-06-17 01:22:17 +00:00
parent 0c258ecde0
commit d56490d24a

View file

@ -305,9 +305,8 @@ VOID
NTAPI NTAPI
CmpRemoveKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb) CmpRemoveKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
{ {
/* Make sure that the registry and KCB are utterly locked */ /* Make sure we have the exclusive lock */
ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) || CMP_ASSERT_KCB_LOCK(Kcb);
(CmpTestRegistryLockExclusive() == TRUE));
/* Remove the key hash */ /* Remove the key hash */
CmpRemoveKeyHash(&Kcb->KeyHash); CmpRemoveKeyHash(&Kcb->KeyHash);
@ -434,9 +433,8 @@ CmpCleanUpKcbValueCache(IN PCM_KEY_CONTROL_BLOCK Kcb)
PULONG_PTR CachedList; PULONG_PTR CachedList;
ULONG i; ULONG i;
/* Sanity check */ /* Make sure we have the exclusive lock */
ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) || CMP_ASSERT_KCB_LOCK(Kcb);
(CmpTestRegistryLockExclusive() == TRUE));
/* Check if the value list is cached */ /* Check if the value list is cached */
if (CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList)) if (CMP_IS_CELL_CACHED(Kcb->ValueCache.ValueList))
@ -482,8 +480,7 @@ CmpCleanUpKcbCacheWithLock(IN PCM_KEY_CONTROL_BLOCK Kcb,
PAGED_CODE(); PAGED_CODE();
/* Sanity checks */ /* Sanity checks */
ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) || CMP_ASSERT_KCB_LOCK(Kcb);
(CmpTestRegistryLockExclusive() == TRUE));
ASSERT(Kcb->RefCount == 0); ASSERT(Kcb->RefCount == 0);
/* Cleanup the value cache */ /* Cleanup the value cache */
@ -521,9 +518,8 @@ CmpCleanUpSubKeyInfo(IN PCM_KEY_CONTROL_BLOCK Kcb)
{ {
PCM_KEY_NODE KeyNode; PCM_KEY_NODE KeyNode;
/* Sanity check */ /* Make sure we have the exclusive lock */
ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) || CMP_ASSERT_KCB_LOCK(Kcb);
(CmpTestRegistryLockExclusive() == TRUE));
/* Check if there's any cached subkey */ /* Check if there's any cached subkey */
if (Kcb->ExtFlags & (CM_KCB_NO_SUBKEY | CM_KCB_SUBKEY_ONE | CM_KCB_SUBKEY_HINT)) if (Kcb->ExtFlags & (CM_KCB_NO_SUBKEY | CM_KCB_SUBKEY_ONE | CM_KCB_SUBKEY_HINT))
@ -619,9 +615,8 @@ CmpDereferenceKeyControlBlockWithLock(IN PCM_KEY_CONTROL_BLOCK Kcb,
/* Check if this is the last reference */ /* Check if this is the last reference */
if ((InterlockedDecrement((PLONG)&Kcb->RefCount) & 0xFFFF) == 0) if ((InterlockedDecrement((PLONG)&Kcb->RefCount) & 0xFFFF) == 0)
{ {
/* Sanity check */ /* Make sure we have the exclusive lock */
ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) || CMP_ASSERT_KCB_LOCK(Kcb);
(CmpTestRegistryLockExclusive() == TRUE));
/* Check if we should do a direct delete */ /* Check if we should do a direct delete */
if (((CmpHoldLazyFlush) && if (((CmpHoldLazyFlush) &&
@ -1086,10 +1081,9 @@ EnlistKeyBodyWithKCB(IN PCM_KEY_BODY KeyBody,
} }
/* Make sure we have the exclusive lock */ /* Make sure we have the exclusive lock */
ASSERT((CmpIsKcbLockedExclusive(KeyBody->KeyControlBlock) == TRUE) || CMP_ASSERT_KCB_LOCK(KeyBody->KeyControlBlock);
(CmpTestRegistryLockExclusive() == TRUE));
/* do the insert */ /* Do the insert */
InsertTailList(&KeyBody->KeyControlBlock->KeyBodyListHead, InsertTailList(&KeyBody->KeyControlBlock->KeyBodyListHead,
&KeyBody->KeyBodyList); &KeyBody->KeyBodyList);
@ -1132,8 +1126,7 @@ DelistKeyBodyFromKCB(IN PCM_KEY_BODY KeyBody,
/* Lock the KCB */ /* Lock the KCB */
if (!LockHeld) CmpAcquireKcbLockExclusive(KeyBody->KeyControlBlock); if (!LockHeld) CmpAcquireKcbLockExclusive(KeyBody->KeyControlBlock);
ASSERT((CmpIsKcbLockedExclusive(KeyBody->KeyControlBlock) == TRUE) || CMP_ASSERT_KCB_LOCK(KeyBody->KeyControlBlock);
(CmpTestRegistryLockExclusive() == TRUE));
/* Remove the entry */ /* Remove the entry */
RemoveEntryList(&KeyBody->KeyBodyList); RemoveEntryList(&KeyBody->KeyBodyList);