1

I have an application that is saving multiple registry keys on install to ensure that certain choices a user makes are persisted in the application. Most of these keys work correctly, but some do not record an entry. Am I doing something wrong? or is there a limit on the WiX RegistrySearch? I have checked the documentation and can't find any limit. I have included some examples below :

The following works correctly:

  <Property Id="SERVER_NAME">
     <RegistrySearch Id='rsSERVER_NAME' Root='HKLM' Key='SOFTWARE\CompanyName\ApplicationName' Name='ServerName' Type='raw' />
  </Property>

The following does not work correctly:

  <Property Id="SERVER_NAME">
     <RegistrySearch Id='rsSERVER_NAME' Root='HKLM' Key='SOFTWARE\CompanyName\ApplicationName\ApplicationDetails\Servers' Name='ServerName' Type='raw' />
  </Property>

Is there any reason why the 2nd code block would not work?

PhilDW
  • 20,260
  • 1
  • 18
  • 28

2 Answers2

1

If you want to persist property values from user choices it may be easier to just let WiX do it with the "remember property" pattern.

It's not clear how you are saving these values and retrieving them, because there is no indication if you are saving them in 32-bit or 64-bit location, or if you are using the -arch switch to set the default, so it may be that you are saving or restoring them from different bitness locations (see RegistrySearch win64 setting). Without this context it's not clear if that search will work or not. It appears to be a 32-bit search in the absence of Win64=yes, but the -arch switch changes the default.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
1

TEST OK: I ran a test of this and both values were retrieved from the 32-bit section of the registry (HKLM\SOFTWARE\WOW6432Node) without any problems.


Here is the WiX RegistrySearch documentation. And below are the registry paths mentioned by Phil for 64-bit and 32-bit applications - your WiX code specifies 32-bit, so you read from the WOW6432Node section:

  • HKLM\SOFTWARE (for 64-bit applications)
  • HKLM\SOFTWARE\WOW6432Node (for 32-bit applications - believe it or not)

I am wondering if you are just mixing up the paths in the registry? Here is where I am reading from - it is in HKLM of course (I cropped the screenshot a bit to make it fit the page):

Reading from HKLM 32-bit section


UPDATE: I have now tested this reading from both the 32-bit and 64-bit sections of the registry. It works as expected as far as I can see? There must be an error in your registry path somewhere?

I use a one-line VBScript to show the property value after the RegistrySearch has run and retrieved the properties. I can update this answer to add this code if you want.

It is a little unclear what you mean when you say that an application is saving multiple registry settings during installation. Is this a custom action you are running which writes these registry keys, and then your setup reads them back?

It is unclear how these values - that you read back from the registry using RegistrySearch - are actually written to the registry? Perhaps they are from a prior version of your application or from another application and you want to "copy" them? If so, can you verify whether they are HKCU or HKLM settings? For HKCU settings I would prefer to do the copy in the application itself for reliability reasons.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • I am definitely checking the WOW6432Node section. The first example in my question does save under HKLM\SOFTWARE\WOW6432Node... but the 2nd one doesn't. The only difference is the number of levels the 2nd registry entry goes down. – David Londesborough Jan 25 '18 at 08:45
  • Yes I would love the "one-line VBScript to show the property value after the RegistrySearch has run" as I'm having trouble reading a registry value and want to see what is being read :) – David Coster Jun 24 '21 at 02:18