开发者

DLL Injection, threads and memory releasing

开发者 https://www.devze.com 2023-03-02 19:57 出处:网络
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.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消