Search code examples
c#loadexeembedded-resourceexecution

Embedding an external executable inside a C# program and run it without creating new file


Possible Duplicate:
How do I invoke an exe that is an embedded resource in a .Net assembly?

How do I embed an external executable inside my C# ( I suppose via Resources, but I don't know about other ways, so this option is needed in this question - too ) and run this program inside main running program without writing it to the disk.

How could it be done?


Solution

  • Despite Hans' comment I think it is pretty easy* (assuming code have enough privilegies to do that). Essentially you want to fake local drive (or network drive if it works for your evil code).

    Network drive can be easiy created by implementing DAV in your own program and that pointing network path to that machine using WebDAV client.

    Local drive should be possibible too (also I'm not sure if any .Net implementations are avaialble) by for example implementing Minifilter Driver and setting it up, but I strongly suspect that there is no way to have it run from the only executable...

    *Easy as in "does not require significant unsupported hacks", time estimates and necessary level of knowledge is not considered.