Пример #1
0
bool
PreReservedVirtualAllocWrapper::IsInRange(void * address)
{
    if (!this->IsPreReservedRegionPresent())
    {
        return false;
    }
    bool isInRange = IsInRange(GetPreReservedStartAddress(), address);
#if DBG
    if (isInRange)
    {
        //Check if the region is in MEM_COMMIT state.
        MEMORY_BASIC_INFORMATION memBasicInfo;
        size_t bytes = VirtualQuery(address, &memBasicInfo, sizeof(memBasicInfo));
        if (bytes == 0)
        {
            return false;
        }
        AssertMsg(memBasicInfo.State == MEM_COMMIT, "Memory not committed? Checking for uncommitted address region?");
    }
#endif
    return isInRange;
}
Пример #2
0
bool
PreReservedVirtualAllocWrapper::IsInRange(void * address)
{
    if (this == nullptr || !this->IsPreReservedRegionPresent())
    {
        return false;
    }

    if (address >= GetPreReservedStartAddress() && address < GetPreReservedEndAddress())
    {
#if DBG
        //Check if the region is in MEM_COMMIT state.
        MEMORY_BASIC_INFORMATION memBasicInfo;
        size_t bytes = VirtualQuery(address, &memBasicInfo, sizeof(memBasicInfo));
        if (bytes == 0 || memBasicInfo.State != MEM_COMMIT)
        {
            AssertMsg(false, "Memory not committed? Checking for uncommitted address region?");
        }
#endif
        return true;
    }

    return false;
}