Reputation: 20360
(Win32 platform c++) Using __try and __finally, how can I get the module name (And address) of the cause for an exception? I call GetExceptionInformation() but from that I am not sure where this information is.
Given other resources online and in MSDN the Minidump handlers and other sample code seem to be able to get it, but I am not sure how.
Any references or more enlightening resources are appreciated.
Upvotes: 1
Views: 1122
Reputation: 595711
The EXCEPTION_RECORD record provided by EXCEPTION_POINTERS includes the address where the exception occured. You can then probably use EnumProcessModules() and GetModuleInformation() to locate the module that the exception address falls within, and then use GetModuleFileNameEx() to get that module's filename.
Upvotes: 3
Reputation: 7586
You want to walk the callstack, as described in this CodeProject article.
Either you can use Jochen's code as it is, or try to harvest enough details to extract the information you want.
Upvotes: 1