CmpLightWeightPrepareSetSecDescUoW

NTSTATUS __stdcall CmpLightWeightPrepareSetSecDescUoW(_CM_KCB_UOW *UoW){
  __int64 v2; 
  _CM_KEY_CONTROL_BLOCK *KeyControlBlock; 
  __int64 v4; 
  unsigned int KeyCell; 
  UINT64 KeyHive; 
  _DWORD *PoolWithTag; 
  void *SecurityCell; 
  int SecurityDescriptorNode; 
  _CM_KEY_NODE *v10; 
  unsigned int Security; 
  __int64 v12; 
  int v14[2]; 
  int v15[4]; 
  unsigned int v16; 
  unsigned int v17; 
  unsigned int Cell; 
  int v19; 
  int v20; 
  v20 = 0;
  v14[1] = 0;
  v2 = 0i64;
  v15[1] = 0;
  KeyControlBlock = UoW->KeyControlBlock;
  v4 = 0i64;
  v19 = -1;
  v14[0] = -1;
  v15[0] = -1;
  KeyCell = KeyControlBlock->KeyHash.KeyCell;
  KeyHive = (UINT64)KeyControlBlock->KeyHash.KeyHive;
  Cell = KeyCell;
  PoolWithTag = ExAllocatePoolWithTag(PagedPool, 4ui64, 0x77554D43ui64);
  SecurityCell = PoolWithTag;
  if( !PoolWithTag )
    return -1073741670;
  *PoolWithTag = 0;
  v10 = (_CM_KEY_NODE *)(*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, KeyCell, &v19);
  if( !v10 )
    goto LABEL_4;
  if( !HvMarkCellDirty(KeyHive, KeyCell, 1) )
    goto LABEL_13;
  v2 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, UoW->TxSecurityCell, v14);
  if( !v2
    || (Security = v10->Security,
        v12 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, Security, v15),
        (v4 = v12) == 0) )
  {
LABEL_4:
    SecurityDescriptorNode = -1073741670;
LABEL_14:
    CmpFreeUnitOfWork(SecurityCell);
    goto LABEL_15;
  }
  v16 = *(_DWORD *)(v12 + 8);
  v17 = *(_DWORD *)(v12 + 4);
  if( !HvMarkCellDirty(KeyHive, Security, 1) || !HvMarkCellDirty(KeyHive, v16, 1) || !HvMarkCellDirty(KeyHive, v17, 1) )
  {
LABEL_13:
    SecurityDescriptorNode = -1073741443;
    goto LABEL_14;
  }
  SecurityDescriptorNode = CmpGetSecurityDescriptorNode(
                             (_HHIVE *)KeyHive,
                             Cell,
                             v10,
                             (PVOID)(v2 + 20),
                             1u,
                             (UINT64 *)SecurityCell);
  if( SecurityDescriptorNode < 0 )
    goto LABEL_14;
  UoW->PrepareDataPointer = SecurityCell;
  SecurityDescriptorNode = 0;
LABEL_15:
  if( v10 )
    (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, &v19);
  if( v2 )
    (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v14);
  if( v4 )
    (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v15);
  return SecurityDescriptorNode;
}

Referenced by:

CmpProcessLightWeightUOW