如何指定 <SecureCustomProperties Property="PROP1;PROP2"/>在 wix .wxs 文件中 [英] How to specify <SecureCustomProperties Property="PROP1;PROP2"/> in wix .wxs file

查看:19
本文介绍了如何指定 <SecureCustomProperties Property="PROP1;PROP2"/>在 wix .wxs 文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Wix 安装程序的 wix .wxs 文件中将属性指定为受限属性.

I want to specify property as restricted property in Wix installer, in wix .wxs file.

  <Property Id="PROP1">
     <RegistrySearch Id="Prop1"
                     Root="HKLM"
                     Key="SYSTEM\CurrentControlSet\Services\mysvc"
                     Name="installers"
                     Type="raw" />
  </Property>
  <Property Id="PROP2">
     <RegistrySearch Id="Prop2"
                     Root="HKLM"
                     Key="SYSTEM\CurrentControlSet\Services\mysvc"
                     Name="DisplayName"
                     Type="raw" />
  </Property>

有什么想法吗?

想要将 PROP1PROP2 设为私有/安全.

Wanted to make PROP1, PROP2 private / secured.

尝试将它们设为小写,但 RegistrySearch 不接受:

Tried with making them as lowercase but RegistrySearch doesn't accept it:

错误 CNDL0012:Property/@Id 属性的值Prop1"不能包含小写字符.

error CNDL0012 : The Property/@Id attribute's value, 'Prop1', cannot contain lowercase characters.

由于这是一个搜索属性,它也必须是一个公共属性.这意味着 Property/@Id 值必须完全大写.

Since this is a search property, it must also be a public property. This means the Property/@Id value must be completely uppercase.

推荐答案

我相信您需要为 Property 元素设置属性 Secure="yes" 以便相关属性能够添加到 SecureCustomProperties 已编译的 MSI 文件中的列表.

I believe you need to set the attibute Secure="yes" for the Property element in order for the property in question to be added to the SecureCustomProperties list in your compiled MSI file.

示例:

<Property Id="MYPROPERTY1" Secure="yes" Value="SomeValue" /> 
<Property Id="MYPROPERTY2" Secure="yes" Value="SomeOtherValue" /> 

结果 SecureCustomProperties 编译后的 MSI 值(还有两个自动生成的属性):MYPROPERTY1;MYPROPERTY2;WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED

The resultant SecureCustomProperties value in the compiled MSI (with two auto-generated properties as well): MYPROPERTY1;MYPROPERTY2;WIX_DOWNGRADE_DETECTED;WIX_UPGRADE_DETECTED

您的案例:

因此,在您的情况下,类似于以下内容(我将属性值设置为 0,以防注册表搜索找不到任何内容 - 然后我有一个默认值):

So in your case something like the below (I set the property value to 0 in case the registry search finds nothing - then I have a default value):

<Property Id="PROP1" Secure="yes" Value="0" >
   <RegistrySearch Id="Prop1"
                   Root="HKLM"
                   Key="SYSTEM\CurrentControlSet\Services\mysvc"
                   Name="installers"
                   Type="raw" />
</Property>

SecureCustomProperties 列出所有可以发送到延迟模式的属性 - 运行提升 - 当安装用户不是管理员,而是使用提升权限安装的标准用户时.有关该问题的良好技术概述,请查看:受限制的公共属性.

The SecureCustomProperties list all the properties that can be sent to deferred mode - which runs elevated - when the installing user is not an administrator, but a standard users who is installing with elevated rights. For a good technical overview of the issue, maybe check out: Restricted Public Properties.

题外话:

现在,题外话:不久前有一个案例,我需要能够覆盖 SecureCustomProperties 出于某种原因 - 而不是让它根据所有自动生成设置了 Secure="yes" 标志的属性.

And now, the mandatory digression: there was a case a while back when I needed to be able to override the value of SecureCustomProperties myself for some reason - rather than having it auto-generated based on all the properties with the Secure="yes" flag set.

在我的生活中,我现在不记得需求背后的推理细节.也许克里斯或菲尔会记得/知道类似的案例.我认为这与 WiX 自动神奇地将属性添加到我的 MSI 相关,但它们没有设置安全,我需要使它们安全,以便在延迟模式下可靠地访问它们的值.我不记得它与哪些 WiX 功能相关.

For my life I cannot remember the particulars of the reasoning behind the need right now. Maybe Chris or Phil will remember / know of similar cases. I think it related to properties being added auto-magically to my MSI by WiX, but they were not set secured and I needed to make them secure in order to reliably access their values in deferred mode. I don't remember what WiX feature it related to.

这篇关于如何指定 &lt;SecureCustomProperties Property="PROP1;PROP2"/&gt;在 wix .wxs 文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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