Reputation: 5430
I have a non-.Net executable file that is included in my .net assembly as an embedded resource. Is there a way to run this executable that does not involve writing it out to disk and launching it?
This is .Net 2.0.
Upvotes: 4
Views: 3419
Reputation: 47502
You can load a .NET assembly from a byte array using an overload of Assembly.Load.
However, there are implications for the security model that need to be considered which make things more complex. See the discussion here, and also this thread.
If your embedded executable is not .NET then I think you will have to write it out to disk first.
Upvotes: 3
Reputation: 28835
You might try injecting your exe into a suspended process and then awakening the hijacked process, but this seems like a recipe for disaster.
Upvotes: 4