pengibot
pengibot

Reputation: 1552

How do I build a registry search based on values in registry

I have a registry value that holds the current version of a config to use

HKLM\SOFTWARE\companyname\productname\CurrentVersion = 13.5

I can successfully search for this and get its value using

<Property Id="CURRENTVERSION">
  <RegistrySearch Id="CurrentVersionID" Root="HKLM" Type="raw"
                  Key="SOFTWARE\companyname\productname\CurrentVersion"></RegistrySearch>
</Property>

but now I need to search for another registry value based on this CURRENTVERSION value, located at

SOFTWARE\companyname\productname\CURRENTVERSION\ConfigPath

<Property Id="CONFIGPATH">
  <RegistrySearch Id="ConfigPathId" Root="HKLM" Type="raw"
                  Key="SOFTWARE\companyname\productname\CURRENTVERSION\ConfigPath"></RegistrySearch>
</Property>

Can somebody provide me with a way to do this, preferably with an example.

Upvotes: 1

Views: 274

Answers (1)

sohil
sohil

Reputation: 518

You should try enclosing CURRENTVERSION in your second registry search within [], as in:

<Property Id="CONFIGPATH">
    <RegistrySearch Id="ConfigPathId" Root="HKLM" Type="raw"
              Key="SOFTWARE\companyname\productname\[CURRENTVERSION]\ConfigPath">
    </RegistrySearch>
</Property>

I haven't tested it but this is how you normally access values of properties in WiX.

Alternatively, you can define variables in the RegistrySearch element in the Utils extension. These variables can then be used in other registry searches. Check out the following link for an example: http://wix.sourceforge.net/manual-wix3/bundle_define_searches.htm

Upvotes: 3

Related Questions