Wix 安装程序在修复时清除注册表设置 [英] Wix installer blanks out registry setting when repairing

查看:23
本文介绍了Wix 安装程序在修复时清除注册表设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我已经自定义了 Wix_InstallDirDlg 以允许用户在安装时设置注册表项.在 InstallDirDlg 和 MaintenanceTypeDlg 之后显示一个自定义对话框,以便它同时满足安装和修复方案.

Currently I have customised the Wix_InstallDirDlg to enable the user to set a registry key on install. There is a custom dialog that is shown after both the InstallDirDlg and the MaintenanceTypeDlg so that it caters for both install and repair scenarios.

自定义对话框有一个链接到属性的文本框.此属性具有注册表搜索功能,以便在用户修复或升级时保留先前的值,并因此显示在自定义对话框中以供用户验证.该对话框在安装时运行良好,并创建了注册表项.但是修复时,自定义对话框出现,输入正确的注册表值(因此 RegistrySearch 正在工作),但修复完成后,键值为空.

The custom dialog has a single textbox that is linked to a property. This property has a registry search so that if the user repairs or upgrades the previous value is preserved and therefore shown in the custom dialog for the user to validate. The dialog works fine on install and the registry key is created. However when repairing, the custom dialog appears with the correct registry value entered (so the RegistrySearch is working), but when the repair is completed, the key value is blank.

<Property Id='SERVER_LISTEN_URL'>
          <RegistrySearch Id='ServerListenUrlRegSearch' Root='HKLM'
                          Key='SOFTWARE\$(var.Manufacturer)\$(var.Name)'
                          Name='ServerListenUrl'
                          Type='raw' Win64='no' />
        </Property>

<Component Id="RegistryEntries" Guid="0234974B-6158-4312-90A7-56869809B42E">
        <RegistryKey Id="ServerRegKey"
              Root="HKLM"
              Key='SOFTWARE\$(var.Manufacturer)\$(var.Name)'
              Action='createAndRemoveOnUninstall'>
          <RegistryValue Id="ServerListenUrlRegVal"
                         Name='ServerListenUrl'
                         Value='[SERVER_LISTEN_URL]'
                         KeyPath='yes'
                         Type='string' />
        </RegistryKey>
</Component>

<Dialog Id="SettingsDlg">
    <Control Id="ListenUrl" Type="Edit" X="20" Y="100" Width="320" Height="18" Property="SERVER_LISTEN_URL" Indirect="no" />
</Dialog>

我做错了什么?

推荐答案

我在发布后立即设法自己解决了这个问题.我花了差不多一天的时间来尝试解决这个问题,所以希望这会减轻一些痛苦.您需要做的就是将属性更改为安全属性.

I managed to work out this myself straight after I posted. I spent pretty much a day on trying to work out this so hopefully this will save some pain. All you need to do is change the property to a secure property.

<Property Id='SERVER_LISTEN_URL' Secure='yes'>
      <RegistrySearch Id='ServerListenUrlRegSearch' Root='HKLM'
                      Key='SOFTWARE\$(var.Manufacturer)\$(var.Name)'
                      Name='ServerListenUrl'
                      Type='raw' Win64='no' />
</Property>

这篇关于Wix 安装程序在修复时清除注册表设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆