I have a MFC SDI application which during startup loads a DLL. I am only able to view the source code and use the DLL but not changing & recompiling it.
The situation now is that, whenever the DLL encouner an error it will call exit() such as below.
bool Func()
{
// .. do something here
if (error) { exit(999); }
}
In my MFC application, i've set the SetUnhandledExceptionFilter to handle all exceptions and also created a MiniDump for debugging purposes.
So now the problem is that whenever the DLL encounter any error, it will just call exit() with the status code 999 and my ExceptionFilter will not catch it and thus no MiniDump created for PostMortem debugging.
I was wonder if:
1. Is there any other way for my global exception handler to catch this?
2. Can i override the exit() function so that when its called, i call do this "throw("error encounter!")" and my global exception handler can catch it.
3. I tried using atexit() at my MFC application, whereby i register another function to throw error whenever the DLL call exit(). But it seems like this is not working as well.
What i really wanted to do is that whenever the DLL encounters an error, i want a MiniDump to be generated so i could do PostMortem debugging. Are there anything else that might work in this situation?
Thanks.