DLL Injection, threads and memory releasing
I have a following situation - i inject a dll written in C into another process, that dll loads CLR and starts a thread calling a method from managed class library.
My question is - how and when should I release memory of all these objects, so that target process (in which I inject dll initially) can successfully exit and free it's resour开发者_运维百科ces, including releasing a lock from my dll which was injected?
how about this:
since you are already DLL injecting your code its only small step further to hook the exit / cleanup call of your target process and do:
- Jump to your code
- stop threads
- cleanup mem
- jump back
精彩评论