1

I need to copy a binary (REG_BINARY) registry value to a registry key under a Wow6432 Node.

The value is in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId

The WiX installer target is x86

The machine is 64bit

Windows 7 64 bit

Below is the part of my WiX script that attempts to do the copy. Note: @Win64=yes, which I assume will take the value from the NON-Wow6432Node. The result is an error message during installation

Could not write value DigitalProductID to key ... verify that you have sufficient access to that key

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

Copying a string (e.g. HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentType) works and creates the value under Wow6432Node, e.g.

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

The registry export (of both the binary and string values) is:

 Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\mycompany] [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\mycompany\myapp] "DigitalProductId"=hex: "CurrentType"="Multiprocessor Free" 

( Alternatives I've tried: The same as above but using RegistryKey and RegistryValue

 <RegistryKey ... <RegistryValue 

)

My question is the sames as this one Reading and writing to x86 and x64 registry keys from the same application but instead of doing it in C# I'm using WiX. Perhaps I need a custom action as in this post Wix: Write register entries under HKCU\Software\Classes\Wow6432Node ?

1 Answer 1

1

As already answered in this question I managed to get this working by

  1. Creating a custom action (C#).
  2. Calling the custom action during InstallExecuteSequence.

For an understanding of the real problem, this question helped. When the installer runs on a 64bit machine as a 32bit app, then the 64bit registry is not visible only the Wow6432Node (and all the common entries). The custom action can access the 64bit part of the registry using

RegistryKey key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser,RegistryView.Registry64); key = key.OpenSubKey(@"Software\Classes\Wow6432Node", true); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.