c++如何运行内容存储在字符数组中的.exe文件?
我正在制作一个特定的程序,我只是想知道我是否可以这样做: 运行一个文件,其内容存储在 WINDOWS 上的字符数组中。
这是读取可执行文件并将其存储在 char 数组中的代码:
filetoopen.open (C:\blahlbah.exe, ios::binary);
filetoopen.seekg (0, ios::end);
length = filetoopen.tellg();
filetoopen.seekg (0, ios::beg);
buffer = new char [length];
filetoopen.read (buffer, length);
filetoopen.close();
我听说过一些有关 RunPE 的信息,并且做了一些搜索,但我没有成功找到任何可以使用的 C++ 代码。
I'm making a specific program and i just wondered if I could do this:
run a file whose contents are stored in a char array ON WINDOWS.
this is the code that reads the executable and stores it in a char array:
filetoopen.open (C:\blahlbah.exe, ios::binary);
filetoopen.seekg (0, ios::end);
length = filetoopen.tellg();
filetoopen.seekg (0, ios::beg);
buffer = new char [length];
filetoopen.read (buffer, length);
filetoopen.close();
I heard something about RunPE and I did some searching, I haven't succeeded in finding any piece of C++ code to use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这显示了如何加载 EXE 文件并从内存运行它: http://www. codeproject.com/KB/cs/LoadExeIntoAssembly.aspx
此处的其他读物:从内存缓冲区创建进程和此处:如何从内存而不是光盘运行非托管可执行文件
This shows how to Load an EXE File and Run It from Memory : http://www.codeproject.com/KB/cs/LoadExeIntoAssembly.aspx
Additional readings here : CreateProcess from memory buffer and here : How to run unmanaged executable from memory rather than disc