ExpCheckForResource

VOID *__stdcall ExpCheckForResource(VOID *p, ULONG_PTR Size){
  __int64 v2; 
  unsigned __int8 v4; 
  void **v5; 
  unsigned __int64 v6; 

  v2 = *(_QWORD *)&Size;
  if( (MmVerifierData & 0x800) != 0 && VfCheckForResource(p, Size)
    || (unsigned int)KeNumberProcessors_0 > 1
    || (ExResourceCheckFlags & 1) == 0 )
  {
    return 0i64;
  }
  v4 = ExAcquireSpinLockShared(&ExpResourceSpinLock);
  v5 = (void **)*(&WheapDeferredInternalLogsEventLock + 368);
  v6 = v4;
  while( v5 != (void **)((char *)&WheapDeferredInternalLogsEventLock + 2944) )
  {
    if( v5 >= p && v5 < (void **)((char *)p + v2) )
    {
      DbgPrintEx(
        0,
        0,
        "EX: ExFreePool( %p, %Ix ) contains an ERESOURCE structure that has not been ExDeleteResourced\n",
        p,
        v2);
      __debugbreak();
    }
    v5 = (void **)*v5;
  }
  ExReleaseSpinLockSharedFromDpcLevel((PEX_SPIN_LOCK)&ExpResourceSpinLock);
  __writecr8(v6);
  return 0i64;
}

Referenced by:

ExFreeHeapPool
ExpFreePoolChecks