14

Is it possible to inject a DLL file into a process such as explorer or svchost using C#? I know this is possible in C++ but is it in C#? If so would it matter how the DLL was written, e.g. would it differ betweeen a C++ DLL or a Visual Studio C# .NET DLL? If this is at all possible could someone post the code that I could use to do this. Thank you very much.

Zruty
  • 8,377
  • 1
  • 25
  • 31
Bali C
  • 30,582
  • 35
  • 123
  • 152

1 Answers1

23

Yes it is possible: http://www.codingthewheel.com/archives/how-to-inject-a-managed-assembly-dll

Since that link appears to be down, here's a cached version: http://web.archive.org/web/20101224064236/http://codingthewheel.com/archives/how-to-inject-a-managed-assembly-dll

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • I have now created and injected a C# DLL that shows a messagebox but when it is injected into explorer nothing happens. Is there something I have to do to get it started? – Bali C Jul 07 '11 at 12:37
  • Ok, I will post it as a new question :) – Bali C Jul 07 '11 at 12:54
  • 3
    next time copy necessary content from the site.. it's down and I am missing help because of this.. – Erti-Chris Eelmaa Nov 13 '12 at 17:09
  • @ChrisDD And that's worth a downvote is it? And how can you be sure that copying the details would not have violated copyright? – David Heffernan Nov 13 '12 at 17:11
  • 2
    Yes because it spent my time & it's not actually useful anyhow. Or what do you think the downvote is for? – Erti-Chris Eelmaa Nov 13 '12 at 17:12
  • 15
    @ChrisDD I think you have a problem with a spurious sense of entitlement. You really think that I have wasted your time?! – David Heffernan Nov 13 '12 at 17:13
  • 4
    @ChrisDD I found a cached version. You could have done so yourself. See the updated version of the answer. – David Heffernan Nov 13 '12 at 19:52
  • 4
    Dude, I would shake you hand if I could. That link is EXACTLY the type of explanation I was looking for. – Bruno Klein Jun 19 '14 at 22:32
  • 2
    Sorry to gravedig on this, but @DavidHeffernan, it's best to give the pertinent information in the answer, not just a link. Link only answers are subject to closure by SO rules, he's not wrong – Christopher Wirt Jun 19 '15 at 18:36
  • @Christopher That is true, but does not justify the antagonistic comment from Erti. In this instance though, summarising the off site link would require a lot of effort on my part. I didn't do it. Forgive me for that please. – David Heffernan Jun 19 '15 at 18:40
  • @DavidHeffernan Understandable enough, and you were kind enough to come back with a cached link, but SO is meant to be as close to a closed system as possible. Search topics, find answers, without leaving the site. I feel like I've preaching to the choir a bit, though, since you're top .01% :) Thanks for the answer, anyway. Exactly what I was looking for – Christopher Wirt Jun 19 '15 at 18:43
  • @Christopher I know. And most times I would put more text in. This topic I know little about so I'd probably have written it wrongly anyway. And maybe I was just busy elsewhere! Anyway, thanks for the interest. I appreciate your comments. – David Heffernan Jun 19 '15 at 18:45