CmpLightWeightPrepareDeleteValueKeyUoW

NTSTATUS __stdcall CmpLightWeightPrepareDeleteValueKeyUoW(_CM_KCB_UOW *UoW){
  CM_UOW_SET_VALUE_LIST_DATA *SetValueData; 
  _CM_KEY_CONTROL_BLOCK *KeyControlBlock; 
  __int64 KeyHive; 
  NTSTATUS v5; 
  _CM_UOW_SET_VALUE_KEY_DATA *TransientPoolWithTag; 
  _CM_UOW_SET_VALUE_KEY_DATA *v7; 
  _CM_KEY_VALUE *v8; 
  VOID **PoolWithTag; 
  VOID **v10; 
  unsigned int v11; 
  __int64 v12; 
  CM_UOW_SET_VALUE_LIST_DATA *Data; 
  _UNICODE_STRING ValueName[2]; 
  PVOID CellIndex; 
  unsigned int v17; 
  int v18; 
  int v19; 
  int v20; 
  int v21; 

  SetValueData = UoW->SetValueData;
  v17 = 0;
  LODWORD(CellIndex) = 0;
  v21 = 0;
  v19 = 0;
  KeyControlBlock = UoW->KeyControlBlock;
  v20 = -1;
  v18 = -1;
  Data = SetValueData;
  KeyHive = (__int64)KeyControlBlock->KeyHash.KeyHive;
  ValueName[0] = 0i64;
  if( !SetValueData )
  {
    v5 = CmpLightWeightCreateSetValueData(UoW, &Data);
    if( v5 < 0 )
      return v5;
    SetValueData = Data;
    CmpLightWeightUpdateSharedSetValueData(Data, UoW->KeyControlBlock);
    --SetValueData->RefCount;
  }
  TransientPoolWithTag = (_CM_UOW_SET_VALUE_KEY_DATA *)CmpAllocateTransientPoolWithTag(1ui64, 0x10ui64);
  v7 = TransientPoolWithTag;
  if( !TransientPoolWithTag )
    return -1073741670;
  *(_QWORD *)&TransientPoolWithTag->NameLength = 0i64;
  TransientPoolWithTag->PreparedCell = -1;
  TransientPoolWithTag->OldValueCell = -1;
  v8 = (_CM_KEY_VALUE *)(*(__int64(__fastcall **)(__int64, _QWORD, int *))(KeyHive + 8))(
                          KeyHive,
                          UoW->VolatileKeyCell,
                          &v20);
  if( v8 )
  {
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x8000ui64, 1649626435i64);
    v10 = PoolWithTag;
    if( PoolWithTag
      && (CmpInitializeValueNameString(v8, ValueName, (_WCHAR *)PoolWithTag),
          CmpFindNameInList(KeyHive, (unsigned int *)&SetValueData->ValueList, (__int64)ValueName, 0, &v17, &CellIndex)) )
    {
      v11 = (unsigned int)CellIndex;
      v12 = (*(__int64(__fastcall **)(__int64, _QWORD, int *))(KeyHive + 8))(KeyHive, (unsigned int)CellIndex, &v18);
      if( CmpMarkValueDataDirty((PVOID)KeyHive, v12) && HvMarkCellDirty((PVOID)KeyHive, (PVOID)v11, 0) )
      {
        v5 = CmpRemoveValueFromList((PVOID)KeyHive, v17, (unsigned int *)&SetValueData->ValueList);
        if( v5 >= 0 )
        {
          v7->OldValueCell = v11;
          v5 = 0;
          UoW->ValueData = v7;
          v7 = 0i64;
        }
      }
      else
      {
        v5 = -1073741443;
      }
      if( v12 )
        (*(void(__fastcall **)(__int64, int *))(KeyHive + 16))(KeyHive, &v18);
    }
    else
    {
      v5 = -1073741670;
    }
    (*(void(__fastcall **)(__int64, int *))(KeyHive + 16))(KeyHive, &v20);
    if( v10 )
      ExFreePoolWithTag(v10, 0);
  }
  else
  {
    v5 = -1073741670;
  }
  if( v7 )
    CmpFreeTransientPoolWithTag(v7, 0x77554D43ui64);
  return v5;
}

Referenced by:

CmpProcessLightWeightUOW