EtwpAllocateStringFilterData

__int64 __fastcall EtwpAllocateStringFilterData(__int64 a1, _QWORD *a2){
  unsigned int v2; 
  unsigned int v3; 
  unsigned int v5; 
  _WORD *v6; 
  unsigned __int16 v7; 
  unsigned int i; 
  __int16 v9; 
  unsigned __int16 v10; 
  unsigned int v11; 
  VOID **PoolWithTag; 
  VOID **v13; 
  VOID **v14; 
  unsigned __int16 v15; 
  __int16 v16; 
  unsigned int j; 
  __int16 v18; 
  __int16 v19; 
  __int64 v20; 

  v2 = *(_DWORD *)(a1 + 8);
  v3 = 0;
  if( v2 - 2 > 0x3FE )
  {
    return(unsigned int)-1073741811;
  }
  else
  {
    v5 = v2 >> 1;
    v6 = *(_WORD **)a1;
    v7 = 1;
    for( i = 0; i < v5; v7 = v10 )
    {
      v9 = v6[i];
      if( !v9 )
        break;
      ++i;
      v10 = v7 + 1;
      if( v9 != 59 )
        v10 = v7;
    }
    v11 = i + 1;
    if( v5 <= v11 )
      v11 = v5;
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 2 * (v11 + 8 * v7) + 24, 1182233669i64);
    v13 = PoolWithTag;
    if( PoolWithTag )
    {
      memset(PoolWithTag, 0i64, 2 * (v11 + 8 * v7) + 24);
      v14 = &v13[2 * v7 + 3];
      *(_WORD *)v13 = v7;
      memmove(v14, v6, 2 * v11);
      v13[2] = v14;
      v15 = 1;
      v16 = 0;
      for( j = 0; j < v11; ++j )
      {
        v18 = *((_WORD *)v14 + j);
        if( !v18 || v15 >= *(_WORD *)v13 )
          break;
        if( v18 == 59 )
        {
          v19 = j - v16;
          *((_WORD *)v14 + j) = 0;
          v20 = 2i64 * v15;
          v16 = j + 1;
          ++v15;
          LOWORD(v13[v20 - 1]) = v19;
          v13[v20 + 2] = (char *)v14 + 2 * j + 2;
        }
      }
      LOWORD(v13[2 * v15 - 1]) = v11 - v16 - 1;
      *a2 = v13;
    }
    else
    {
      return(unsigned int)-1073741801;
    }
  }
  return v3;
}

Referenced by:

EtwpAllocateFilter