Can you make a basic installer package that runs under the console, and not under windows???
Printable View
Can you make a basic installer package that runs under the console, and not under windows???
If you find out, tell me PLEASE. Even if the answer is for Windows, please tell me if you get the chance.
Thank you.
I have absolutely NO idea how installer programs work.
The only way I can imagine is to make the app and read it into an array in your installer. I havent tried this but it seems logical.
Unless there is some way to acually append dataonto your actual application.
I think installers just do any pre-run stuff that needs doing. Such as, for example, copying the files to the appropriate location (files might be stored in an archive file format, so it would also decompress them), adding a registry key pointing to the program directory, or whatever else might need doing. So your 'installer' could simply be (ignoring security risks):
If you're talking about the flashy "InstallShield" thing, MSVC Pro (not sure bout standard and others) comes with "InstallShield Wizard for MSVC", supposedly you can make installers with it.Code:system("copy myprog.arc c:\\MyProg\\myprog.exe");
Hunter are you saying you can access your executable while its in use?
I think the main question was how do you make an application that stores a separate application within it. So theres one .exe that puts an .exe and other files into a folder.
What I'm getting is you'll have at least two files
program.exe, the actual program you want to install
install.exe, a program which copies 'program.exe' to a specifed location (see hunter's post)
I'm sure there's a way to do it.. after all, self-extracting zips do it :) I'll run a quick test though..Quote:
I think the main question was how do you make an application that stores a separate application within it. So theres one .exe that puts an .exe and other files into a folder.
Is it possible that the installer simply hold all resource files and source files, then compiles them, and places them into the directory, while copying the other needed files into the said directories?
Installer programs which are not console based simply insert the files they want to install as resources in their programs. Then they can use the resource API functions to extract the resources from the .exe and use them as they see fit.
As a console application, you cant use resources. In this case, you need to pad the end of your .exe with the files that you want to install. Then from your .exe you open up your .exe for reading only. Then you fseek() to the end of your executable code, where the start of your padding is. Here you read the padded installation files and write them to where ever you want on the hard drive. This method is a little trickier than the resource method, because you need to know beforehand how far to seek into the file. Either way though, it's not that hard.
Thats what i was thinking.. BUT couldint you store them into buffers in your program. Seems alot simpler.
It wouldnt be easier. Since the files are most likely binary, how would you input that into a buffer? There would be a lot of escape characters needed there.
Couldnt you read in the executable byte by byte into an unsigned char array? Maybe im confusing myself...
You could, but how would that help? Remember that the goal is to have all the installation files within a single executable. Its possible that maybe I'm not understanding what you are getting at here. Could you give a small example of what you mean to ensure we are on the same page?
Welcome to the world of OpenSource
NSIS
Wel the more I thought it out.. the more i realized it would be extremely difficult. So mevermind :DQuote:
Originally Posted by bithub
I wasnt thnking it all out. But your right bith
>> Couldnt you read in the executable byte by byte into an unsigned char array? <<
Someone's already written this utility for you. This program will convert a binary file to a C data array declaration.
sweet
The self-extractors I've seen simply append the data to the end of the file.
You know how you have sections like .rsrc, .text, .code?
Well if you look at a WinZip SFX, you'll se another section called "_winzip_"
If you disassemble that SFX, you'll find that the _winzip_ section is simply a database that holds the zip file.
This is quite similar to the xd application posted above, but it puts the data in a different section.
Hm, perhaps you could even pre-pend the data, if you write a program that will modify the executable file header to specify the application entry point at a later offset, and then stick the archived files in front of the executable code. Not sure exactly how the executable file is structured, but I took a quick look at www.wotsit.org under MS's exe docs, and it does seem that there's a 'entry point offset' part in the file header.
Just use InstallShield and setup your project inside of it. All of this has already been done for you. No sense in re-inventing the wheel.
Unless I'm mistaken, the cheapest version of installshield is around $400. For that price I will gladly re-invent the wheel.
ARG!
http://nsis.sourceforge.net/
Go get NSIS! It's a FREE install file creator that you can customize incredibly. It's easy to use, and quite a few people use it (You'll occasionally see an installer with NSIS v2.01 or something like that at the bottom, made with NSIS!)
>>Unless I'm mistaken, the cheapest version of installshield is around $400.
MSVC 6 pro came with it a few years ago, I got the whole package for $160 canadian (academic pricing).