PDA

View Full Version : create personalized binary without having to recompile



niko
5th October 2007, 08:26
Hello,

I would like to create personalized compiled application - which should be a single-exe-file on windows, and a single application-bundle on mac.
The user should download the file through http - and the webserver should personalize the file for every use - without having to compile the application every time.

Is there a possibility to have somewhere in the binary some "space" where I can place such user-data without corrupting the binary? When running the binary it could open itself and get the personalized data out of it.

thanks,
niko

marcel
5th October 2007, 08:31
Why not put the personalized data in a separate file, with a generic format?
The application can read the data from that file.

niko
5th October 2007, 09:47
I would like to provide a single-exe the user just has to start
(no installer, no zip-file to extract, just one exe)

wysota
5th October 2007, 15:32
You can place a static const char* buffer in the application. Then after the compilation simply find the buffer in memory and replace that part of file with something else when you need it. Should work fine...

niko
5th October 2007, 20:26
thanks, I will try that!

however it won't work when packing the executable using UPX (to get a smaller download-filesize)
any ideas for that case?

niko

jacek
5th October 2007, 20:48
You could write something similar to UPX, that will take the executable and the data and combine them into a new executable, that loads the data into memory and starts the original application.

wysota
5th October 2007, 21:03
Or you can call upx on the resulting executable after substituting the block.

Brandybuck
6th October 2007, 01:51
Some installers are scriptable. You could generate the installer on the fly when the user requests the download. I know of a few companies that "inject" personal license keys this way.

niko
6th October 2007, 12:20
much thanks for those tips!!

niko