Writing 32/64-bit specific registry key at the end of the installation in Inno Setup

后端 未结 1 877
渐次进展
渐次进展 2021-01-06 05:04

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

相关标签:
1条回答
  • 2021-01-06 05:24

    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;
    
    0 讨论(0)
提交回复
热议问题