MiComputeIdealDpcGang

NTSTATUS __stdcall MiComputeIdealDpcGang(INT64 a1, UINT64 a2){
  unsigned int ClosestNodeWithProcessors; 
  unsigned int v4; 
  NTSTATUS v5; 
  unsigned int v6; 
  __int64 v7; 
  __int64 v8; 
  _GROUP_AFFINITY Affinity; 
  USHORT Count; 

  Affinity = 0i64;
  ClosestNodeWithProcessors = MiGetClosestNodeWithProcessors(a2);
  v4 = ClosestNodeWithProcessors < (unsigned __int16)KeNumberNodes ? ClosestNodeWithProcessors : 0;
  *(_DWORD *)(a1 + 192) = v4;
  KeQueryNodeActiveAffinity(v4, &Affinity, &Count);
  v5 = 0;
  v6 = 0;
  for( *(_GROUP_AFFINITY *)(a1 + 200) = Affinity; v6 < (unsigned int)KeNumberProcessors_0; ++v6 )
  {
    v7 = (__int64)*(&KiProcessorBlock + v6);
    if( *(unsigned __int8 *)(v7 + 208) == Affinity.Group )
    {
      v8 = *(_QWORD *)(v7 + 33880);
      if( (v8 & Affinity.Mask) != 0 )
      {
        ++v5;
        Affinity.Mask &= ~v8;
        if( !Affinity.Mask )
          break;
      }
    }
  }
  return v5;
}

Referenced by:

MiInitializeDpcGang