如何执行存储在MemoryStream中的程序,以便无需先保存到硬盘。文件不得临时保存到硬盘。该程序必须完全从内存中运行。
static string strTemplate = "MyAPP.SOMEprogram.exe";
byte[] template;
int len = 0;
Assembly assembly = Assembly.GetExecutingAssembly();
using (Stream stream = assembly.GetManifestResourceStream(strTemplate))
{
len = (int)stream.Length;
BinaryReader reader = new BinaryReader(stream);
template = reader.ReadBytes(len);
}
MemoryStream ms = new MemoryStream(template, true);
现在所有的程序都在内存流(RAM)中运行,我能执行这个程序吗?非常感谢。