title: How to copy binary registry value in WiX
body: <p>I need to copy a binary (REG_BINARY) registry value to a registry key under a Wow6432 Node.</p>
  
  <p>The value is in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId</p>
  
  <p>The WiX installer target is x86</p>
  
  <p>The machine is 64bit</p>
  
  <p>Windows 7 64 bit</p>
  
  <p>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 </p>
  
  <blockquote>
    <p>Could not write value DigitalProductID to key ... verify that you have sufficient access to that key</p>
  </blockquote>
  
  <pre><code> &lt;Property Id="PROPERTYBINARY"&gt;
    &lt;RegistrySearch Id='searchbinary'
                    Type='raw'
                    Win64='yes'
                    Root='HKLM'
                    Key='SOFTWARE\Microsoft\Windows NT\CurrentVersion'
                    Name='DigitalProductId'/&gt;
   &lt;/Property&gt;
  
    &lt;Component Id="componentbinary" Guid="{04367CD7-B41A-4A1D-81C7-E24029FF4926}&gt;
        &lt;RegistryValue 
            Id='registrykeybinary' 
            Root='HKLM' 
            Key='Software\mycompany\myapp' 
            Type='binary' 
            Name='DigitalProductId' 
            Value="[PROPERTYBINARY]" 
            KeyPath='yes' 
            Action='write'/&gt;
    &lt;/Component&gt;
  </code></pre>
  
  <p>Copying a string (e.g. HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentType) works and creates the value under Wow6432Node, e.g. </p>
  
  <pre><code>&lt;Property Id="PROPERTYSTRING"&gt;
    &lt;RegistrySearch Id='searchstring'
                    Type='raw'
                    Win64='no'
                    Root='HKLM'
                    Key='SOFTWARE\Microsoft\Windows NT\CurrentVersion'
                    Name='CurrentType'/&gt;
  &lt;/Property&gt;
  
  
    &lt;Component Id="componentstring"  Guid='{F7231D06-DC3B-4D0F-BCBC-EDBD4DF38CA2}'&gt;
        &lt;RegistryValue Id='registrykeystring'
           Root='HKLM' 
           Key='Software\mycompany\myapp'  
           Type='string' Name='CurrentType' 
           Value="[PROPERTYSTRING]" 
           KeyPath='yes' 
           Action='write'/&gt;
    &lt;/Component&gt;
  </code></pre>
  
  <p>The registry export (of both the binary and string values) is:</p>
  
  <pre><code>   Windows Registry Editor Version 5.00
  
     [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\mycompany]
  
     [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\mycompany\myapp]
     "DigitalProductId"=hex:
     "CurrentType"="Multiprocessor Free"
  </code></pre>
  
  <p>( Alternatives I've tried: The same as above but using RegistryKey and RegistryValue</p>
  
  <pre><code>   &lt;RegistryKey ...
            &lt;RegistryValue 
  </code></pre>
  
  <p>)</p>
  
  <p>My question is the sames as this one <a href="https://stackoverflow.com/questions/15424205/reading-and-writing-to-x86-and-x64-registry-keys-from-the-same-application">Reading and writing to x86 and x64 registry keys from the same application</a> but instead of doing it in C# I'm using WiX. Perhaps I need a custom action as in this post <a href="https://stackoverflow.com/questions/16504395/wix-write-register-entries-under-hkcu-software-classes-wow6432node?rq=1">Wix: Write register entries under HKCU\Software\Classes\Wow6432Node</a> ?</p>