When callin' UninjectLibrary (ALL_SESSIONS, "MyDLLName")
It is always bombing out with an unhandeled exception.
What could be causing this?
UninjectLibrary
Sorry about that.
C++.
The injected dll causes an unhandled exception when the uninject library functino tries to remove it from all processes. End result, not all processes unload the injected library and the memory is stuck/leaked until a reboot.
Besides that, I tried putting a try catch around the uninjectlibrary function and it does not get caught. When debugging it, it tries to access a null pointer it looks like.
The only thing I can think of is that I have allocated a COM object someplace and have not freed it up before trying to uninject the library.
C++.
The injected dll causes an unhandled exception when the uninject library functino tries to remove it from all processes. End result, not all processes unload the injected library and the memory is stuck/leaked until a reboot.
Besides that, I tried putting a try catch around the uninjectlibrary function and it does not get caught. When debugging it, it tries to access a null pointer it looks like.
The only thing I can think of is that I have allocated a COM object someplace and have not freed it up before trying to uninject the library.
I think you're not really aware about what happens in which process. Look, your executable does the main work of injecting & uninjecting the dll. But the dll does also a lot of work. Also: The dll is not only loaded into your own process, but a copy of it is loaded into all running processes. Now when you say the injected dll causes an exception when it gets removed, all running processes should crash when you uninject the dll. But what you describe doesn't sound like that.
First of all I have to know which process is crashing. Is it your own or is it another process? Or do all processes crash? If it's your own, then most probably your dll is *not* the crash cause, otherwise all processes would crash, not just your exe. Do you see what I mean?
What happens if your exe injects/uninjects one of the precompiled demo hook dlls which ship with madCodeHook? E.g. try using HookProcessCreation. Does that work without crashes?
P.S: Please compile your madCodeHook projects in release mode. Debug mode sometimes makes problems.
First of all I have to know which process is crashing. Is it your own or is it another process? Or do all processes crash? If it's your own, then most probably your dll is *not* the crash cause, otherwise all processes would crash, not just your exe. Do you see what I mean?
What happens if your exe injects/uninjects one of the precompiled demo hook dlls which ship with madCodeHook? E.g. try using HookProcessCreation. Does that work without crashes?
P.S: Please compile your madCodeHook projects in release mode. Debug mode sometimes makes problems.