Listing 6 Usage of GetCurrentExceptionRecord() (compile with /EHa)
void gpf() { char * p = 0; p[6] = 'a'; } int main() { try { gpf(); } catch(...) { const EXCEPTION_RECORD * pr = GetCurrentExceptionRecord(); if (pr && pr->ExceptionCode != CPP_EXCEPTION) { std::cout << "SEH Exception with code " << std::hex << pr->ExceptionCode << std::dec << " occured at " << pr->ExceptionAddress << "\n"; } } return 0; }