Resource files (.RES) accept any kind of binary files but if it is an exe file how can I run it?
-
4A lot of malware does it. What is your reason to work that way insted of using the polite way of an installer/uninstaller? When your software runs on someone's else machine, it should be well-behaved.user160694– user1606942011-05-23 07:24:09 +00:00Commented May 23, 2011 at 7:24
-
Interesting observation... what happened to the OP?Vector– Vector2011-05-24 02:10:16 +00:00Commented May 24, 2011 at 2:10
-
I would use it to extract a app updater to update my application from a remote server, then the new application would delete it the next execution.NaN– NaN2013-08-22 20:19:05 +00:00Commented Aug 22, 2013 at 20:19
4 Answers
You would have to extract it as a file to disk and execute it.
Although you don't have to extract it to disk, as Cosmin Prund says in a comment, if you don't it requires a lot of hard work.
4 Comments
Take a look at this memory execution unit.It allows you to execute an exe from memory without dumping it on disk.
3 Comments
TResourceStream (delphidabbler.com/articles?article=3) and you will only need to change the FileToBytes function (probably rename it too so the name suggests its purpose, maybe ResourceToBytes?).Yes it is possible. There is a Delphi library to do this somewhere on the web, but I cannot for the life of me remember what it's called. It allows you to execute a normal exe file no-matter where it is in memory. So you can load it into a stream, or just embed it in a resource.
I realize that my reply is a bit depressing since i dont remember the name of the library, but at least you now know that it can be done. If you google around for "execute PE exe from memory" and "Delphi" then I'm sure you will find it.
Comments
You might want to take a look at Orean's XBundler: http://www.oreans.com/xbundler.php
I use their licensing product (WinLicense) and have been very happy with the product, their support, responsiveness and updates.
In fact, I'm about to buy XBundler so I can ship a dll securely embedded in my exe.
Tom