Notifications
Clear all

[Closed] dotnet running exe file in a stream memory,possible?

Hi,
I am now working a project need to read exe file into memory(buffer) and then running it in memory directly,is that possible to do it via maxscript?
I found an example for c#
http://www.codeproject.com/Articles/13897/Load-an-EXE-File-and-Run-It-from-Memory

After I searched forum,I found this code wolud work for read exe file into memory stream,for example,running notepad in buffer:

exe_path = "C:\\Windows\
otepad.exe"
exe_stream = (dotNetClass "System.io.file").open exe_path (dotnetClass "system.io.filemode").open
exe_buffer = dotnetobject "System.Byte[]" 200000
exe_read = (exe_stream.GetType()).GetMethod "Read"
exe_read.invoke exe_stream #(exe_buffer, 0, exe_buffer.Length)
--then here, how to run exe directly in the buffer?

2 Replies

This is possible, but only if the exe you want to run is an actual .net exe. This means it won’t work with notepad.exe for instance. It’s a bit elaborate so I’ve written an article on my blog about it. Go check it out: http://www.klaasnienhuis.nl/2015/12/execute-net-assembly-from-memory-in-3ds-max/

1 Reply
(@momo2012)
Joined: 11 months ago

Posts: 0

Thanks for take too much time to answer this question,this article help me a lot!!!