I have a function IsPtrReadable
which uses SEH to check for invalid pointers.
bool DXHR::IsPtrReadable(void* pointer) {
__try {
volatile char test = *(char*)pointer;
return true;
}
__except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
return false;
}
}
I’m expecting IsPtrReadable
to come across nullptr
and invalid pointers eventually. Which is why I have it inside of an SEH block. The issue is that when debugging my application MSVC will halt execution every time this occurs. Which is a nuisance because I’m not interested in when it happens within this specific function. But I’d like it to still halt and show me the line an access violation occurs on outside of this function.
How can I achieve this?