I have a complicated situation.
There is a downloadable link to my installer on the web.
Before anyone downloads the installer they have to fill out a form in the browser.
I would like to save the information filled out in the form in the installer itself.
How could I accomplish this?
*Compiling the installer on the server each time anyone fills out the form is not an option because the installer is very heavy and this process would take a lot of time.
*Creating the form in the installer is not an option.
*I only need to save a single number in my executable.
标签:
inno-setup
相关问题
- Inno Setup - Run InstallUtil from .Net 4.5 Locatio
- ISCC - /D compiler-parameter seems to have no effe
- Setting DestDir from Inno Pascal?
- Unpin app from taskbar, startmenu using Inno Setup
- How to restrict user input of the directory edit b
相关文章
- In inno setup how to set the unins000.exe with pro
- Is it possible to create checkbox tree view in Inn
- How to add a region drop-down in Inno Setup?
- Signing installer of my program generated by Inno
- How to check 64/32-bit in Inno setup
- Inno Setup - How to create checkboxes at finished
- Inno Setup - BorderIcons dropdown menu
- Inno Setup - How to display a message after instal
Its an interesting question. I'm with TLama on this one. When the installer is already build, your only chance is to modify the application / executable resources.
A tool like ResourceHacker might help in automating this task. http://angusj.com/resourcehacker/resource_hacker.zip
On the server-side you might use PHP to accept the form data and then forward them to ResourceHacker executed with wine and from PHP, e.g.:
exec("wine ResourceHacker.exe -script ScriptFile");
.You have some options on how to pass the data from the form to ResourceHacker: cli argument, from a file, etc. For automation on server-side, i suggest to use a ScriptFile.
A
ScriptFile
could start like...In order to find the element to change, you can use the ResourceHacker GUI on a Windows system and play around until it works, then alter the script for automation on the server-side accordingly.
Ok, after explaining how to modify a resource in general lets go into details:
Like i pointed out, its also possible to use a language string for this and change it, but i will give step-by-step instructions for inserting a new field in the VERSION_INFO section of an executable. For testing purposes i work on
\innosetup\Examples\MyProg.exe
Our goal is to add a new VALUE "PrivateBuild" with kind of a serial number.
(According to https://msdn.microsoft.com/de-de/library/windows/desktop/aa381049(v=vs.85).aspx, there is also "Comments" and "SpecialBuild" to enter information.)
1. Extract Version Info from MyProg.exe into VersionInfo.rc
ResourceHacker.exe -extract MyProg.exe, VersionInfo.rc, versioninfo,,
The content of
VersionInfo.rc
looks like this:2. Modify Version Info
We add the following line to
VersionInfo.rc
VALUE "PrivateBuild", "123-123-123"
(Later: modify the file with PHP. Probably preg_match for the line containing ProductVersion and append a new line followed by the value line.)
The new content of VersionInfo.rc looks like this:
3. Compile VersionInfo
windres -i VersionInfo.rc -o VersionInfo.res -O res
Now the VersionInfo text is a resource again.
4. Insert resource into exe
ResourceHacker.exe -script ScriptFile.rh
where
ScriptFile.rh
containsLet's check the log:
Ok... new VERSIONINFO was inserted.
5. How to use or extract the value from InnoSetup?
InnoSetup provides only a preprocessor function called GetStringFileInfo() so one can not use
#define SERIAL GetStringFileInfo("path/to/MyProgNew.exe", "PrivateBuild")
And so we have to find a workaround to access the info and that works probably using the WinAPI. Here is one way to do it, which has some room for improvement. Its written by El Sanchez over at OsZone.net.
then
GetFileVerInfo(ExpandConstant('{srcexe}'), "PrivateBuild");
6. Sign the installer
Yes, the insert will change the executable. You will have to sign it after the modification. Use an unsigned installer beforehand, then insert, then sign (on the server).
--
You can execute all steps with PHP on server-side. You need
ResourceHacker.exe
andwindres.exe
on the server andwine
for executing them.Rather than trying to hack/modify the compiled executable, how about writing whatever values from the web form that you want to include in the installer to an INI file, which you then include with your Setup.exe download as Setup.ini and use the
GetIniString
function to read these in as strings in the installer?Your INI file could be as simple as:
Alternatively, you could use either the
LoadStringFromFile
orLoadStringsFromFile
functions and any file format you want. Personally, I would go with the INI file and theGetIniString
function if you decide on this method.