ExpPartitionInitialize

INT64 __fastcall ExpPartitionInitialize(INT64 a1){
  _QWORD *PoolWithTag; 
  INT64 v3; 
  VOID *v4; 
  VOID *v5; 
  unsigned __int16 v6; 
  INT64 v7; 
  INT64 v8; 
  int PoolInternal; 
  INT64 result; 
  INT64 v11; 
  INT64 v12; 
  PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x20ui64, 0x6C577845ui64);
  v3 = (INT64)PoolWithTag;
  if( PoolWithTag )
  {
    PoolWithTag[1] = 0i64;
    PoolWithTag[2] = 0i64;
    PoolWithTag[3] = 0i64;
    *PoolWithTag = a1;
    v4 = ExAllocatePoolWithTag(NonPagedPoolNx, 8 * (unsigned int)(unsigned __int16)KeNumberNodes, 0x6C577845ui64);
    *(_QWORD *)(v3 + 8) = v4;
    if( v4 )
    {
      memset((INT64)v4, 0i64);
      v5 = ExAllocatePoolWithTag(NonPagedPoolNx, 8 * (unsigned int)(unsigned __int16)KeNumberNodes, 0x6C577845ui64);
      *(_QWORD *)(v3 + 16) = v5;
      if( v5 )
      {
        memset((INT64)v5, 0i64);
        v6 = 0;
        if( !KeNumberNodes )
        {
LABEL_12:
          *(_DWORD *)(v3 + 24) = 252;
          result = 0i64;
          *(_QWORD *)(a1 + 16) = v3;
          return result;
        }
        while( 1 )
        {
          v7 = 0i64;
          if( *((__int64 **)&KeNodeBlock + v6) != &KiNodeInit[48 * v6] )
            v7 = *((_QWORD *)&KeNodeBlock + v6);
          *(_QWORD *)(*(_QWORD *)(v3 + 16) + 8i64 * v6) = ExAllocatePoolWithTag(
                                                            NonPagedPoolNx,
                                                            0x118ui64,
                                                            0x6C577845ui64);
          v8 = *(_QWORD *)(*(_QWORD *)(v3 + 16) + 8i64 * v6);
          if( !v8 )
            break;
          ExpWorkQueueManagerInitialize(v8, v3, v7);
          *(_QWORD *)(*(_QWORD *)(v3 + 8) + 8i64 * v6) = ExAllocatePoolWithTag(NonPagedPoolNx, 0x40ui64, 0x6C577845ui64);
          if( !*(_QWORD *)(*(_QWORD *)(v3 + 8) + 8i64 * v6) )
            break;
          memset(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 8i64 * v6), 0i64);
          LODWORD(v11) = 0;
          PoolInternal = ExpPartitionCreatePoolInternal(v3, 0i64, (unsigned int)ExpMaximumKernelWorkerThreads, v7, v11);
          if( PoolInternal < 0 )
            goto LABEL_13;
          LODWORD(v12) = 1;
          PoolInternal = ExpPartitionCreatePoolInternal(v3, 0i64, (unsigned int)ExpMaximumKernelWorkerThreads, v7, v12);
          if( PoolInternal < 0 )
            goto LABEL_13;
          if( ++v6 >= (unsigned __int16)KeNumberNodes )
            goto LABEL_12;
        }
      }
    }
    PoolInternal = -1073741801;
LABEL_13:
    ExpPartitionDestroy((PVOID)v3);
  }
  else
  {
    return(unsigned int)-1073741801;
  }
  return(unsigned int)PoolInternal;
}

Referenced by:

PspAllocatePartition