我需要将二进制(REG_BINARY)注册表值复制到Wow6432节点下的注册表项。
值在HKLM \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ DigitalProductId
WiX安装程序目标是x86
机器是64位
Windows 7 64位
以下是我的WiX脚本试图进行复制的部分。注意:@ Win64 = yes,我假设它将从NON-Wow6432Node获取值。结果是安装期间出现错误消息
无法将值DigitalProductID写入密钥...验证您是否有足够的权限访问该密钥
<Property Id="PROPERTYBINARY">
<RegistrySearch Id='searchbinary'
Type='raw'
Win64='yes'
Root='HKLM'
Key='SOFTWARE\Microsoft\Windows NT\CurrentVersion'
Name='DigitalProductId'/>
</Property>
<Component Id="componentbinary" Guid="{04367CD7-B41A-4A1D-81C7-E24029FF4926}>
<RegistryValue
Id='registrykeybinary'
Root='HKLM'
Key='Software\mycompany\myapp'
Type='binary'
Name='DigitalProductId'
Value="[PROPERTYBINARY]"
KeyPath='yes'
Action='write'/>
</Component>
复制字符串(例如HKLM \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ CurrentType)可以在Wow6432Node下创建值,例如:
<Property Id="PROPERTYSTRING">
<RegistrySearch Id='searchstring'
Type='raw'
Win64='no'
Root='HKLM'
Key='SOFTWARE\Microsoft\Windows NT\CurrentVersion'
Name='CurrentType'/>
</Property>
<Component Id="componentstring" Guid='{F7231D06-DC3B-4D0F-BCBC-EDBD4DF38CA2}'>
<RegistryValue Id='registrykeystring'
Root='HKLM'
Key='Software\mycompany\myapp'
Type='string' Name='CurrentType'
Value="[PROPERTYSTRING]"
KeyPath='yes'
Action='write'/>
</Component>
注册表导出(二进制和字符串值)是:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\mycompany]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\mycompany\myapp]
"DigitalProductId"=hex:
"CurrentType"="Multiprocessor Free"
(我尝试过的替代方案:与上面相同但使用RegistryKey和RegistryValue
<RegistryKey ...
<RegistryValue
)
我的问题与此Reading and writing to x86 and x64 registry keys from the same application相同,但我没有在C#中使用WiX。也许我需要一个自定义操作,如此帖Wix: Write register entries under HKCU\Software\Classes\Wow6432Node?
答案 0 :(得分:0)
在this question已经回答了,我设法通过
工作了为了解真正的问题,this question有所帮助。当安装程序在64位计算机上作为32位应用程序运行时,64位注册表只能看到Wow6332Node(以及所有常用条目)。自定义操作可以使用
访问注册表的64位部分 RegistryKey key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser,RegistryView.Registry64);
key = key.OpenSubKey(@"Software\Classes\Wow6432Node", true);