WdipSemUpdateInflightScenarioTable

__int64 __fastcall WdipSemUpdateInflightScenarioTable(_QWORD *a1, __int16 a2, _DWORD *a3, __int64 a4){
  unsigned int v4; 
  __int64 InflightScenarioTable; 
  _QWORD *v10; 
  _QWORD *v11; 
  __int128 v12; 

  v4 = 0;
  if( a1 && a3 && a4 )
  {
    InflightScenarioTable = WdipSemQueryInflightScenarioTable(a1, a2, a3);
    v10 = (_QWORD *)InflightScenarioTable;
    if( InflightScenarioTable )
    {
      ++*(_DWORD *)(InflightScenarioTable + 20);
    }
    else
    {
      if( a3[250] >= 0x7Du )
        return(unsigned int)-1073741823;
      v11 = WdipSemFastAllocate(WDI_SEM_ALLOC_INFLIGHT_INFO, 0x18ui64);
      v10 = v11;
      if( !v11 )
        return(unsigned int)-1073741670;
      *(_OWORD *)v11 = 0i64;
      v11[2] = 0i64;
      v12 = *(_OWORD *)a1;
      *((_WORD *)v11 + 8) = a2;
      *((_DWORD *)v11 + 5) = 1;
      *(_OWORD *)v11 = v12;
      *(_QWORD *)&a3[2 * a3[250]++] = v11;
    }
    if( !*(_QWORD *)a4 || *((_DWORD *)v10 + 5) > *(_DWORD *)(*(_QWORD *)a4 + 20i64) )
      *(_QWORD *)a4 = v10;
  }
  else
  {
    return(unsigned int)-1073741811;
  }
  return v4;
}

Referenced by:

WdipSemLogInflightLimitExceededInformation