Yes, it's easy. the point in using _set_se_translator API.
struct se_exception
{
unsigned code;
se_exception (unsigned c) : code(c) {}
};
struct se_exception_access_vioalation : se_exception
{
se_exception_access_vioalation ()
: se_exception(EXCEPTION_ACCESS_VIOLATION) {}
};
void translator_func(unsigned u, _EXCEPTION_POINTERS *)
{
switch (u)
{
case EXCEPTION_ACCESS_VIOLATION:
throw se_exception_access_vioalation();
break;
default:
throw se_exception(u);
break;
}
}
struct dummy
{
char * s;
};
int main(int argc, char* argv[])
{
_set_se_translator(translator_func);
dummy \* p = 0;
try
{
std::cout << p->s <
:)