I have a large MFC program. We have rare situations where a customer gets an CMemoryException.
The problem is, that we get the exception but not the location were the exception was thrown.
I can intercept the IAT (Import Address Table) but in this situation I can only detect calls made from my application into the MFC DLL or from other DLLs into the MFC DLL.
How can I intercept all calls the AfxThrowMemoryException? So all calls from within the MFC DLL also can be trapped by me.
In fact I don't know the internal address of the function I want to trap. OK I can use the IAT and calculate the internal address.
I know Detours, but I wouldn't like to deliver it with my software too..
Or is there any simpler method to rap the throw operation inside the C++ code?
Best would be, that I can trapp any exception before they are thrown. So I can see the caller code.
I replaced the function header itself. For the debug version there was an additional redirection. The following code works.
Just implement you own MyAfxThrow...Exception function. Should have the same signature like the AfxThrow... functions.