CmpCommitDeleteValueKeyUoW

NTSTATUS __stdcall CmpCommitDeleteValueKeyUoW(_CM_KCB_UOW *UoW, _LARGE_INTEGER *CommitTime){
  INT64 v2; 
  _CM_KEY_CONTROL_BLOCK *KeyControlBlock; 
  UINT64 KeyHive; 
  __int64 v6; 
  __int64 v7; 
  __int64 VolatileKeyCell; 
  unsigned int *v9; 
  __int64(__fastcall *v10)(UINT64, __int64, int *); 
  _CM_KEY_VALUE *v11; 
  VOID **PoolWithTag; 
  NTSTATUS v13; 
  _LARGE_INTEGER v14; 
  INT64 v15; 
  _CM_KEY_CONTROL_BLOCK *v16; 
  unsigned int v17; 
  int v19[2]; 
  int v20[2]; 
  PVOID P; 
  _UNICODE_STRING ValueName; 
  PVOID CellIndex; 
  _LARGE_INTEGER *v24; 
  INT64 a2; 
  unsigned int v26; 

  a2 = v2;
  v24 = CommitTime;
  v20[0] = -1;
  v19[0] = -1;
  v20[1] = 0;
  v19[1] = 0;
  KeyControlBlock = UoW->KeyControlBlock;
  v26 = 0;
  ValueName = 0i64;
  KeyHive = (UINT64)KeyControlBlock->KeyHash.KeyHive;
  v6 = (*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(KeyHive, KeyControlBlock->KeyHash.KeyCell, v20);
  v7 = v6;
  if( !v6 )
    return -1073741670;
  VolatileKeyCell = UoW->VolatileKeyCell;
  v9 = (unsigned int *)(v6 + 36);
  v10 = *(__int64(__fastcall **)(UINT64, __int64, int *))(KeyHive + 8);
  LODWORD(CellIndex) = -1;
  v11 = (_CM_KEY_VALUE *)v10(KeyHive, VolatileKeyCell, v19);
  if( v11 )
  {
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x8000ui64, 1649626435i64);
    P = PoolWithTag;
    if( PoolWithTag )
    {
      CmpInitializeValueNameString(v11, &ValueName, (_WCHAR *)PoolWithTag);
      if( CmpFindNameInList(KeyHive, v9, (__int64)&ValueName, 0, &v26, &CellIndex)
        && (_DWORD)CellIndex != -1
        && ((*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v19),
            (v11 = (_CM_KEY_VALUE *)(*(__int64(__fastcall **)(UINT64, _QWORD, int *))(KeyHive + 8))(
                                      KeyHive,
                                      (unsigned int)CellIndex,
                                      v19)) != 0i64) )
      {
        if( HvMarkCellDirty((PVOID)KeyHive, (PVOID)UoW->KeyControlBlock->KeyHash.KeyCell, 0)
          && HvMarkCellDirty((PVOID)KeyHive, (PVOID)*(unsigned int *)(v7 + 40), 0)
          && HvMarkCellDirty((PVOID)KeyHive, (PVOID)(unsigned int)CellIndex, 0)
          && CmpMarkValueDataDirty((PVOID)KeyHive, (__int64)v11) )
        {
          v13 = CmpRemoveValueFromList((PVOID)KeyHive, v26, v9);
          if( v13 >= 0 )
          {
            CmpFreeValue(KeyHive, (unsigned int)CellIndex);
            v14 = *v24;
            *(_LARGE_INTEGER *)(v7 + 4) = *v24;
            UoW->KeyControlBlock->KcbLastWriteTime = v14;
            if( !*v9 )
            {
              *(_QWORD *)(v7 + 60) = 0i64;
              UoW->KeyControlBlock->KcbMaxValueNameLen = 0;
              UoW->KeyControlBlock->KcbMaxValueDataLen = 0;
            }
            v15 = a2;
            ++UoW->KeyControlBlock->SequenceNumber;
            CmpCleanUpKcbCachedSymlink((INT64)UoW->KeyControlBlock, v15);
            v16 = UoW->KeyControlBlock;
            v17 = *(_DWORD *)(v7 + 40);
            v16->ValueList.Count = *v9;
            v16->ValueList.List = v17;
          }
        }
        else
        {
          v13 = -1073741443;
        }
      }
      else
      {
        v13 = -1073741670;
      }
      ExFreePoolWithTag(P, 0);
    }
    else
    {
      v13 = -1073741670;
    }
    if( v11 )
      (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v19);
  }
  else
  {
    v13 = -1073741670;
  }
  (*(void(__fastcall **)(UINT64, int *))(KeyHive + 16))(KeyHive, v20);
  return v13;
}

Referenced by:

CmpTransMgrCommitUoW