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 the 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). The example follows:
<Property Id="REGISTRY_RESULT"> <RegistrySearch Id="MyRegistrySearch" Root="HKCU" Key="Software\MyCompany" Name="myValue" Type="raw" /> </Property>
By placing the RegistrySearch
element inside 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. Id
just gives the search...