Execute file in resourses folder without copying it to disk
I have an executable file in the resources folder. I am able to run that file by writing it to the disk then locating the file and use the Process.开发者_开发技巧Start method to run the executable. Here is an example of how I do this:
How can I execute the file without writing it to the disk. Is there a way I can execute the file from memory? Or maybe execute it directly from the resources folder?
You can't. One of the very hard requirements of Windows, an executable must exist on disk. It is fundamental to its architecture. Slowing down the malware authors is a happy side-effect. Google "memory mapped file" if you want to learn more about it.
If it's a .NET exe try Assembly.Load(byte[])
. Be wary of CAS though.
精彩评论