Can I inject a thread in a remote app domain from C#

谁说我不能喝 提交于 2019-12-01 08:54:10

问题


I was wondering if its possible to inject a thread into a remote app domain running in a separate process.

My guess is that I could do this using the debugging interfaces (ICorDebug) but I was wondering if there is any other way?


回答1:


There was recently an announcement of a new facility Mono provides to do just this. See this post on assembly injection.




回答2:


Mike Stall has an interesting sample on how to use CreateRemoteThread to inject remote threads in managed apps.

This answer is still incomplete, cause I would like to run new code in the remote appdomain. I guess I could try creating 1 new thread that loads a library for me, and another that will call a place in my new library to do the work.




回答3:


This can be done there is sample code in snoop It sets up a hook, and using managed c++ tells the appdomain to load an assembly. Really impressive ...




回答4:


There's another way by using SetThreadContext, and by changing the EIP of the target process. However I don't know how you would do that in C#.



来源:https://stackoverflow.com/questions/185083/can-i-inject-a-thread-in-a-remote-app-domain-from-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!