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
To execute a code after an installation finishes, use the CurStepChanged event function and check for CurStep = ssPostInstall
.
As Inno Setup is 32-bit application, by default it automatically gets redirected to the Wow6432Node on 64-bit systems. No need to do that explicitly. So if the Wow6432Node
is the only difference between the 32-bit and 64-bit path, you do not to do anything special:
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
Log('Installation finished, writing connection string');
RegWriteStringValue(
HKEY_LOCAL_MACHINE, 'SOFTWARE\A', 'ConnectionString', 'Data Source=Test;');
end;
end;
Of course, unless you use 64-bit installation mode.
See also: Writing 32/64-bit specific registry key in Inno Setup.
If the key path really differs, use the IsWin64 function:
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
if IsWin64 then
begin
Log('Installation finished, writing 64-bit connection string');
RegWriteStringValue(
HKEY_LOCAL_MACHINE, 'SOFTWARE\A', 'ConnectionString', 'Data Source=Test;');
end
else
begin
Log('Installation finished, writing 32-bit connection string');
RegWriteStringValue(
HKEY_LOCAL_MACHINE, 'SOFTWARE\B', 'ConnectionString', 'Data Source=Test;');
end;
end;
end;