Search code examples
wixregistryregistrykey

How to add really long hexadecimal registry in custom action in wix installer?


I get an error when I try to use a custom action to add a really long registry value before uninstall.

<CustomAction Id="InsertValue" Return="check" Execute="deferred" Impersonate="no" Directory="INSTALLDIR" ExeCommand="&quot;reg add HKEY_CURRENT_USER\Software\Intel\Display\igfxcui\HotKeys&quot; /v 9530 /t REG_BINARY /d <REALLY LONG HEXADECIMAL VALUE>"/>

The value is deleted on install and I need to write it back during uninstall but the value is longer than 255 characters so it is giving me a string overflow error.

What other options do I have to write such long values into the registry?


Solution

  • Try this code. This is the correct way to write to registries from wix.

     <RegistryKey Root="HKCU"
                     Key="SOFTWARE\Intel\Display\igfxcui\HotKeys">
            <RegistryValue Name="9530"
                           Action="write"
                           Value="LONG HEXADECIMAL VALUE"
                           Type="binary"
                           KeyPath="yes" />
          </RegistryKey>
    

    You should write this between a component tag.