Embedding an exe with your program

Share your advanced PureBasic knowledge/code with the community.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Embedding an exe with your program

Post by Mistrel »

There are a few posts on this but I didn't find any of them to be very clear. Here is a simple example of how to embed an exe with your program and how to run it.

Code: Select all

If OpenFile(1,"File.exe")
  WriteData(1,?File,?FileEnd-?File)
  CloseFile(1)
EndIf

DataSection
  File:
  IncludeBinary "File.exe"
  FileEnd: 
EndDataSection

RunProgram("File.exe")
npath
User
User
Posts: 74
Joined: Tue Feb 15, 2005 5:15 pm

Post by npath »

This is very useful information. I will definitely use it in my projects. Thanks.

npath
superadnim
Enthusiast
Enthusiast
Posts: 480
Joined: Thu Jul 27, 2006 4:06 am

Post by superadnim »

You could do this from memory, given the platform is win2000+
Meaning, no temporary files (faster since you avoid disk io).

Running from memory is what exe packers do. I don't know if theres any 9x methods though.

It's quite clear if you understand the API behind it.
Post Reply