Vikas Y
Vikas Y

Reputation: 21

Writing to 32 bit registry values in a 64 bit O

I am facing an issue while using Wix Installer for 64 bit machines having 64 bit Chrome. I need to write to both the Wow6432 Path and regular path (HKLM\Software\Google\Chrome) for 64 bit machines to enable our app extension in Chrome (Chrome 32 reads from Wow6432 Path and Chrome 64 reads from Regular path). I have the following code snippet

<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?>

And in the Feature Section:

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

When I try to install using a x86 Installer on a 64 bit machine, only the Wow6432Node keys are updated. Because of this, 64 bit Chrome cannot get the Extension installed. If I make a 64 bit Installer, Chrome 64 works but Chrome 32 fails. How can I ensure that, using a standard 32 bit Installer, I can write to both the paths? Can anyone tell me what I am doing wrong? Appreciate your help.

Upvotes: 2

Views: 447

Answers (1)

PhilDW
PhilDW

Reputation: 20780

The general situation is that 32-bit MSIs can contain only 32-bit components, and that includes the registry:

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

and separate MSIs are needed for different architectures:

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

If you have a 64-bit setup you should be able to write to the 32-bit registry as well as the 64-bit registry, as that top link says, so I guess that what you are missing in your 64-bit setup is a component that writes to the native 64-bit registry, and another identical entry that has Win64="no" for the 32-bit registry.

Upvotes: 1

Related Questions