ehardin
Posts: 76
Joined: Fri Jul 13, 2007 8:10 pm

Registry Value, append, prepend, replace

Tue Apr 20, 2021 7:05 pm

I am using an update and not a patch.

In the most recent version of the installer I have it set to create a registry key with a named value of RegDte ie registration date. This value gets set in the program when the user finally registers the program during the trial period.

So previous registered customers do not have this registry key named value so I put it in the updater and that only gives me the choices of Prepend, Append, or Replace any existing values.

So new customers will have this named value and it will be filled with a real value when they register. Previous customers will get the named value in the update and that will get a special value. So what happens in the next update? How do I have this registry value not right over any previous value? Currently the value is a REG_SZ but if I append/prepend it changes to a REG_MULTI_SZ and all of a sudden my program's code does not recognize it. Plus, if I look at the "appended" data manually in regedit, all I see is the new value and not the old value so I'm not sure what "append" means in this case.

Any suggestions or help would be great.

Ed

ehardin
Posts: 76
Joined: Fri Jul 13, 2007 8:10 pm

Re: Registry Value, append, prepend, replace

Tue Apr 20, 2021 8:21 pm

For What It Is Worth, what I decided to do was leave the RegDte registry key named value out of the update project and in the program I create it if it doesn't exist. I figured that was easier.

Ed

Eusebiu
Posts: 4893
Joined: Wed Nov 14, 2012 2:04 pm

Re: Registry Value, append, prepend, replace

Thu Apr 22, 2021 11:08 am

Hi Ed,

I'm glad you found a solution to your problem and shared it with us.

If you want to preserve a registry value in Advanced Installer, you can go in the "Search" page, create a registry search that gets that value and use the search property as the value of that registry value in the "Registry" page. If the search property is empty, you can set it to a default value through a "Set installer property" custom action.

For a registry key, you can go to its properties, select the "Preserve key content" option from the "Operations" tab and use the "OLDPRODUCTS" condition for it.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

guye
Posts: 2
Joined: Thu Apr 22, 2021 11:31 am

Re: Registry Value, append, prepend, replace

Thu Apr 22, 2021 11:42 am

Can you please explain further how to accomplish preserving registry value?
I added a search for previous registry value.
How and where do I add a custom action to set property only if missing?

Eusebiu
Posts: 4893
Joined: Wed Nov 14, 2012 2:04 pm

Re: Registry Value, append, prepend, replace

Thu Apr 22, 2021 2:20 pm

Hi and welcome to our forums.

First, you need to create a search for the previous registry value as exampled in the image below.
Registry Search.png
Registry Search.png (16.42 KiB) Viewed 4059 times

Secondly, you need to add a "Set installer property" custom action that sets the search property to a default value if it is empty (NOT RESULT_PROPERTY condition is used for this case).
Set Registry Default.png
Set Registry Default.png (68.52 KiB) Viewed 4059 times

Thirdly, you need to use the search property as the value for your registry entry.
Registry Value.png
Registry Value.png (55.35 KiB) Viewed 4059 times

Let me know if you have other questions.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

ehardin
Posts: 76
Joined: Fri Jul 13, 2007 8:10 pm

Re: Registry Value, append, prepend, replace

Thu Apr 22, 2021 2:59 pm

Thank you for the reply. I will look into this.

What I am currently doing is having AI do the SOFTWARE\[Manufacturer]\[ProductName] Registry entry and give Everyone Full Control in the Permissions. Now, in the program, I can look to see if the desired named value is present or not (RegDte) and create it if it is not and fill it in with the correct date.

What I like about this is that, because it is created after install, if the program is un-installed, Windows will leave that whole SOFTWARE\[Manufacturer]\[ProductName]\RegDte in place so that, if the user re-installs, that value is still there.

For the program to be manipulating the registry key, however, it is important to have those permissions in place or else Windows will give an "Access Denied" if the program is not being run As Administrator"

Thanks again.

Ed

Eusebiu
Posts: 4893
Joined: Wed Nov 14, 2012 2:04 pm

Re: Registry Value, append, prepend, replace

Mon Apr 26, 2021 3:08 pm

Hi Ed,

During the uninstall, the package will remove only the resources it installed. Hence, since the "RegDte" registry value is created by your application, it will not be removed during the package uninstallation. The permissions should be kept as well. Isn't this happening for you?

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

guye
Posts: 2
Joined: Thu Apr 22, 2021 11:31 am

Re: Registry Value, append, prepend, replace

Sun May 09, 2021 1:43 pm

Eusebiu wrote:
Thu Apr 22, 2021 2:20 pm
Hi and welcome to our forums.

First, you need to create a search for the previous registry value as exampled in the image below.
Registry Search.png


Secondly, you need to add a "Set installer property" custom action that sets the search property to a default value if it is empty (NOT RESULT_PROPERTY condition is used for this case).
Set Registry Default.png


Thirdly, you need to use the search property as the value for your registry entry.
Registry Value.png


Let me know if you have other questions.

Best regards,
Eusebiu
Thank you so much. It works!!

Catalin
Posts: 4228
Joined: Wed Jun 13, 2018 7:49 am

Re: Registry Value, append, prepend, replace

Mon May 10, 2021 2:33 pm

Hello,

Thank you for your followup on this!

We are glad everything works as expected.

Please let us know if there is anything else we could help you with.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”