Currently I have customised the Wix_InstallDirDlg to enable the user to set a registry key on install. There is a custom dialog that is shown after both the InstallDirDlg and the MaintenanceTypeDlg so that it caters for both install and repair scenarios.
The custom dialog has a single textbox that is linked to a property. This property has a registry search so that if the user repairs or upgrades the previous value is preserved and therefore shown in the custom dialog for the user to validate. The dialog works fine on install and the registry key is created. However when repairing, the custom dialog appears with the correct registry value entered (so the RegistrySearch is working), but when the repair is completed, the key value is blank.
<Property Id='SERVER_LISTEN_URL'>
<RegistrySearch Id='ServerListenUrlRegSearch' Root='HKLM'
Key='SOFTWARE\$(var.Manufacturer)\$(var.Name)'
Name='ServerListenUrl'
Type='raw' Win64='no' />
</Property>
<Component Id="RegistryEntries" Guid="0234974B-6158-4312-90A7-56869809B42E">
<RegistryKey Id="ServerRegKey"
Root="HKLM"
Key='SOFTWARE\$(var.Manufacturer)\$(var.Name)'
Action='createAndRemoveOnUninstall'>
<RegistryValue Id="ServerListenUrlRegVal"
Name='ServerListenUrl'
Value='[SERVER_LISTEN_URL]'
KeyPath='yes'
Type='string' />
</RegistryKey>
</Component>
<Dialog Id="SettingsDlg">
<Control Id="ListenUrl" Type="Edit" X="20" Y="100" Width="320" Height="18" Property="SERVER_LISTEN_URL" Indirect="no" />
</Dialog>
What have I done wrong?
I managed to work out this myself straight after I posted. I spent pretty much a day on trying to work out this so hopefully this will save some pain. All you need to do is change the property to a secure property.
<Property Id='SERVER_LISTEN_URL' Secure='yes'>
<RegistrySearch Id='ServerListenUrlRegSearch' Root='HKLM'
Key='SOFTWARE\$(var.Manufacturer)\$(var.Name)'
Name='ServerListenUrl'
Type='raw' Win64='no' />
</Property>
Secure properties can pass their content from the client process (run in user context) to the server process (run in system context) during an "elevated install". In other words an install that is invoked by a non-admin user. Don't be too generous about what properties are made secure, but definitely add all properties used in the Upgrade table, and any special ones used in the GUI for crucial information as you have done.
http://msdn.microsoft.com/en-us/library/aa371571(v=vs.85).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With