Software Development Network>> VS Express Editions>> How to Run exe from memory or stream ?
You can use something like this
{
stream.Read(asm, 0, asm.Length);
mi.Invoke(
}
provided your exe is in COFF
hi,
i'm not sure from this but give it a try
1) right click your project name in solution explorer and select properties
2)select resources Tab and from the top of this page select (Add resources/existing file) select your exe / open
3) go to solution exploere / expand resources node right click your exe and select properties , from build Action select embeded resources
4) in solution explorer right click your project again and select Add reference, go to browse tab , select your exe again
now you can deal with your exe as you deal with other classes , for example MyexeNameSpace.Form1 f = new MyexeNameSpace.Form1();
f.show();
it will run the form but the exe will not appear in the output folder
hope this helps
How to Run exe from memory or stream ?
Said
You can use something like this
Program p = new Program(); string[] arr=p.GetType().Assembly.GetManifestResourceNames(); foreach (string s in arr){
Stream stream=p.GetType().Assembly.GetManifestResourceStream(s); byte[] asm = new byte[stream.Length];stream.Read(asm, 0, asm.Length);
Console.WriteLine(asm.Length); Assembly a=Assembly.Load(asm); MethodInfo mi = a.EntryPoint;mi.Invoke(
null, null); Console.WriteLine(s);}
Console.ReadLine();provided your exe is in COFF
ilsandor
hi,
i'm not sure from this but give it a try
1) right click your project name in solution explorer and select properties
2)select resources Tab and from the top of this page select (Add resources/existing file) select your exe / open
3) go to solution exploere / expand resources node right click your exe and select properties , from build Action select embeded resources
4) in solution explorer right click your project again and select Add reference, go to browse tab , select your exe again
now you can deal with your exe as you deal with other classes , for example MyexeNameSpace.Form1 f = new MyexeNameSpace.Form1();
f.show();
it will run the form but the exe will not appear in the output folder
hope this helps