我已经试过这在使用“包装”或“执行代理”不同的EXE的上下文中运行可执行
byte[] bytes = File.ReadAllBytes("Program.exe");
Assembly assembly = Assembly.Load(bytes);
assembly.EntryPoint.Invoke(null, new object[0]);
编译好了,但是当我运行它,它说
“计划没有水库......”
什么我尝试待办事项在exeproxy.exe 还莫名其妙的上下文中运行一个DLL没有管理员,如果这可能是一个功能某种程度上,这将是巨大的。使用以下
using System;
using System.IO;
using System.Reflection;
namespace exeproxy
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: exeproxy <exe>");
Environment.Exit(1);
}
string exe = args['0'];
byte[] bytes = File.ReadAllBytes(exe);
Assembly assembly = Assembly.Load(bytes);
assembly.EntryPoint.Invoke(null, new object[] { new string[0] });
}
}
}
有用的链接 http://www.c-sharpcorner.com/UploadFile/ajyadav123/executing-assembly-code-in-C-Sharp/
IM改变代码的Visual C++
林这可能会使使用C++或VC++看链接asm()
更有意义。 您可以使用Calc.exe来测试它是否有效;它不是关于运行.net程序。
我已经删除了汇编标签,因为它的语言不是.net汇编 –
@PawełŁukasik:有一个'.net-assembly'标签可以使用。 –
@MichaelPetch thx,下次还会添加 –