ExpAllocatePoolWithTagFromNode

VOID *__fastcall ExpAllocatePoolWithTagFromNode(
        UINT64 PoolType,
        ULONG_PTR BugCheckParameter1,
        UINT64 Tag,
        UINT64 IdealNode,
        INT64 a5){
  unsigned int v5; 
  unsigned int v7; 
  int v8; 
  int v9; 
  unsigned int v10; 
  unsigned int NextNode; 
  VOID *result; 
  _QWORD *v13; 
  ULONG_PTR BugCheckParameter4; 
  UINT64 LookupIndex; 
  v5 = Tag;
  v7 = PoolType;
  if( (IdealNode & 0x80000000) == 0i64 )
    v8 = 1;
  else
    v8 = (unsigned __int16)KeNumberNodes;
  v9 = a5;
  v10 = IdealNode & 0x7FFFFFFF;
  LODWORD(LookupIndex) = 0;
  if( (IdealNode & 0x80000000) == 0i64 )
    v10 = IdealNode;
  NextNode = v10;
  while( 1 )
  {
    LODWORD(BugCheckParameter4) = v9;
    result = ExAllocateHeapPool(v7, BugCheckParameter1, v5, NextNode, BugCheckParameter4);
    if( result )
      break;
    if( --v8 )
    {
      NextNode = MmGetNextNode(v10, &LookupIndex);
      if( NextNode != -1 )
        continue;
    }
    ++ExPoolFailures;
    if( (v7 & 2) != 0 )
    {
      v13 = (_QWORD *)qword_140C57E00[0];
      if( (v7 & 0x200) != 0 )
        v13 = (_QWORD *)qword_140C57E08;
      KeBugCheckEx(
        0x41u,
        BugCheckParameter1,
        (unsigned int)v13[17],
        (unsigned int)v13[21] + (unsigned int)v13[23],
        0i64);
    }
    if( (v7 & 0x10) != 0 )
      RtlRaiseStatus(-1073741670);
    return 0i64;
  }
  return result;
}

Referenced by:

ExAllocateCacheAwarePushLock
ExAllocatePool2
ExAllocatePool3
ExAllocatePoolMm
ExAllocatePoolWithTagPriority
ExpSaBinaryArrayInsert
ExpSaInitialize
ExpSaPageGroupDescriptorAllocate
MiAllocatePool