CmpCanGrowHive

CHAR __fastcall CmpCanGrowHive(INT64 a1, UINT64 a2){
  __int64 v3; 
  WORK_QUEUE_ITEM *PoolWithTag; 
  if( (unsigned int)a2 <= 0x7FFFE000 )
  {
    if( a1 != Hive )
      return 1;
    if( (int)a2 + 4096 <= (unsigned int)CmSystemHiveLimitSize )
    {
      LODWORD(v3) = 393216;
      if( *(_QWORD *)(*(_QWORD *)qword_140C4E388 + 6928i64) >> 1 < 0x60000ui64 )
        v3 = *(_QWORD *)(*(_QWORD *)qword_140C4E388 + 6928i64) >> 1;
      if( (int)a2 + 4096 > 36864 * (int)v3 / 0xAu && !CmpSystemQuotaWarningPopupDisplayed && ExReadyForErrors )
      {
        PoolWithTag = (WORK_QUEUE_ITEM *)ExAllocatePoolWithTag(NonPagedPoolNx, 0x20ui64, 0x20204D43ui64);
        if( PoolWithTag )
        {
          PoolWithTag->List.Flink = 0i64;
          PoolWithTag->WorkerRoutine = (void(__fastcall *)(void *))CmpQuotaWarningWorker;
          CmpSystemQuotaWarningPopupDisplayed = 1;
          PoolWithTag->Parameter = PoolWithTag;
          ExQueueWorkItem(PoolWithTag, DelayedWorkQueue);
        }
      }
      return 1;
    }
  }
  return 0;
}

Referenced by:

HvpAddBin