CmpLightWeightPrepareDeleteKeyUoW

INT64 __stdcall CmpLightWeightPrepareDeleteKeyUoW(PPVOID rcx0, INT64 a2){
  _CMP_DISCARD_AND_REPLACE_KCB_CONTEXT *v2; 
  UINT64 v4; 
  UINT64 *v5; 
  int ModificationData; 
  int v7; 
  unsigned __int64 v8; 
  __int64 v9; 
  _CMP_DISCARD_AND_REPLACE_KCB_CONTEXT *TransientPoolWithTag; 
  __int64 v11; 
  _LIST_ENTRY *p_ClonedKcbListHead; 
  UINT64 *v14; 
  int v15; 
  int v16; 

  v15 = -1;
  v16 = 0;
  v2 = 0i64;
  v4 = *((_QWORD *)rcx0[6] + 4);
  v5 = (UINT64 *)*((_QWORD *)rcx0[10] + 13);
  v14 = v5;
  if( v5 )
  {
    ++*(_DWORD *)v5;
LABEL_5:
    v8 = *((unsigned int *)rcx0[6] + 10);
    if( !(*(__int64(__fastcall **)(UINT64, unsigned __int64, int *))(v4 + 8))(v4, v8, &v15) )
    {
LABEL_6:
      v7 = -1073741670;
      goto LABEL_18;
    }
    (*(void(__fastcall **)(UINT64, int *))(v4 + 16))(v4, &v15);
    if( !CmpMarkKeyDirty((PVOID)v4, (PVOID)(unsigned int)v8, 0)
      || !HvMarkCellDirty((PVOID)v4, (PVOID)*(unsigned int *)(*((_QWORD *)rcx0[6] + 9) + 40i64), 0) )
    {
      v7 = -1073741443;
      goto LABEL_18;
    }
    v9 = *((_QWORD *)rcx0[6] + 24);
    if( !v9 || *(_QWORD *)(v9 + 32) == v9 + 32 )
      goto LABEL_24;
    TransientPoolWithTag = (_CMP_DISCARD_AND_REPLACE_KCB_CONTEXT *)CmpAllocateTransientPoolWithTag(1ui64, 0x20ui64);
    v2 = TransientPoolWithTag;
    if( !TransientPoolWithTag )
      goto LABEL_6;
    TransientPoolWithTag->BaseKcb = 0i64;
    v11 = (__int64)TransientPoolWithTag;
    *(&TransientPoolWithTag->PrepareStatus + 1) = 0;
    TransientPoolWithTag->ClonedKcbListHead.Blink = 0i64;
    TransientPoolWithTag->PrepareStatus = -1073741823;
    p_ClonedKcbListHead = &TransientPoolWithTag->ClonedKcbListHead;
    p_ClonedKcbListHead->Blink = p_ClonedKcbListHead;
    p_ClonedKcbListHead->Flink = p_ClonedKcbListHead;
    v7 = CmpPrepareDiscardAndReplaceKcbAndUnbackedHigherLayers(rcx0[6], v11);
    if( v7 >= 0 )
    {
LABEL_24:
      if( CmpRemoveSubKeyFromList(v4, (ULONG_PTR *)v5 + (v8 >> 31) + 3, v8) )
      {
        --*((_DWORD *)v5 + (v8 >> 31) + 1);
        v7 = 0;
        rcx0[13] = v5;
        rcx0[14] = v2;
        return(unsigned int)v7;
      }
      v7 = -1073741670;
    }
    if( v2 )
    {
      CmpCleanupDiscardReplaceContext(v2);
      CmSiFreeMemory((PPRIVILEGE_SET)v2);
    }
    goto LABEL_18;
  }
  ModificationData = CmpLightWeightCreateModificationData((_CM_KCB_UOW *)rcx0, (_CM_UOW_KEY_STATE_MODIFICATION **)&v14);
  v5 = v14;
  v7 = ModificationData;
  if( ModificationData >= 0 )
    goto LABEL_5;
LABEL_18:
  if( v5 )
    CmpLightWeightCleanupModifyKeyDataUoW(v4, v5);
  return(unsigned int)v7;
}

Referenced by:

CmpProcessLightWeightUOW