CmpUnlockTwoKcbs

void __fastcall CmpUnlockTwoKcbs(_CM_KEY_CONTROL_BLOCK *Kcb1, _CM_KEY_CONTROL_BLOCK *Kcb2){
  bool v3; 
  PVOID BugCheckParameter2; 
  _CM_KEY_CONTROL_BLOCK *ProperFirstKcb; 

  ProperFirstKcb = 0i64;
  BugCheckParameter2 = 0i64;
  if( Kcb1 )
  {
    if( Kcb2 && Kcb1 != Kcb2 )
    {
      CmpGetCorrectKcbLockOrder(Kcb1, Kcb2, &ProperFirstKcb, (_CM_KEY_CONTROL_BLOCK **)&BugCheckParameter2);
      CmpUnlockKcb((_CM_KEY_CONTROL_BLOCK *)BugCheckParameter2);
      Kcb1 = ProperFirstKcb;
    }
    CmpUnlockKcb(Kcb1);
  }
  else if( Kcb2 )
  {
    v3 = (Kcb2->_bf_8 & 0x80000) != 0;
    if( (struct _KTHREAD *)Kcb2->Owner == KeGetCurrentThread() )
      Kcb2->Owner = 0i64;
    else
      _InterlockedDecrement((volatile signed __int32 *)&Kcb2->56);
    ExReleasePushLockEx((_DWORD)Kcb2 + 48, 0);
    if( v3 && (Kcb2->_bf_8 & 0x80000) != 0 )
      CmpFreeKeyControlBlock((UINT64)Kcb2);
  }
}

Referenced by:

CmEnumerateKey
CmEnumerateValueKeyFromMergedView
CmQueryKey
CmQueryMultipleValueKey
CmSaveMergedKeys
CmpFindSubkeyInHashByChildCell
NtNotifyChangeMultipleKeys