The documentation for _EXCEPTION_RECORD
says about one of it's members, struct _EXCEPTION_RECORD *ExceptionRecord
A pointer to an associated EXCEPTION_RECORD structure. Exception records can be chained together to provide additional information when nested exceptions occur.
However, I haven't been able to provoke such a situation of nested structured exceptions. Here is what I have tried so far:
#include <iostream>
#include <windows.h>
void Handle0(LPEXCEPTION_POINTERS pex) {
std::cout << "chain0 = " << pex->ExceptionRecord->ExceptionRecord << std::endl;
}
void Handle1(LPEXCEPTION_POINTERS pex) {
std::cout << "chain1 = " << pex->ExceptionRecord->ExceptionRecord << std::endl;
__try {
throw 3;
} __except( Handle0(GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER ) {}
}
int main() {
__try {
throw 3;
} __except( Handle1(GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER ) {}
return 0;
}
The pex->ExceptionRecord->ExceptionRecord
is always nullptr
. Under what circumstances do I get a link to a nested _EXCEPTION_RECORD
there?
According to MSDN:
I believe it is also set if you try to continue non-continuable exception. In this case
EXCEPTION_RECORD
will representEXCEPTION_NONCONTINUABLE_EXCEPTION
, while itsExceptionRecord
will point to original exception.