shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

prepending value to registry entry

I need to add a value to an existing registry key but must be missing something because it's not working. Refer to the two entries below. The first one should prepend a value but the end result is a blank registry value. The second one, on the other hand, works fine using a custom search value. Why doesn't the first one prepend the value?
Image

While I'm asking about this, how can I remove the text I've added and leave the original value on uninstall? In the past I've written a custom action script to do this but it doesn't seem like that should be necessary. I tried the Uninstall Cleanup wizard but that only seems to be available at the key level and not for individual values like StencilPath.
shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: prepending value to registry entry

An update on my question: after posting the question I noticed that selecting "prepend" changes the reg key type from REG_SZ to REG_MULTI_SZ. I think this is actually the root of the problem. The StencilPath and TemplatePath are Visio reg entries and Visio doesn't recognize the key after the type has been changed to REG_MULTI_SZ. How do I use prepend but have the type remain REG_SZ?
Dan
Posts: 4529
Joined: Wed Apr 24, 2013 3:51 pm

Re: prepending value to registry entry

Hello,

The Registry table holds the registry information that the application needs to set in the system registry.
Please note the following statement in the above article:
If the value contains the sequence tilde [~], then the value is interpreted as a Null-delimited list of strings (REG_MULTI_SZ). For example, to specify a list containing the three strings a, b and c, use "a[~]b[~]c".
So, this is the default behaviour of Windows Installer when adding the REG_MULTI_SZ type.

Let me know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: prepending value to registry entry

Thanks, Dan. That does explain what's happening. I'll continue with my original approach of using a custom search.

For the second part of my question: is there any way other than using a custom action to remove the string I've added during uninstall (I'm currently using VB script). For example, if the original value was "abc" and I changed it to xyz;abc" I want to return to "abc" during uninstall.
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: prepending value to registry entry

Hello,

We apologize for our delayed reply. Somehow your last post has been overlooked.

There is no other approach than a custom action added on uninstall which will restore the original existing value. You could store the original search result (got during installation) in a backup registry and, then use another search which on uninstall will read the value from the backup registry and a custom action which will rewrite the original registry.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”