Deleting registry values from HKEY_CURRENT_USER

Got a problem you cannot solve? Try here.
andrejzr
Posts: 68
Joined: Sun Jun 25, 2006 9:17 am

Deleting registry values from HKEY_CURRENT_USER

Postby andrejzr » Tue Aug 29, 2006 12:02 pm

Hello,

The installation for my application is writing some application settings to the HKEY_LOCAL_MACHINE. The application is using these as default, and if user is changing the settings, they are stored in the HKEY_CURRENT_USER.

When I remove the application, the HKLM values are of course removed OK. How can I achieve the removal of HKCU?

I tried to add the Delete Registry command, and this works to some extent. I will give an examlpe.

The application is storing its data in the key:
HKCU\\Software\\Company\\Product\\5.0\\...

5.0 is just a sample of the version, depending on the app version it differs.

I could use the Delete Registry command, and delete the key
HKCU\\Software\\Company\\Product\\5.0

But this leaves the key HKCU\\Software\\Company\\Product in the registry.

If I would delete HKCU\\Software\\Company\\Product, it could happen that installer of version 5.0 would delete version 4.0.

I didn't find a way with Delete Registry command, how to do this - would need to check, if after Removal of registry key HKCU\\Software\\Company\\Product\\5.0 the HKCU\\Software\\Company\\Product is empty, and then remove this one as well.

Uff, I hope I didn't make this too complicated. The safe solution is to write some custom code in a DLL, and call it during install. If there is a recommended way how to do this with native commands, it would be of course great.

Another question here is, how to remove the HKCU registry for all users, that have used the application - not just the user, who is removing the application. Do you have any suggestions?

Thanks
Andrej

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue Aug 29, 2006 1:48 pm

I'd try calling Read Registry to see if 4.0 exists, and if not, blow it all away.

If users logged on under seperate accounts and the software created its own keys under those accounts, there isn't a straightforward way to find and remove all those keys. So that one is slightly harder. You could enumerate all user keys using a free plug-in on this forum, which returns the full list of child keys under a given key. Then you could repeat the same process with those.

Otherwise if the keys are created by the installer, then multiple users should not be a problem - they'll be removed too automatically upon uninstall.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

andrejzr
Posts: 68
Joined: Sun Jun 25, 2006 9:17 am

Postby andrejzr » Tue Aug 29, 2006 3:06 pm

Thank you for your fast reply and explanation.

Sometimes I get the feeling you are working 24 hours a day. I get answers at all times of a day ;-)

Thanks again!


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 225 guests