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

Reg append/prepend overwrites entry?

I have an enterprise license for AI 7.1.3. When I select either "append to existing value" or "prepend to existing value" for a registry entry, the installer overwrites any existing value in that reg entry with blanks, i.e., the resulting reg entry has a null value. However, if I set the option to "replace existing value", the existing value is overwritten with my intended value.

Example: the value I want to add is a Folder path (for the sake of this example, let's say it has a value of "C:\My Folder Path"). If the reg entry already contains "D:\Existing Path" these are the results:
append or prepend: <null>
overwrite: C:\My Folder Path

Obviously, what I want is either
C:\My Folder Path;D:\Existing Path
or
D:\Existing Path;C:\My Folder Path

Am I missing a setting or an option that would allow me to use append or prepend?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Reg append/prepend overwrites entry?

Hello,

I am afraid I could not reproduce this behavior. Could you please send a sample project that accurately reproduces this behavior to support at advancedinstaller dot com?

Thank you,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: Reg append/prepend overwrites entry?

The attached sample project reproduces the problem.

The only required setup before running the installer is this:
1) Create this key "HKEY_CURRENT_USER\Software\Harvard Computing Group\TestApp" with a REG_SZ value called "Test Value" and assign any string data.
2) Create "c:\Temp\AI Test\" and place the attached PDF into this folder

Thanks for your help.
Attachments
AI Test.zip
Zip contains project and PDF document
(93.4 KiB) Downloaded 276 times
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Reg append/prepend overwrites entry?

Hello,

I have looked in your example. As stated in MSDN a string that already exists in a value will not be prepended. Here is the relevant quote:
If a [~] follows the end of the string list, the strings are to be prepended to any existing registry value strings. If a prepending string already occurs in the registry value, the original occurrence of the string is removed.
In essence, if you already have a value of "1234" in the registry, and you are again trying to prepend another "1234" to it, this will not be done. Instead, the value will remain unchanged.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: Reg append/prepend overwrites entry?

Thanks, Gabriel. However, I don't think that is the problem. In step #1 in my setup instructions above, I said to create the Test Value key "and assign any string data." For example, if you assign "ABCD", it will still be overwritten, so the issue apparently isn't just when the installer value matches an existing value.

Scott
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Reg append/prepend overwrites entry?

Hi Scott,

I could indeed replicate the behavior you are encountering. Apparently in Windows Installer, the appending and prepending operations are only supported on registry values of type REG_MULTI_SZ. Since your value is of type REG_SZ, the key will be overwritten. Here is an article that might help you understand the difference:
http://www.eytcheson.com/help35/html/hs8000.htm
The fact that the value appears as "REG_SZ" instead of "REG_MULTI_SZ" is an error in the presentation. This will be fixed in a future version of Advanced Installer.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
shelmers
Posts: 63
Joined: Thu Sep 03, 2009 9:02 pm
Location: Andover, Massachusetts USA

Re: Reg append/prepend overwrites entry?

Thanks, Gabriel. I'm glad I'm not going crazy. I thought I was using a feature that seemed fairly obvious and yet it wasn't working.

Because I can't control the type of the existing reg entry (it's created by another app), I guess I'll have to create a custom action that reads the existing reg value, appends my value then writes the result back to the registry.

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

Re: Reg append/prepend overwrites entry?

In case it's useful to anyone else, here's what I did to prepend a value to an existing REG_SZ entry. I didn't need to use a custom action after all:

1) created a search to read the existing reg value into EXISTING_VALUE (I attached the search to the WelcomeDlg in InstallUISequence)
2) created an installation property called MY_VALUE with a default value of "ABCDE"
3) set the registry value to [MY_VALUE];[EXISTING_VALUE]

Note that the semicolon between the two property names is the correct syntax for this particular reg key, it won't be correct in all cases.

Scott

Return to “Common Problems”