CmpCommitSetSecurityUoW

INT64 __stdcall CmpCommitSetSecurityUoW(_CM_KCB_UOW *UoW, _LARGE_INTEGER *CommitTime){
  __int64 v3; 
  __int64 v4; 
  _CM_KEY_CONTROL_BLOCK *KeyControlBlock; 
  unsigned int KeyCell; 
  UINT64 KeyHive; 
  INT64 v8; 
  ULONG_PTR v9; 
  __int64 v10; 
  unsigned int v11; 
  int v12; 
  int v13; 
  _LARGE_INTEGER v14; 
  int v16[2]; 
  int v17[4]; 
  unsigned int CellIndex; 
  unsigned int v20; 
  int v21; 
  int v22; 

  v16[1] = 0;
  v17[1] = 0;
  v22 = 0;
  v3 = 0i64;
  v16[0] = -1;
  v4 = 0i64;
  KeyControlBlock = UoW->KeyControlBlock;
  v17[0] = -1;
  v21 = -1;
  KeyCell = KeyControlBlock->KeyHash.KeyCell;
  KeyHive = (UINT64)KeyControlBlock->KeyHash.KeyHive;
  v20 = KeyCell;
  v8 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, KeyCell, v16);
  if( !v8 )
    return(unsigned int)-1073741670;
  if( !HvMarkCellDirty((PVOID)KeyHive, (PVOID)KeyCell, 1u) )
  {
LABEL_21:
    v12 = -1073741443;
    goto LABEL_12;
  }
  v3 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, UoW->TxSecurityCell, v17);
  if( v3 )
  {
    v9 = *(_DWORD *)(v8 + 44);
    v10 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, v9, &v21);
    v4 = v10;
    if( v10 )
    {
      v11 = *(_DWORD *)(v10 + 8);
      CellIndex = *(_DWORD *)(v10 + 4);
      if( HvMarkCellDirty((PVOID)KeyHive, (PVOID)v9, 1u)
        && HvMarkCellDirty((PVOID)KeyHive, (PVOID)v11, 1u)
        && HvMarkCellDirty((PVOID)KeyHive, (PVOID)CellIndex, 1u) )
      {
        v12 = CmpAssignSecurityDescriptor(KeyHive, v20, v8, (VOID *)(v3 + 20), 1);
        if( v12 < 0 )
        {
          *(_DWORD *)(v8 + 44) = v9;
        }
        else
        {
          v13 = *(_DWORD *)(v4 + 12);
          if( v13 == 1 )
          {
            (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, &v21);
            v4 = 0i64;
            CmpRemoveSecurityCellList((_HHIVE *)KeyHive, v9);
            HvFreeCell(KeyHive, v9);
          }
          else
          {
            *(_DWORD *)(v4 + 12) = v13 - 1;
          }
          v14 = *CommitTime;
          *(_LARGE_INTEGER *)(v8 + 4) = *CommitTime;
          UoW->KeyControlBlock->KcbLastWriteTime = v14;
          CmpAssignSecurityToKcb((UINT64)UoW->KeyControlBlock, *(unsigned int *)(v8 + 44), 0i64, 0, 0);
          ++UoW->KeyControlBlock->SequenceNumber;
        }
        goto LABEL_12;
      }
      goto LABEL_21;
    }
  }
  v12 = -1073741670;
LABEL_12:
  (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v16);
  if( v3 )
    (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v17);
  if( v4 )
    (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, &v21);
  return(unsigned int)v12;
}

Referenced by:

CmpTransMgrCommitUoW