Archived

This topic is now archived and is closed to further replies.

Neosmyle

Spawning a new exe after compile?

Recommended Posts

I was wondering about the technique for "spawning" a new exe with a different file or something. An example - a "self-extracting zip file", that you can create with winzip, and it is an exe that will open the file that you hardcore into it. Understand what I''m saying? I''m not quite sure how yet, but I think this might have a use in some of my projects. Thanks.

Share this post


Link to post
Share on other sites
Are you saying that you want to launch a program from within another program? To do that, use ShellExecute() or CreateProcess().

If you mean creating a new .exe file, try CopyFile(), CreateFile() or a whole bunch of other functions.

Is that what you mean?

Share this post


Link to post
Share on other sites
An exe file is just like an other file, it has a header and a data section (the machine code) theres nothing speical about it, all youd have to do is attach the exe as a resource to the end of your self extracting prog then get the offset for the start of it, theres probly some win32 functions to do this, then just read it in and then write it back to disk seperatly...

CEO Platoon Studios

Share this post


Link to post
Share on other sites
Yes, I know about exe''s, they have header/data, but I''m wondering about how to create the exe with a file attached to it (self-extracting zip file type thing). I will probably have to debug decompile to figure it all out

Share this post


Link to post
Share on other sites
To create an exe with a file attached to it, just literally do that. Open the exe file and write the data at the end.

You''ll have to store the data length somewhere (at the very end seems to be a good place), but that''s about it.

Share this post


Link to post
Share on other sites