Skip to content
⌘ NSIS Forum Archive

How to get uninstall key from registry

3 posts

JohaViss#

How to get uninstall key from registry

I have an installer for my application.
The application can be installed multiple times in different locations. 😱 (sad but true)

The uninstall key (HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\<registered name>) is variable.
The <registered name> is provided by the user on install.
It means that <registered name> can be almost anything.

So in the registry the can be entries like this:
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Test_for_Admin
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Performance_test
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Release_version_1

And they each point to a different install location. But inside each install location there are the same files. (and also the same un-installer)
But the name of the location has (usually) a different name:
C:\Program Files\Testing\App1\
C:\Program Files\Testing\App2\
D:\Program Files\MyCompany\MyApp_1.0.0

How can I find the correct uninstal reg key for a specific installation.

(Installer started from C:\Program Files\Testing\App1\ points to reg key HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\Test_for_Admin)


Regards
Johan
Animaether#
You could simply write out a file to your installation folder that contains the correct key name. The uninstaller can then read from this file. Make sure you use $INSTDIR and not $EXEDIR, as the uninstaller gets copied to a temporary location (which will be the new $INSTDIR).

See also:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.