I'm developing an application with C#.NET 4.6 It references an old OCX LAPI.ocx
When this OCX receives some special message called PCPCM entire application crashes with HEAP Corruption exception.
Unfortunately I can't catch or handle that exception in my application. Yesterday I tried my application with x32dbg. And it worked. x32dbg can catch exceptions and ignores them. How it can ignore such an exception? How I can do this in my application to prevent a crash?
UPDATE: I used dbg to find the point that the ocx raises an exception and tried to jump over it(and patched the original ocx). I put it under test. Hope it works.
UPDATE 2: I couldn't find a way to ignore or catch such exceptions. I couldn't make AddVectoredExceptionHandler working. But downgrading application to .NET 4.0 solved the original problem(No more exception and application crashed message).
Using .NET 4.0 I solved the problem entirely. See UPDATE 2.