Write custom string value into SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall with Inno Setup

给你一囗甜甜゛ 提交于 2021-02-19 20:59:11

问题


During installation, I'd like to write a custom string value into the automatically created registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MyApp.2020_is1

I tried to do this in the [Registry] section of my iss script but it seems to be ignored.

Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppName}.{#MyAppVersion}_is1"; ValueData: "some tag"; Flags: uninsdeletekey; ValueType: string; ValueName: "CustomTag"

Is this generally discouraged or am I missing something particular? I do have PrivilegesRequired=admin in the [Setup] section.

With the possibility to install multiple builds of my app side-by-side, I want to give the user the possibility to add a descriptive tag so that they can identify the build not only via build number but also the tag.

As I'm searching the registry for previous builds anyways, I was trying to add a custom value into the uninstall key instead of having to reference another key to find the custom tag.


回答1:


The Uninstall entry is created as one of the last steps of the installation. So also after the [Registry] section is processed. Check the Installation order. And when the entry is created, its previous contents is completely removed, including your some tag value.

As @Bill_Stewart already commented, the correct way is to use SetPreviousData/GetPreviousData.

If you really wanted to use your own custom code to write the entry, you will have to do it from Pascal Script in CurStepChanged(ssPostInstall) event (triggered after the Uninstall entry is created).


If you want to allow users to distinguish the installation, the tag must go to AppName or AppVerName or UninstallDisplayName.

If you need to allow parallel installations, the installations must have different AppId – which is a part of the uninstaller key name, so no additional tag should be needed.



来源:https://stackoverflow.com/questions/60289363/write-custom-string-value-into-software-microsoft-windows-currentversion-uninsta

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