process.start() 嵌入 exe 而不先提取到文件 c# [英] process.start() embedded exe without extracting to file first c#

查看:25
本文介绍了process.start() 嵌入 exe 而不先提取到文件 c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用资源中嵌入了一个可执行文件.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:

  1. 您想知道是否可以执行嵌入到程序中的可执行文件,而无需先将其解压缩到磁盘
  2. 您的程序是 .NET 程序
  3. 您要执行的可执行文件不是 .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:

  1. 将可执行代码加载到内存中
  2. 重新映射二进制映像中的所有地址,以便它们相对于您加载可执行文件的基地址是正确的
  3. 可能加载外部引用,即.可执行文件需要的其他 DLL
  4. 重新映射那些引用的地址
  5. 可能加载刚刚加载的引用 DLL 所需的引用
  6. 重新映射那些dll
  7. 重复 3 到 6 直到完成
  8. 调用代码

我假设您的问题是我可以做 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#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆