C异常处理
我想知道如何处理 C 中的异常,特别是 EXCEPTION_GUARD_PAGE
异常。
我将尝试更简要地解释这种情况:
我想将一个部分/页面部分标记为 PAGE_GUARD ,每当程序遇到它们时,我想执行一些任务,我尝试用经典的 VirtualAlloc ->写->异常 命中,但我确实知道如何在 C 中捕获异常,
我将不胜感激。 提前致谢。
I would like to know how to handle exceptions in C, specifically EXCEPTION_GUARD_PAGE
exceptions.
I will try explaining the situation more briefly:
I would like to mark a section/pages section as PAGE_GUARD
, and whenever the program hits them I would like to perform a few tasks, I tried causing the exception with a classical VirtualAlloc -> Write -> Exception
hit but I do know to catch the exception in C
I'd appreciate the help.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MSDN 拥有您需要的一切:
在这种特殊情况下,您想要这样的东西:
编辑(响应OP的评论):
上面的代码就可以了(MSDN 再次有帮助),但在这种情况下,有更多的可移植性(不依赖于 MSVC 的扩展)并且可以说是不太难看的解决方案:使用 SetUnhandledExceptionFilter 并让它处理这种情况:
MSDN has everything you need:
In this particular case you want something in this vein:
EDIT (in response to OP's comment):
The above code would do (MSDN is helpful again), but in this case there's more portable (no dependency on MSVC's extensions) and arguably less ugly solution: register a top-level exception filter using SetUnhandledExceptionFilter and let it handle the situation: