c++如何运行其内容存储在char数组中的.exe文件?

标签 c++ char exe execute

我正在制作一个特定的程序,我只是想知道我是否可以这样做: 在 WINDOWS 上运行一个文件,其内容存储在一个字符数组中。

这是读取可执行文件并将其存储在字符数组中的代码:

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++ 代码。

最佳答案

这显示了如何加载 EXE 文件并从内存中运行它:http://www.codeproject.com/KB/cs/LoadExeIntoAssembly.aspx

此处的其他阅读 Material :CreateProcess from memory buffer这里:How to run unmanaged executable from memory rather than disc

关于c++如何运行其内容存储在char数组中的.exe文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8723039/

相关文章:

c++ - 单链表交换函数(int, int)

c++ - inNull(sqlite3_stmt *, int col) 是否有一个 bool 允许我检查它?

c++ - (值 << 32) >> 32 是什么意思?

c++ - 将宽 CString 转换为 char*

java - 在 Windows 中运行时出现 charAt 问题

c - 内存指针

gcc - 如何更改GCC编译器的目标目录?

audio - 播放wav文件python 3

C++ 指向函数的指针作为参数。数据类型不兼容

c - 如何在 C win32 控制台应用程序 EXE 文件中保存包含的库