mnn
mnn

Reputation: 2010

Inject code into native process

Hello I'm in trouble injecting a process with C# code. I'm using CreateRemoteThread method by Mike Stall. However I get Last Win32 Error 1008 when trying to inject process.

(btw. I tried injecting DLL (which runs my code) but I didn't succeed. I would post links to codes, but I can't)

Upvotes: 1

Views: 1830

Answers (1)

Noldorin
Noldorin

Reputation: 147290

This is by no means a simple task, and involves more than a bit of Win32 API hackery.

I did in fact attempt exactly this some time ago and it took a lot of messing around with API calls/argument marshalling to get it working - though I eventually made it quite stable. You can find the code I wrote in the repository for my Windows SSH Server project (specifically the ConsoleDotNet Visual Studio project). The code for the native C++ DLL should also be included in full.

I believe you should be able to reuse much of that code verbatim (or with only small modifications). It should also be reasonably well commented, if I remember rightly. Still, let me know if you have any trouble understanding it. Good luck!

Upvotes: 4

Related Questions