3

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!

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Dennosaur
  • 65
  • 5

2 Answers2

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).

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • 1
    Great and very simple idea! Thank you! P.S. I'm already recompile ISCmplr.dll from github sources. Dll succesfully compiled, but doesn't work properly(( Now I go to try use batch file for rewriting VersionInfo and signing an uninstaller. Thank you again)! – Dennosaur Nov 22 '17 at 13:54
  • Here is similar question without answer: https://stackoverflow.com/questions/1885948/in-inno-setup-how-to-set-the-unins000-exe-with-product-name-product-version-and Can you answer this question too, or can I copy paste your answer there? – Eugene Mala Nov 24 '17 at 06:44
  • @EugeneMala Thanks for pointing this out. I've marked that question as a duplicate of this one. – Martin Prikryl Nov 24 '17 at 07:00
  • OK, I see. I use this technique to [change binary flags](https://stackoverflow.com/a/29072495/850848). And that works. Possibly an EXE file header is not included into the test. – Martin Prikryl Nov 30 '17 at 08:02
0

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.

Eugene Mala
  • 1,081
  • 12
  • 25