I want to create an installer with Inno Setup, my first time using this tool.
What I’m trying to do is wrapping an existing installer of an existing software with a more detailed self-made installer (meaning a Setup.exe inside a Setup.exe).
What works for me after researching so far is asking the installer (Inno Setup *.exe) to run the included installer (actual software setup).
Why do I need another installer wrapped around? Because I want to give it some extra functions.
On particular thing is: I want to add a registry-key at the end of my installation, as the last step, fitting for relevant bit-system (32/64-bit). And here is where I'm asking expert-help, please. (main concern)
My problems in detail are as follows:
- I managed to add the key using the
[Registry]
section of Inno Setup. However,[Registry]
seems to always run before[Run]
– but I need the key added after the installation (added in a regedit-path the installation itself creates), not before, so I deleted what already worked (just in the wrong order) under[Registry]
. For accomplishing a reg-add after the main-install, I found the two proceduresAfterInstall
andCurStepChanged
/ssPostInstall
, andDeinitializeSetup
which seems not to fit so well for my concern (but thinkingAfterInstall
would be what I'm looking for(?!) since nothing more is supposed to come after and I think it won't run, if the install before already failed (?!). - I don't know the Pascal-Syntax for adding a registry-key (string) under an existing path. I could add it under
[Registry]
, however when it comes to the[Code]
-section I feel a little lost even I did a lot of research by now about Inno Setup given functions and such. - Third problem is that the path in the registry differs, depending on whether it's 32- or 64-bit System. So I actually need an extra query here checking the bit-System before adding either one or another path/key (because the install of the program itself creates the path depending on the bit-version already), I found the function
IsWin64
(Boolean), now trying to mix a function (bit-version-query) with a procedure (AfterInstall
) sounds even for me as a beginner wrong. Plus I tried to create an if-else-query, and the compiler told me I was doing it wrong.if IsWin64 then...
works, but adding an else doesn't.
So the solution in theory would roughly be something like…
procedure MyAfterInstall();
function IsWin64: Boolean;
if 64-bit Reg-Add HKLM\SOFTWARE\Wow6432Node\A
else Reg-Add HKLM\SOFTWARE\B
Sorry for not having to offer you more. I am not usually coding.
If relevant, that's what I have in my code-section so far:
[Code]
procedure DeinitializeSetup();
begin
RegWriteStringValue(
HKEY_LOCAL_MACHINE, 'SOFTWARE\Wow6432Node\A', 'ConnectionString ', 'Data Source=Test;');
end;
Reason why I used DeinitializeSetup
was because it's one thing that worked for me so far, however I know that this function is called even if the user exits setup before anything is installed, which is not so good. I am running this after the install because the software-installation itself creates the path I want to add the key to, it makes no sense to have the key while the software install failed… Maybe there is a better way for that, too.
Apologies for many words, and thanks in advance for any help.
HKLM\SOFTWARE\Wow6432Node\A
vsReg-Add HKLM\SOFTWARE\B
or ratherReg-Add HKLM\SOFTWARE\A
? I.e. is the only difference theWow6432Node
or is the actual key path end different too? – Martin Prikryl