Reading from the registry
To read data stored in the registry, you'll use the
RegistrySearch element. If the value you're looking for exists, it will be saved into a property you'll have placed as a parent element to RegistrySearch
. Here's an example that looks for the myValue
value stored in HKEY_CURRENT_USER\Software\MyCompany and stores it in a property called REGISTRY_RESULT
. Whichever property you decide to use, make sure that it is public (uppercase). An example is as follows:
<Property Id="REGISTRY_RESULT"> <RegistrySearch Id="MyRegistrySearch" Root="HKCU" Key="Software\MyCompany" Name="myValue" Type="raw" /> </Property>
By placing the RegistrySearch
element inside of a Property
element we're saying that we want the registry value to be stored in that property. The attributes on the RegistrySearch
element mostly tell Windows Installer where to look for the value. The Id
attribute gives...