Results 1 to 9 of 9

Thread: create personalized binary without having to recompile

  1. #1
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default create personalized binary without having to recompile

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create personalized binary without having to recompile

    Why not put the personalized data in a separate file, with a generic format?
    The application can read the data from that file.

  3. #3
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create personalized binary without having to recompile

    I would like to provide a single-exe the user just has to start
    (no installer, no zip-file to extract, just one exe)

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: create personalized binary without having to recompile

    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...

  5. The following user says thank you to wysota for this useful post:

    niko (5th October 2007)

  6. #5
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create personalized binary without having to recompile

    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

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create personalized binary without having to recompile

    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.

  8. The following user says thank you to jacek for this useful post:

    niko (6th October 2007)

  9. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: create personalized binary without having to recompile

    Or you can call upx on the resulting executable after substituting the block.

  10. #8
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: create personalized binary without having to recompile

    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.

  11. #9
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: create personalized binary without having to recompile

    much thanks for those tips!!

    niko

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.