问题描述
我有嵌入我的应用程序资源的可执行文件。 ATM我使用汇编反射来解压缩可执行到它自己的文件,然后开始使用执行过程中,START()。是否有可能运行写它先申请从流中嵌入可执行直呢?可能有人请告诉我最有效的方式做到这一点吧。
I have an executable embedded into my app resources. ATM I use assembly reflection to extract the executable to its own file and then start the executive using process,START(). Is it possible to run the embedded executable straight from a stream instead of writing it to file first? Could someone please show me the most efficient way to do this please.
推荐答案
下面是我从你的问题聚集,您的意见:
Here's what I gather from your question, and your comments:
- 您想知道是否可以执行嵌入到你的程序的可执行文件,没有它先解压到磁盘
- 您的程序是一个.NET程序
- 您要执行的可执行文件不是一个.NET程序
这个问题的答案是:是
不过,这个问题的答案也是这是非常,非常难
However, the answer to that is also it is very, very, hard
什么,你需要做的是,请注意,我不知道所有关于这个细节,因为我不这样做,但无论如何:
What you have to do is, and note that I do not know all the details about this since I don't do this, but anyway:
- 加载可执行code到内存
- 重新映射在二进制图像,这样他们就在你加载的可执行文件的基地址正确的所有地址
- 在可能加载外部参照,即。其他DLL的该可执行文件需要
- 重新映射的地址的这些的引用
- 在加载可能需要的只是加载的DLL引用的 引用
- Remape的这些的DLL的
- 重复3到6,直到完成
- 调用code
- Load the executable code into memory
- Remap all addresses in the binary image so that they're correct in relation to the base address you loaded the executable at
- Possibly load external references, ie. other DLL's that executable need
- Remap the addresses of those references
- Possibly load references needed by the just loaded referenced DLL's
- Remape those dll's
- Repeat 3 through 6 until done
- Call the code
我假设你的问题是我该怎么办1和8,这个问题的答案是否
I'm assuming your question is "can I do 1 and 8", and the answer to that is no.
这篇关于的Process.Start()嵌入exe文件无解压到文件的第一个C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!