ExpPartitionInitialize

NTSTATUS __stdcall ExpPartitionInitialize(INT64 a1){
  VOID **PoolWithTag; 
  INT64 v3; 
  size_t v4; 
  VOID **v5; 
  size_t v6; 
  VOID **v7; 
  unsigned __int16 v8; 
  INT64 v9; 
  INT64 v10; 
  int PoolInternal; 
  NTSTATUS result; 
  INT64 v13; 
  INT64 v14; 

  PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x20ui64, 1817671749i64);
  v3 = (INT64)PoolWithTag;
  if( !PoolWithTag )
    return -1073741801;
  PoolWithTag[1] = 0i64;
  PoolWithTag[2] = 0i64;
  PoolWithTag[3] = 0i64;
  *PoolWithTag = (VOID *)a1;
  v4 = 8 * (unsigned __int16)KeNumberNodes;
  v5 = ExAllocatePoolWithTag(0x200ui64, v4, 1817671749i64);
  *(_QWORD *)(v3 + 8) = v5;
  if( v5 )
  {
    memset(v5, 0i64, v4);
    v6 = 8 * (unsigned __int16)KeNumberNodes;
    v7 = ExAllocatePoolWithTag(0x200ui64, v6, 1817671749i64);
    *(_QWORD *)(v3 + 16) = v7;
    if( v7 )
    {
      memset(v7, 0i64, v6);
      v8 = 0;
      if( !KeNumberNodes )
      {
LABEL_12:
        *(_DWORD *)(v3 + 24) = 252;
        result = 0;
        *(_QWORD *)(a1 + 16) = v3;
        return result;
      }
      while( 1 )
      {
        v9 = 0i64;
        if( (_UNKNOWN *)KeNodeBlock[v8] != (_UNKNOWN *)((char *)&KiNodeInit + 384 * v8) )
          v9 = KeNodeBlock[v8];
        *(_QWORD *)(*(_QWORD *)(v3 + 16) + 8i64 * v8) = ExAllocatePoolWithTag(0x200ui64, 0x118ui64, 1817671749i64);
        v10 = *(_QWORD *)(*(_QWORD *)(v3 + 16) + 8i64 * v8);
        if( !v10 )
          break;
        ExpWorkQueueManagerInitialize(v10, v3, v9);
        *(_QWORD *)(*(_QWORD *)(v3 + 8) + 8i64 * v8) = ExAllocatePoolWithTag(0x200ui64, 0x40ui64, 1817671749i64);
        if( !*(_QWORD *)(*(_QWORD *)(v3 + 8) + 8i64 * v8) )
          break;
        memset(*(VOID **)(*(_QWORD *)(v3 + 8) + 8i64 * v8), 0i64, 0x40u);
        LODWORD(v13) = 0;
        PoolInternal = ExpPartitionCreatePoolInternal(v3, 0i64, (unsigned int)ExpMaximumKernelWorkerThreads, v9, v13);
        if( PoolInternal < 0 )
          goto LABEL_13;
        LODWORD(v14) = 1;
        PoolInternal = ExpPartitionCreatePoolInternal(v3, 0i64, (unsigned int)ExpMaximumKernelWorkerThreads, v9, v14);
        if( PoolInternal < 0 )
          goto LABEL_13;
        if( ++v8 >= (unsigned __int16)KeNumberNodes )
          goto LABEL_12;
      }
    }
  }
  PoolInternal = -1073741801;
LABEL_13:
  ExpPartitionDestroy((PVOID)v3);
  return PoolInternal;
}

Referenced by:

ExpWorkerInitialization
PspAllocatePartition