1

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?

Community
  • 1
  • 1
  • 1
    possible duplicate of [How do I invoke an exe that is an embedded resource in a .Net assembly?](http://stackoverflow.com/questions/72615/how-do-i-invoke-an-exe-that-is-an-embedded-resource-in-a-net-assembly). Ans also http://stackoverflow.com/questions/5997594/process-start-embedded-exe-without-extracting-to-file-first-c-sharp. Please perform a minimum search before posting a question Stack Overflow. – Darin Dimitrov Aug 18 '12 at 17:36
  • 1
    That's not possible, a core Windows design restriction. And thank heavens it isn't. – Hans Passant Aug 18 '12 at 17:37
  • http://stackoverflow.com/questions/798655/embedding-an-external-executable-inside-a-c-sharp-program – sonofaforester Aug 18 '12 at 17:38
  • @sonofaforester, this saves the executable to the disk. – Darin Dimitrov Aug 18 '12 at 17:38
  • @DarinDimitrov maybe there is a wayt to calculate bytes range , which is needed for execution, then hijackes own/non-own process with this bytes range and try to call it? PS It's not duplicate –  Aug 18 '12 at 17:44
  • Is the external executable a .net assembly? – aKzenT Aug 18 '12 at 18:01
  • Please explain that why you think it is not a duplicate.... – Alexei Levenkov Aug 18 '12 at 18:12

1 Answers1

1

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.

Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179