Archive: Uninstall previous version problems


Uninstall previous version problems
We recently made a major version change to our software package, however we will still be offering the legacy version with the new version.

That being said, normally when the installer loads up, it looks if the previous version is installed and it uninstalls it.

Since the product name changed, the checker will now obviously only check if the new version is old, not both since it uses the $PRODUCT_NAME variable in the uninstall check function.

Would I need to simply add two functions or is there a way to check both variables at once?


ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
StrCmp $R0 "" blah

; this perhaps should be handled better. maybe if they hit cancel the installer quits.
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort

;Run the uninstaller
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file

IfErrors no_remove_uninstaller
no_remove_uninstaller:

blah:
FunctionEnd

Actually thinking about it, is it possible to use a wildcard?

Product_Name for legacy and modern are similar enough.
So if my legacy product was called Foobar and the new version is Foobar Accelerator how can i just do somehting like "Foobar*"


You can't really use a wildcard*, but it's pretty simple to just check both the old and the new name, no?

A little planning ahead goes a long way here, but just to note - you *could* keep the old name for the registry... the name that gets displayed in ARP is unrelated to the key name, after all. That way you wouldn't have to worry about this at all.
( the 'little planning ahead' would be to pick a generic name and sticking to it - or using a GUID )

* You -can- use EnumRegKey to loop over each (sub)key, and then use the string comparison functions. Fairly heavy functionality in the limited number of cases you've got, though.


deleted


Good point I really don't need to differentiate in that section since other sections are hard coded with the name but just for htat one part it shouldnt matter what it's called.

And you're right I should had planned this much better from the beginning.

But, is there a way to change the name of the product without the productname variable so that i can use the original product name in the variable, but change the text for the Welcome to the Foobar Accelerator Installer?


OMFG I am so dumb today, nevermind.