开发者

C++ - catch all exceptions?

开发者 https://www.devze.com 2023-04-02 06:56 出处:网络
I wa开发者_Go百科nt to inject a DLL into a process. Once this DLL is in there, it should catch & properly handle all access violation exceptions which occur in the process. Is there any way to acc

I wa开发者_Go百科nt to inject a DLL into a process. Once this DLL is in there, it should catch & properly handle all access violation exceptions which occur in the process. Is there any way to accomplish this?


How about SetUnhandledExceptionFilter( function )?

function's prototype is:

LONG __stdcall ExceptionHandler(EXCEPTION_POINTERS *ExceptionInfo);

I've used this function to create crash dumps, etc.


You can use Structured Exception Handling (SEH) to catch such exceptions. Specifically, this Windows function seems to be what you want to do.


To complete the collection, you can also use AddVectoredExceptionHandler.


Pre XP, you cannot catch all exceptions. XP or later, you should use AddVectoredExceptionHandler(1, handler), although you are not guaranteed that you will always be the first vectored exception handler.

0

精彩评论

暂无评论...
验证码 换一张
取 消