Inno Setup uninstaller VersionInfo

2020-03-04 09:07发布

问题:

I use Inno Setup for my installers. I have a problem with VersionInfo inside unins000.exe. For filling VersionInfo in installer I used directives AppPublisher, AppCopyright and etc. But it doesn't affect setup uninstaller unins000.exe.

Google and help doesn't know anything about this issue. I investigated Inno Setup sources and found appending VersionInfo just for setup file:

        { Update version info }
        AddStatus(SCompilerStatusUpdatingVersionInfo);
        UpdateVersionInfo(ExeFile, VersionInfoVersion, VersionInfoProductVersion, VersionInfoCompany,
          VersionInfoDescription, VersionInfoTextVersion,
          VersionInfoCopyright, VersionInfoProductName, VersionInfoProductTextVersion);

        { For some reason, on Win95 the date/time of the EXE sometimes
          doesn't get updated after it's been written to so it has to
          manually set it. (I don't get it!!) }
        UpdateTimeStamp(ExeFile.Handle);
      finally
        ExeFile.Free;
      end;
    end;

    { Sign }
    if SignTools.Count > 0 then begin
      AddStatus(SCompilerStatusSigningSetup);
      Sign(ExeFileName);
    end;
  except
    EmptyOutputDir(False);
    raise;
  end;

But I can't found this routines in uninstaller compile code.

Anybody know, is possible place version info to unins000.exe?

Thank you!

回答1:

Inno Setup does not support this.

You would have to modify the version info yourself on compile time.

Imo, the only way to access the uninstaller executable before it is linked into the installer is to abuse the SignTool "callback". The command set to SignTool can actually do anything with the executable, not only "sign" it. But it has to "sign" it in any case (Inno Setup explicitly checks that the executable was signed after the "tool" finishes).

You can achieve that by setting SignTool to a batch file (or other script) that will run the actual signtool.exe in the end, but before that, it will modify the version info (e.g. using Resource Hacker command-line).



回答2:

Unfortunately, the accepted solution does not work, because the SignTool "callback" can not be abused in this way. Digging into Inno Setup sources, I found that the compiler uses the following verification after signing uninstall executable:

  { Sanity check: Remove the signature (in memory) and verify that
    the signed file is identical byte-for-byte to the original }

I found a quick solution for the problem. Inno Setup uses Setup.e32 file as a template for uninst000.exe.

As Inno Setup is completely portable - you can maintain a separate copy of Inno Setup binaries folder (default is %ProgramFiles%\Inno Setup 5\) for each project that needs to have the custom version info in the uninstaller.

You have to modify the version info of Setup.e32 file in each copy of Inno Setup binaries.



标签: inno-setup