EmonRemoveProfileSource

INT64 __fastcall EmonRemoveProfileSource(INT64 *a1){
  unsigned int v1; 
  unsigned int v2; 
  unsigned int ActiveProcessorCount; 
  unsigned int v6; 
  int *v7; 
  unsigned int v8; 
  unsigned __int64 v9; 
  CHAR v10; 
  __int64 v11; 
  __int64 v12; 
  __int64 v13; 
  __int64 a3; 
  v1 = *(_DWORD *)a1;
  v2 = 0;
  a3 = 0i64;
  if( v1 <= 0x24 )
    return 3221225659i64;
  ActiveProcessorCount = KeQueryActiveProcessorCountEx(0xFFFFu);
  v6 = 0;
  if( ActiveProcessorCount )
  {
    v7 = KiProcessorIndexToNumberMappingTable;
    while( (((unsigned __int64)a1[((unsigned int)*v7 >> 6) + 2] >> (*(_BYTE *)v7 & 0x3F)) & 1) == 0
         || !EmonNumberCounters )
    {
LABEL_11:
      ++v6;
      ++v7;
      if( v6 >= ActiveProcessorCount )
        goto LABEL_12;
    }
    v8 = v6 * EmonNumberCounters;
    while( *(_DWORD *)(EmonCounterStatus + 16i64 * v8) == 3 || *(_DWORD *)(EmonCounterStatus + 16i64 * v8 + 4) != v1 )
    {
      if( ++v8 - v6 * EmonNumberCounters >= EmonNumberCounters )
        goto LABEL_11;
    }
    return 2147483665i64;
  }
  else
  {
LABEL_12:
    v9 = (unsigned __int8)HalpAcquireHighLevelLock(&EmonProfileSourceDescriptorListLock);
    v10 = HalpRemoveProfileSourceFromList(a1, &EmonProfileSourceDescriptorListHead, &a3);
    KxReleaseSpinLock(&EmonProfileSourceDescriptorListLock);
    __writecr8(v9);
    if( v10 )
    {
      v12 = a3;
      HalpMmAllocCtxFree(v11, *(_QWORD *)(a3 + 200));
      HalpMmAllocCtxFree(v13, v12);
      --EmonProfileSourceDescriptorCount;
    }
    else if( !a3 )
    {
      return(unsigned int)-1073741823;
    }
    return v2;
  }
}

Referenced by:

No references.