Writing SEH translator
Writing SEH translator
class seh_exception : public std::exception {
public:
seh_exception(UINT se_code, PEXCEPTION_POINTERS se_info);
seh_exception(const seh_exception& old);
~seh_exception();
const char *what() const;
};
void translate_seh_exception(UINT se_code, PEXCEPTION_POINTERS se_info) {
throw seh_exception(se_code, se_info);
}
现在,我在构造函数中该怎么办?我找不到有关*se_info
存在多长时间的任何信息,这意味着我可能不应该仅将se_info
保存在私有字段中以供以后使用 - 我应该深入复制它。也许不是?
和what()
是什么?我应该想起基础的按需字符串吗?同样,在这种情况下,在构造函数中分配内存似乎不是一个好主意。
我目前已经实施了IT存储se_code
和se_info
,而无需任何深层复制,并在构造函数中生成格式的消息,尽管我不知道它是否真的是 quay quest 。
我打算在"捕获,记录发生的事情,终止"方案中使用它。
您不需要自己的课程就可以实现这一目标,只需扔PEXCEPTION_POINTERS
即可。se_code
也可以在se_info->ExceptionRecord->ExceptionCode
上找到。
所以最简单的处理程序只是;
void translate_seh_exception(UINT se_code, PEXCEPTION_POINTERS se_info) {
throw se_info;
}
您可以catch(PEXCEPTION_POINTERS se_info)
保证EXCEPTION_POINTERS
在catch
块的持续时间内存在,这是您需要的时间。根据文档,对于每个捕获块,调用了一次转换器函数一次,即,它必须重新换装包含try/catch
块的每个函数的SEH例外。
相关文章:
- 并不总是可以在Windows 8.1上的WoW64上捕获SEH "clean"
- Writing SEH translator
- 我可以从Windows SEH异常中解码C 异常吗?(如果是这样,怎么样?)
- SEH例外,代码0xc0000005在测试主体中投入
- Visual studio显示SEH异常的错误位置
- 包含python.h和boost/python.hpp的C++导致SEH异常
- 空引用如何导致代码0xc0000005的 SEH 异常
- 在C++中记录 SEH 错误
- VC 中C++例外,没有 SEH
- 如何从SEH异常生成堆栈跟踪
- Linux中的SEH等效或如何处理操作系统信号(如SIGSERV)并保持继续
- visual c++ SEH - EXCEPTION_DISPOSITION枚举和__except()过滤器表达式之间的
- 结构化异常处理程序(SEH)不会捕获堆损坏
- 从混合模式c++项目中的CLR-to-SEH异常中获取明智的信息
- 使用googlemock时SEH异常
- sjlj vs dwarf vs seh的区别是什么?
- 混合c++异常处理和SEH (windows)
- MinGW SEH和MinGW SJLJ有什么区别?
- 谷歌模拟的EXPECT_CALL导致"unknown file:error: SEH exception with code 0xc0000005 thrown in the test body"
- 捕获GUI代码中的SEH异常