IopIrpStackProfilerDpcRoutine

VOID __stdcall IopIrpStackProfilerDpcRoutine(
        _KDPC *Dpc,
        VOID *DeferredContext,
        VOID *SystemArgument1,
        VOID *SystemArgument2,
        INT64 a5){
  unsigned __int64 v9; 
  unsigned int i; 
  _KPRCB *Prcb; 
  __int64 v12; 
  _IOP_IRP_STACK_PROFILER *p_IoIrpStackProfilerCurrent; 
  UINT64 v14; 
  __int64 j; 
  unsigned int k; 
  _KPRCB *v17; 
  _DWORD v18[84]; 
  _DWORD *v19; 
  __int64 StackSizes[20]; 

  v19 = v18;
  memset(&v18[40], 0i64, 0x5Bu);
  if( (__int64)DeferredContext >> 47 != -1 && (__int64)DeferredContext >> 47 != 0 )
  {
    v18[12] = 0;
    Dpc->Type = 0;
    Dpc->DeferredContext = (void *)((unsigned __int64)SystemArgument2 >> 8);
    *(_QWORD *)((char *)&v18[60] + 3) = SystemArgument1;
    *(_QWORD *)((char *)&v18[44] + 3) = __ROL8__(DeferredContext, (char)SystemArgument1);
    *(_QWORD *)((char *)&v18[54] + 3) = __ROR8__(Dpc, (char)SystemArgument1);
    Dpc->SystemArgument1 = (void *)((unsigned __int64)Dpc->SystemArgument1 ^ (unsigned __int64)SystemArgument2);
    Dpc->SystemArgument2 = (void *)((unsigned __int64)Dpc->SystemArgument2 ^ (unsigned __int64)SystemArgument1);
    KiCustomAccessRoutine2((UINT64 *)DeferredContext);
  }
  memset(StackSizes, 0i64, sizeof(StackSizes));
  v9 = 0i64;
  for( i = 0; i < (unsigned int)KeNumberProcessors_0; ++i )
  {
    Prcb = KeGetPrcb(i);
    if( Prcb )
    {
      v9 += Prcb->IoIrpStackProfilerCurrent.TotalIrps - Prcb->IoIrpStackProfilerPrevious.TotalIrps;
      v12 = 0i64;
      p_IoIrpStackProfilerCurrent = &Prcb->IoIrpStackProfilerCurrent;
      do
      {
        StackSizes[v12++] += p_IoIrpStackProfilerCurrent->Profile[0] - p_IoIrpStackProfilerCurrent[1].Profile[0];
        p_IoIrpStackProfilerCurrent = (_IOP_IRP_STACK_PROFILER *)((char *)p_IoIrpStackProfilerCurrent + 4);
      }
      while( v12 < 20 );
    }
  }
  v14 = 20i64;
  if( v9 > *(&stru_140C452E0 + 433) )
  {
    v14 = 0i64;
    for( j = 0i64; j < 20; ++j )
    {
      if( StackSizes[j] > (unsigned __int64)*(&stru_140C452E0 + 432) )
        break;
      v14 = (unsigned int)(v14 + 1);
    }
  }
  if( (_DWORD)v14 != 20 )
  {
    IopProcessIrpStackProfiler((UINT64 *)StackSizes, v14);
    *(&stru_140C452E0 + 432) *= 2;
    if( *(&stru_140C452E0 + 432) > 0x1900u )
      *(&stru_140C452E0 + 432) = 6400;
    *(&stru_140C452E0 + 433) *= 2;
    if( *(&stru_140C452E0 + 433) > 0x7D00u )
      *(&stru_140C452E0 + 433) = 32000;
    for( k = 0; k < (unsigned int)KeNumberProcessors_0; ++k )
    {
      v17 = KeGetPrcb(k);
      if( v17 )
      {
        *(_OWORD *)v17->IoIrpStackProfilerPrevious.Profile = *(_OWORD *)v17->IoIrpStackProfilerCurrent.Profile;
        *(_OWORD *)&v17->IoIrpStackProfilerPrevious.Profile[4] = *(_OWORD *)&v17->IoIrpStackProfilerCurrent.Profile[4];
        *(_OWORD *)&v17->IoIrpStackProfilerPrevious.Profile[8] = *(_OWORD *)&v17->IoIrpStackProfilerCurrent.Profile[8];
        *(_OWORD *)&v17->IoIrpStackProfilerPrevious.Profile[12] = *(_OWORD *)&v17->IoIrpStackProfilerCurrent.Profile[12];
        *(_OWORD *)&v17->IoIrpStackProfilerPrevious.Profile[16] = *(_OWORD *)&v17->IoIrpStackProfilerCurrent.Profile[16];
        v17->IoIrpStackProfilerPrevious.TotalIrps = v17->IoIrpStackProfilerCurrent.TotalIrps;
      }
    }
  }
  _InterlockedOr((_DWORD *)&stru_140C452E0 + 286, 4u);
}

Referenced by:

No references.