简体   繁体   English

在给定_EXCEPTION_POINTERS结构的情况下,如何获取导致结构化异常的模块名称? (win32 C ++)

[英]How do I get the module name that caused a structured exception given a _EXCEPTION_POINTERS struct? (win32 C++)

(Win32 platform c++) Using __try and __finally, how can I get the module name (And address) of the cause for an exception? (Win32平台c ++)使用__try和__finally,如何获取异常原因的模块名称(和地址)? I call GetExceptionInformation() but from that I am not sure where this information is. 我调用GetExceptionInformation(),但从那里我不确定这个信息在哪里。

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. 鉴于其他资源在线和MSDN,Minidump处理程序和其他示例代码似乎能够得到它,但我不知道如何。

Any references or more enlightening resources are appreciated. 任何参考或更具启发性的资源表示赞赏。

The EXCEPTION_RECORD record provided by EXCEPTION_POINTERS includes the address where the exception occured. EXCEPTION_POINTERS提供的EXCEPTION_RECORD记录包括发生异常的地址。 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. 然后,您可以使用EnumProcessModules()和GetModuleInformation()来定位异常地址所在的模块,然后使用GetModuleFileNameEx()来获取该模块的文件名。

You want to walk the callstack, as described in this CodeProject article . 您想要遍历callstack,如本CodeProject文章中所述

Either you can use Jochen's code as it is, or try to harvest enough details to extract the information you want. 要么你可以使用Jochen的代码,要么尝试收集足够的细节来提取你想要的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM