Inno Setup - How to change the icon of the shortcut of uninstaller without separate icon file?

这一生的挚爱 提交于 2021-02-07 10:30:13

问题


Is it possible to change the icon of the uninstaller shortcut in the Start menu without storing a separate icon file (to the app folder)?

I see this: Using Resource Hacker for changing the icon after the build, but I cannot implement it.

My code:

[Icons]
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}

回答1:


An icon of a Windows shell shortcut can be set by an external icon file (what you do not want) or by the file the shortcut points to. So you have to modify the icon of the uninstaller.


You have to modify the uninstaller icon on a compile time.

You cannot do this on install time, as the uninstaller includes its own checksum. If you modify the uninstaller, it with refuse to start, claiming it is corrupted. Unless you find out how to also fix the checksum stored in the uninstaller.


But Inno Setup does not really allow modifying the uninstaller icon on a compile time.

What you can do, is to abuse the SignTool "callback". The command set to SignTool processes even the uninstaller. And it can actually do anything with the uninstaller, 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 icon (e.g. using Resource Hacker command-line).

For an example of such batch file that both modify the uninstaller and signs it, see Microsoft SmartScreen - suspended using Inno Setup installer?

So this is doable, only if you do code signing (what you should anyway). You need a code signing certificate for that.


Disclaimer: Adding a shortcut to an uninstaller to Start menu is against Windows guidelines (and creating Start menu groups is against Windows guidelines for Windows 8 and above at least).



来源:https://stackoverflow.com/questions/44522001/inno-setup-how-to-change-the-icon-of-the-shortcut-of-uninstaller-without-separ

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!