Extract an executable from resources? [solved]

Posts 16 of 6 · Page 1 of 1
Extract an executable from resources? [solved]
I have been googling for about 2 days now but still no results. I am just wondering how to extract a executable file from your programs resources.
Please and thank you
What do you mean by extracting ? You want to know which files in your resources are executables and write them ?

If writing an executable is the purpose, here's how you do it:
[highlight=vbnet]
My.Computer.FileSystem.WriteAllBytes(My.Computer.F ileSystem.SpecialDirectories.Desktop & "\MP3Test.exe", My.Resources.MP3Tests, False)[/highlight]
Just check the datatype of the resource; it's a byte array. The IO namespace provides byte-writing abilities through the File class:

[highlight=vb.net]
IO.File.WriteAllBytes("Path Here", My.Resources.ResourceName)
[/highlight]
Thank you both I have no idea why such a simple code was so hard to find
you could also execute the byte array in memory
Quote Originally Posted by NOOB View Post
you could also execute the byte array in memory
Depends on the aims of the program. If the .exe is really only a dependency to be quickly executed, then sure that's a viable option, but too much work fixing import tables to really be worth the effort IMO. If this is aimed to be a pseudo-installer, then writing the bytes to the filesystem is what you should be going for.
Posts 16 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?