PopGetPowerRequestListInfo

INT64 __stdcall PopGetPowerRequestListInfo(PVOID *ReturnList, UINT64 *ReturnListLength){
  INT64 *v4; 
  unsigned __int64 v5; 
  INT64 v6; 
  unsigned __int64 *PoolWithTag; 
  unsigned __int64 *v8; 
  int v9; 
  __int64 v10; 
  unsigned __int64 *v11; 
  INT64 v12; 
  unsigned __int64 v13; 
  unsigned __int64 v14; 
  _DWORD *v15; 
  __int64 v16; 
  INT64 v17; 
  UINT64 v18; 
  UINT64 v20; 
  PopAcquirePowerRequestPushLock(0);
  v4 = (INT64 *)PopPowerRequestObjectList;
  v5 = (8 * PopPowerRequestObjectCount + 15) & 0xFFFFFFFFFFFFFFF8ui64;
  while( v4 != &PopPowerRequestObjectList )
  {
    v6 = v4[10];
    v20 = 0i64;
    PoStoreDiagnosticContext(v6, 0i64, &v20);
    v5 = (v20 + 39 + v5) & 0xFFFFFFFFFFFFFFF8ui64;
    if( v5 > 0xFFFFFFFF )
    {
      v9 = -1073741789;
      goto LABEL_19;
    }
    v4 = (INT64 *)*v4;
  }
  PoolWithTag = (unsigned __int64 *)ExAllocatePoolWithTag(PagedPool, v5, 0x206D654Dui64);
  v8 = PoolWithTag;
  if( PoolWithTag )
  {
    memset((INT64)PoolWithTag, 0i64);
    v10 = PopPowerRequestObjectCount;
    v11 = v8 + 1;
    *v8 = PopPowerRequestObjectCount;
    v12 = PopPowerRequestObjectList;
    v13 = (8 * v10 + 15) & 0xFFFFFFFFFFFFFFF8ui64;
    v14 = v5 - v13;
    while( 1 )
    {
      if( (INT64 *)v12 == &PopPowerRequestObjectList )
      {
        *ReturnList = v8;
        v8 = 0i64;
        v9 = 0;
        *(_DWORD *)ReturnListLength = v13;
        goto LABEL_17;
      }
      if( v14 < 0x48 )
        break;
      *(_DWORD *)((char *)v8 + v13) = *(_DWORD *)(v12 + 20);
      v15 = (_DWORD *)((char *)v8 + v13 + 4);
      v16 = 6i64;
      do
      {
        *v15 = *(_DWORD *)((char *)v15 + v12 - ((_QWORD)v8 + v13) + 28);
        ++v15;
        --v16;
      }
      while( v16 );
      v17 = *(_QWORD *)(v12 + 80);
      v20 = v14 - 32;
      v9 = PoStoreDiagnosticContext(v17, (unsigned __int64 *)((char *)v8 + v13 + 32), &v20);
      if( v9 < 0 )
        goto LABEL_17;
      v18 = (v20 + 39) & 0xFFFFFFFFFFFFFFF8ui64;
      if( v14 < v18 )
        break;
      *v11 = v13;
      v14 -= v18;
      v12 = *(_QWORD *)v12;
      v13 += v18;
      ++v11;
    }
    v9 = -1073741789;
LABEL_17:
    if( v8 )
      ExFreePoolWithTag(v8, 0x206D654Du);
  }
  else
  {
    v9 = -1073741670;
  }
LABEL_19:
  PopReleaseRwLock((UINT64)&PopPowerRequestLock);
  return(unsigned int)v9;
}

Referenced by:

NtPowerInformation