【发布时间】:2012-02-02 03:05:07
【问题描述】:
我正在制作一个特定的程序,我只是想知道我是否可以这样做: 在 WINDOWS 上运行其内容存储在 char 数组中的文件。
这是读取可执行文件并将其存储在 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++ 代码。
【问题讨论】:
-
在哪个操作系统上?如果它只是 Windows(我猜),请这样标记问题。你为什么要这样做?为什么不能将可执行文件写入临时可执行文件??