PpmPerfApplyProcessorStates

INT64 __fastcall PpmPerfApplyProcessorStates(INT64 a1){
  char v1; 
  INT64 i; 
  __int64 v3; 
  __int64 v4; 
  __int64 v5; 
  INT64 result; 
  INT64 v7; 
  INT64 v8; 
  INT64 v9; 
  unsigned int v10; 
  INT64 v11; 
  UINT64 ProcessorNumber; 
  _KAFFINITY_EX *p_Affinity; 
  unsigned __int64 v14; 
  __int16 v15; 
  int v16; 
  __int16 v17; 
  _KAFFINITY_EX Affinity; 
  v1 = 0;
  *(_QWORD *)&Affinity.Count = 1310721i64;
  v16 = 0;
  v17 = 0;
  LODWORD(ProcessorNumber) = 0;
  Affinity.Bitmap[0] = 0i64;
  memset((INT64)&Affinity.Bitmap[1], 0i64);
  for( i = PpmPerfDomainHead; (INT64 *)i != &PpmPerfDomainHead; i = *(_QWORD *)i )
  {
    if( *(_BYTE *)(i + 766) )
    {
      KeOrAffinityEx((_KAFFINITY_EX *)(i + 24), &Affinity, &Affinity);
      LODWORD(ProcessorNumber) = 0;
      if( *(_DWORD *)(i + 200) )
      {
        v10 = 0;
        do
        {
          v11 = *(_QWORD *)(i + 216) + 136i64 * v10;
          if( *(_DWORD *)(v11 + 16) )
          {
            if( *(_BYTE *)(v11 + 124) )
            {
              LOBYTE(v8) = 1;
              PpmPerfApplyHiddenProcessorState(i, *(_QWORD *)(i + 216) + 136i64 * v10, v8, v9);
              *(_BYTE *)(v11 + 124) = 0;
            }
            PpmPerfApplyHiddenProcessorState(i, v11, 0i64, v9);
          }
          ++v10;
        }
        while( v10 < *(_DWORD *)(i + 200) );
        LODWORD(ProcessorNumber) = v10;
      }
      *(_BYTE *)(i + 766) = 0;
    }
  }
  v14 = Affinity.Bitmap[0];
  p_Affinity = &Affinity;
  v15 = 0;
  while( !(unsigned int)KeEnumerateNextProcessor(&ProcessorNumber, (unsigned __int16 **)&p_Affinity) )
  {
    KeGetPrcb((unsigned int)ProcessorNumber);
    v4 = v3;
    v5 = *(_QWORD *)(v3 + 33136);
    if( *(_BYTE *)(v5 + 124) )
    {
      if( PpmPerfApplyProcessorState(v3, 1) )
      {
        *(_BYTE *)(v5 + 124) = 0;
        goto LABEL_8;
      }
    }
    else
    {
LABEL_8:
      if( PpmPerfApplyProcessorState(v4, 0) )
        KeRemoveProcessorAffinityEx(&Affinity.Count, ProcessorNumber);
    }
  }
  result = KeCountSetBitsAffinityEx(&Affinity);
  PpmCheckCount = result;
  if( (_DWORD)result )
  {
    v14 = Affinity.Bitmap[0];
    p_Affinity = &Affinity;
    v15 = 0;
    while( 1 )
    {
      result = KeEnumerateNextProcessor(&ProcessorNumber, (unsigned __int16 **)&p_Affinity);
      if( (_DWORD)result )
        break;
      KeGetPrcb((unsigned int)ProcessorNumber);
      PpmPerfQueueAction(v7, 2);
    }
  }
  else
  {
    v1 = 1;
  }
  LOBYTE(result) = v1;
  return result;
}

Referenced by:

No references.