PnprAllocateMappingReserves

INT64 __fastcall PnprAllocateMappingReserves(CHAR **a1, CHAR **a2, UINT64 a3){
  unsigned int v3; 
  UINT64 v5; 
  CHAR *PoolWithTag; 
  int v7; 
  CHAR *v8; 
  __int64 v9; 
  UINT64 v10; 
  __int64 v11; 
  __int64 v12; 
  v3 = a3;
  v5 = (unsigned int)(24 * a3);
  PoolWithTag = (CHAR *)ExAllocatePoolWithTag(NonPagedPoolNx, v5, 0x51706E50ui64);
  if( !PoolWithTag )
    return(unsigned int)-1073741670;
  v8 = (CHAR *)ExAllocatePoolWithTag(NonPagedPoolNx, v5, 0x51706E50ui64);
  if( v8 )
  {
    memset((INT64)PoolWithTag, 0i64);
    memset((INT64)v8, 0i64);
    v9 = 0i64;
    if( v3 )
    {
      while( 1 )
      {
        v7 = PnprInitializeMappingReserve(2, (INT64)&PoolWithTag[24 * v9]);
        if( v7 < 0 )
          break;
        v7 = PnprInitializeMappingReserve(2050, (INT64)&v8[24 * v9]);
        if( v7 < 0 )
        {
          PnprFreeMappingReserve((__int64)&PoolWithTag[24 * v9]);
          goto LABEL_10;
        }
        v9 = (unsigned int)(v9 + 1);
        if( (unsigned int)v9 >= v3 )
          goto LABEL_9;
      }
    }
    else
    {
LABEL_9:
      v7 = 0;
LABEL_10:
      if( v7 >= 0 )
        goto LABEL_17;
    }
  }
  else
  {
    v7 = -1073741670;
  }
  if( v8 && *(_QWORD *)PoolWithTag && *(_QWORD *)v8 )
  {
    v10 = PnprContext;
    v11 = *(unsigned int *)(PnprContext + 180);
    if( !*(_QWORD *)&PoolWithTag[24 * v11] )
    {
      *(_OWORD *)&PoolWithTag[24 * v11] = *(_OWORD *)PoolWithTag;
      *(_QWORD *)&PoolWithTag[24 * v11 + 16] = *((_QWORD *)PoolWithTag + 2);
      v12 = 3i64 * *(unsigned int *)(v10 + 180);
      *(_OWORD *)&v8[8 * v12] = *(_OWORD *)v8;
      *(_QWORD *)&v8[8 * v12 + 16] = *((_QWORD *)v8 + 2);
      *(_OWORD *)PoolWithTag = 0i64;
      *((_QWORD *)PoolWithTag + 2) = 0i64;
      *(_OWORD *)v8 = 0i64;
      *((_QWORD *)v8 + 2) = 0i64;
    }
    v7 = 0;
LABEL_17:
    *a1 = PoolWithTag;
    *a2 = v8;
    return(unsigned int)v7;
  }
  ExFreePoolWithTag(PoolWithTag, 0x51706E50u);
  if( v8 )
    ExFreePoolWithTag(v8, 0x51706E50u);
  return(unsigned int)v7;
}

Referenced by:

No references.