- NSIS Discussion
- Append file to already created NSIS executable?
Archive: Append file to already created NSIS executable?
seattledev
11th February 2010 06:49 UTC
Append file to already created NSIS executable?
Hi all,
I have tried searching everywhere and have had no luck so far. My problem is that I create a general installer executable with NSIS that contains several megabytes worth of files and directories, then I later have to customize a file for each specific user that must be packaged in with the executable (the users are not known at the time the general executable is created). So, I need to append this new file to the already created executable. Because this file gets customized when the user requests the installer, it would take way too long to recreate the entire executable with this customized file.
Does anyone know if it is possible to append / package a file to an already created executable?
I really appreciate your help in advance!
CG!
11th February 2010 11:33 UTC
if you disable the CRC check for your installer and if you put a dummy file in the script, you can open the installer with 7zip and edit it's contents.
Never tryed, but should work.
pengyou
11th February 2010 15:20 UTC
The wiki shows how to customize installers by adding some data to the installer after it has been compiled:
http://nsis.sourceforge.net/ReadCustomerData
seattledev
12th February 2010 22:08 UTC
Thanks a lot of your replies! I'll be trying your suggestions this weekend and will let you know how it goes!
seattledev
26th February 2010 19:50 UTC
Hi all -- I've been busy with exams and projects, so I finally had some time to work on this more, and unfortunately neither of these solutions have worked for me....
I tried disabling the CRCCheck (CRCCheck off) and opening the executable with 7zip, but after I modify my dummy file and 7zip tries to update the archive, it says the archive cannot be updated. So, the dummy file never gets changed within the executable. I don't think this has anything to do with CRCCheck because I believe CRCCheck is a runtime check.
I also tried looking at the tutorial at http://nsis.sourceforge.net/ReadCustomerData , but this is not exactly what I am looking for. ReadCustomerData is for appending data to the end of the executable, whereas I need to modify a file within the executable. Also, ReadCustomerData only seems to demonstrate how to read the appended information without actually demonstrating how to append data to the end of the executable (which isn't what I need anyway).
I'd appreciate it if you have any more suggestions!
Thanks-
Joel
26th February 2010 20:02 UTC
How about:
1) Create your installer, called nsi.exe
2) Create a file.list, which contains files to install.
3) This files, from what I'm reading, must be outside of nsi.exe
4) Add your files in the same folder where is nsi.exe, nsi.exe will read file.list file which contains the files, which are external.
easy?
pengyou
26th February 2010 20:29 UTC
I also tried looking at the tutorial at http://nsis.sourceforge.net/ReadCustomerData , but this is not exactly what I am looking for
How big is this file which you have to customize for each installer?
Although the example only shows some text being added at the end of the file, you could modify the code to make your installer extract the customized file from the end of the installer and store it in the required location.
CG!
26th February 2010 21:13 UTC
The file, you need to customize, isn't it in plain text?
if yes, there must be a way to edit it after installation using an NSiS plugin.
Or maybe one of windows APi's does what you need. Check the MSDN and the NSiS doc's for examples.
Or do what i do, if the NSiS solution is more complicated then using another programing language and just use another programing language that fullfills your needs by starting it after an successfull installation.
Used such a solution once to alter file dates to create a load order for some FO3 mods and to install them in an eventually existing FOMM installation.
Had to alter a plain text file as well, called Archiveinvalidation.txt if another program wasn't installed. in this case, NSiS possibilities was more than enough and easy realized.