写入64位O中的32位注册表值

时间:2014-11-06 14:53:20

标签: google-chrome-extension wix windows-installer registry wix3.8

在使用64位Chrome的64位计算机上使用Wix Installer时,我遇到了一个问题。 我需要为64位计算机写入Wow6432路径和常规路径(HKLM \ Software \ Google \ Chrome)以在Chrome中启用我们的应用程序扩展(Chrome 32从Wow6432路径读取,Chrome 64从常规路径读取)。我有以下代码段

<Component Id='RegistryComponents' Guid='{771E66CF-7086-4A56-AAF9-3571ADBEB9AA}' Win64='no'>
    <RegistryKey Id='ChromeExtnInstaller' Root='HKLM' Key='Software\Google\Chrome\Extensions\$(var.Extension)' Action='createAndRemoveOnUninstall'>
        <RegistryValue Name='update_url' KeyPath='yes' Type='string' Value='https://clients2.google.com/service/update2/crx' />
    </RegistryKey>
    <RegistryKey Id='NativeMessagingHost' Root='HKLM' Key='Software\Google\Chrome\NativeMessagingHosts\<NM_ID>' Action='createAndRemoveOnUninstall'>
        <RegistryValue Type='string' Value='[INSTALLDIR]<Value>' />
    </RegistryKey>
    <RemoveRegistryKey Action='removeOnUninstall' Root='HKLM' Key='Software\Google\Chrome\Extensions\$(var.Extension)'/>
    <RemoveRegistryKey Action='removeOnUninstall' Root='HKLM' Key='Software\Google\Chrome\NativeMessagingHosts'/>
</Component>

<?if $(var.Platform)=x64 ?>
<Component Id='RegistryComponents64' Guid='{20A0BA25-0EFC-49F5-8945-24F084EC3635}' Win64='yes'>
    <RegistryKey Id='ChromeExtnInstaller64' Root='HKLM' Key='Software\Google\Chrome\Extensions\$(var.Extension)' Action='createAndRemoveOnUninstall'>
        <RegistryValue Name='update_url' KeyPath='yes' Type='string' Value='https://clients2.google.com/service/update2/crx' />
    </RegistryKey>
    <RegistryKey Id='NativeMessagingHost64' Root='HKLM' Key='Software\Google\Chrome\NativeMessagingHosts\com.sling.wbsp' Action='createAndRemoveOnUninstall'>
        <RegistryValue Name='Default' Type='string' Value='[INSTALLDIR]com.sling.wbsp.json' />
    </RegistryKey>   
    <RemoveRegistryKey Action='removeOnUninstall' Root='HKLM' Key='Software\Google\Chrome\Extensions\$(var.Extension)'/>
    <RemoveRegistryKey Action='removeOnUninstall' Root='HKLM' Key='Software\Google\Chrome\NativeMessagingHosts'/>
</Component>
<?endif?>

在功能部分:

 <ComponentRef Id="RegistryComponents"/>
 <?if $(var.Platform)=x64 ?>
     <ComponentRef Id="RegistryComponents64"/>
 <?endif?>

当我尝试在64位计算机上使用x86安装程序进行安装时,只更新了Wow6432Node键。因此,64位Chrome无法安装Extension。如果我制作64位安装程序,Chrome 64可以运行,但Chrome 32会失败。如何确保使用标准的32位安装程序,我可以写入这两个路径?谁能告诉我我做错了什么?感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

一般情况是32位MSI只能包含32位组件,并且包含注册表:

http://msdn.microsoft.com/en-us/library/aa367451(v=vs.85).aspx

并且不同架构需要单独的MSI:

http://blogs.msdn.com/b/heaths/archive/2008/01/15/different-packages-are-required-for-different-processor-architectures.aspx

如果您有64位设置,您应该能够写入32位注册表以及64位注册表,正如顶部链接所示,所以我猜你在64-中缺少的是什么位设置是一个写入本机64位注册表的组件,另一个相同的条目是Win64 =&#34; no&#34;对于32位注册表。