Hello John,
First of all, thank you for the explanation.
I believe your scenario is clear to me now. What happens here makes sense, please allow me to explain why.
Basically, the preserve option for your registry key works as it follows:
- first, the registry key is saved into a .reg file
- at the end of the installation, this reg file is installed (restoring the values)
Unfortunately, this happens after the service is started.
Normally, this would be as simple as moving the custom action that does the restore operation before the service is starting. However, this is not possible as the custom action that does this is of
"Immediate" type, while the
"StartService" happens during the
"Deferred" stage.
This means that we will have to do this ourselves, through a custom action. Here is how this can be done:
1. create a search that saves the value of the registry entry
2. create a custom action that modifies the registry entry, using as a value the value of the search
Let's dive a bit into this:
1. the
"Search" can be added in the
"Search" page. After doing so, you can right click on the search -->
"Add search location" -->
"Registry".
2. After configuring the search, it's time to create the
custom action.
The custom action should be added
after the "WriteRegistryValue" and
before the "InstallService" standard actions. To show these actions in the UI, please proceed as it follows:
- go to
"Custom Actions" page
- under
"Install Execution Stage", click on any action group -->
"Show standard actions" -->
"Add resources" -->
"WriteRegistryValues"
- now please repeat the above step for the
"InstallService" standard action as well
To schedule your custom action between those actions specified above, simply drag and drop it in the appropriate place.
Important:
- the custom action should be running during the deferred stage. To do so, select your custom action and set its
"Execution Time" to
"When the system is being modified (deferred)"
- the custom action should have enough privileges to modify the registry entry
- make sure the custom action will run in the appropriate scenarios using the
"Execution Stage Condition" section
Now, another
really important thing I would like you to take into consideration is the redirection that happens in the "backstage" of Windows.
Let's consider the following:
- x86 OS & x64 OS
- x86 process & x64 process
When a 32-bit process runs on a 64-bit computer, the modifications it brings to the computer will most likely be redirected. For instance, if it tries to modify the registry, the OS will automatically redirect whatever modifications it does to the
WOW6432Node key.
For instance, if it tries to add the following key:
it will actually be added like this:
Hope this helps.
Best regards,
Catalin
FOLLOW US
Get the latest news in Application Packaging