Thread: Including Text In Your Executable

  1. #1
    Adamant Programmer Axpen's Avatar
    Join Date
    Jun 2003
    Location
    USA
    Posts
    42

    Including Text In Your Executable

    Ok i've officially searched the boards and now know theres nothing relevant to this on cprogramming.com, and im not sure enough how to word what it is im looking for to get relevant results from google.

    My problem is I wish to make my own sort of installer, not nessecerily Win32 specific, since the implementation should be relatively OS neutral in theory. My problem is just this, how do installers put the files including other executables into 1 file, it would be EASY to have a parser executable then have an archive that holds all the data, but this isnt exactly feasable when you want a single installer.exe.

    What I want to know is how you insert binary data irrelevant to the executables operation into your exe file. I am pretty sure you cant just tack it on the end with some signifying code to identify it, or can you? Now I know DLL's would do it, but thats defeating the purpose once again since all installers dont have an exe and a dll.

    Any help on how to include the files to be installed in the single file would be great, thanks,
    Alex
    The Man With 3 Ears::Oh no better get the huskers

    Download Helppc by David Jurgens, It's a FANTASTIC Reference!!!

    In Case I Forget I Have:
    Windows XP
    For My 32-bit Questions:
    Dev C++ (mainly just use its mingw)
    For My 16-bit Questions:
    Borland Turbo C++ 1.01

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Maybe something like
    Code:
    free installer cross-platform windows linux
    keywords for google.

    Link: here.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Adamant Programmer Axpen's Avatar
    Join Date
    Jun 2003
    Location
    USA
    Posts
    42
    Yeah I know about already made ones, my question is how to include text or binary in your executable and still have it run, ie I know you cant just add it to then end and expect it to still run.

    Well actually I take that back I added ABC to the end of the executable, IE literally 0x41 0x42 0x43, using a hex editor. It still ran, making my computer freeze and crash the first time, but thats been happening without even running the program, so just running the exe may have triggered it without any sort of conflict cause by the ``invalid insertion''.

    Now lets say this really works without any sort of trouble, my 2 questions are, is the behavior considered undefined my computer proffessors, is it considered bad practice to just ``tack on'' bytes to the end of an executable? My other question is just this, does this actually work in practice, could I expect this to work on a linux machine, mac and windows without crashing?

    I guess really this topic has little to do with help on installation programs, as the title states, I just want to know if its considered bad practice with undefined behavior to do this adding of bytes after an executables last byte?

    If this works ultimately I want to make a program that adds files after an executable and at the last byte/s (depending on how big the files are) have a size counter, and have my program read up the file that many bytes. The executable that the files are injected into will preform these operations on its self and add the files to your computer and do registry stuff according to the commands and files tacked on to the exe. This will effectively make it an installation file by the fact that all its stuff is in 1 file.

    Anywho any help will be appriciated,
    Alex
    The Man With 3 Ears::Oh no better get the huskers

    Download Helppc by David Jurgens, It's a FANTASTIC Reference!!!

    In Case I Forget I Have:
    Windows XP
    For My 32-bit Questions:
    Dev C++ (mainly just use its mingw)
    For My 16-bit Questions:
    Borland Turbo C++ 1.01

  4. #4

  5. #5
    Prying open my third eye.
    Join Date
    Jun 2005
    Posts
    45
    Great question. I was just thinking about this myself the other day.
    "So you're one of those condescending UNIX computer users?"

    "Here's a nickel, kid. Get yourself a better computer."

  6. #6
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Well, I suppose you could simply create a variable that stores the contents of that file as text, or as an array, or whatever, and that is initialized when it is created, then have your exe create a new file and write that variable to the newly created file. Although, this can't be how professionals do it cause that would consume an abhorrent amount of memory, both in the exe file, and the running of it. But if you've only got a few small files to install, I suppose it would work.
    Code:
    void function(void)
     {
      function();
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My text doesn't display
    By joeprogrammer in forum Game Programming
    Replies: 11
    Last Post: 02-23-2006, 10:01 PM
  2. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  3. Text positioning and Text scrolling
    By RealityFusion in forum C++ Programming
    Replies: 3
    Last Post: 08-13-2004, 12:35 AM
  4. Scrolling The Text
    By GaPe in forum C Programming
    Replies: 3
    Last Post: 07-14-2002, 04:33 PM
  5. Replies: 1
    Last Post: 07-13-2002, 05:45 PM