Where to clean up stuff in injected DLL

c++ / delphi package - dll injection and api hooking
iconic
Site Admin
Posts: 1065
Joined: Wed Jun 08, 2005 5:08 am

Re: Where to clean up stuff in injected DLL

Post by iconic »

EasY,

DLL_Xxx events are executed within APCs, also have you factored in potentially odd TLS callback behavior?

--Iconic
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Where to clean up stuff in injected DLL

Post by madshi »

I've now changed the code so that only the first uninjection thread executes AutoUnhook. If there are more uninjection threads, in the moment when they try to call AutoUnhook, they're simply closed immediately with ExitThread. This way they can't even try to actually call FreeLibrary. Here's a beta build with this change:

http://madshi.net/madCollectionBeta.exe (2.7.4.4)

Can you confirm that the problem is solved with this build?
princezna
Posts: 13
Joined: Thu Mar 01, 2012 1:40 pm

Re: Where to clean up stuff in injected DLL

Post by princezna »

Yes, I can confirm this solved the issue. We haven't been able to reproduce it with the beta release in the previous post.

Thanks. :)
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Where to clean up stuff in injected DLL

Post by madshi »

Good to hear, thanks for the feedback.
Post Reply