PpmIdleInitializeConcurrency

NTSTATUS __stdcall PpmIdleInitializeConcurrency(
        _KAFFINITY_EX *Affinity,
        PPM_CONCURRENCY_ACCOUNTING **AllocatedConcurrency){
  PPM_CONCURRENCY_ACCOUNTING **v2; 
  PPM_CONCURRENCY_ACCOUNTING **v3; 
  UINT8 v5; 
  NTSTATUS v6; 
  UINT16 v7; 
  UINT64 *v8; 
  NTSTATUS v9; 
  PPM_CONCURRENCY_ACCOUNTING *PoolWithTag; 
  unsigned __int64 v12; 
  _GROUP_AFFINITY Base; 
  _GROUP_AFFINITY PreviousAffinity; 

  Base = 0i64;
  v3 = v2;
  PreviousAffinity = 0i64;
  v5 = (unsigned __int8)Affinity;
  v6 = KeCountSetBitsAffinityEx(&Affinity->Count);
  v9 = (unsigned int)KeFirstGroupAffinityEx(&Base, v5, v7, v8);
  if( v3 && (PoolWithTag = *v3) != 0i64 && v6 == PoolWithTag->Processors )
  {
    *v3 = 0i64;
  }
  else
  {
    KeSetSystemGroupAffinityThread(&Base, &PreviousAffinity);
    PoolWithTag = (PPM_CONCURRENCY_ACCOUNTING *)ExAllocatePoolWithTag(
                                                  0x200ui64,
                                                  (unsigned int)(8 * v6 + 40),
                                                  1884115024i64);
    KeRevertToUserGroupAffinityThread(&PreviousAffinity);
    if( PoolWithTag )
    {
      memset(PoolWithTag, 0i64, 8 * v6 + 40);
      PoolWithTag->Lock = 0i64;
      PoolWithTag->Processors = v6;
      LODWORD(v12) = PpmQueryTime();
      PoolWithTag->LastUpdateTime = v12;
    }
    else
    {
      v9 = -1073741670;
    }
  }
  *AllocatedConcurrency = PoolWithTag;
  return v9;
}

Referenced by:

PpmParkRegisterParking