In case my product is already installed, I run from my installer first the uninstaller and then if this one finishes successfully I continue then with the installation.
So, I need to check if the uninstaller finished successfully. For this I'm doing the following:
Questions:
...
ReadRegStr $UninstString ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
HideWindow
ClearErrors
ExecWait '$UninstString _?=$INSTDIR'
IfErrors 0 uninstallDone1_ReinstallValidateSelection
GetErrorLevel $0 ; check the return error value from the uninstaller
MessageBox MB_ICONEXCLAMATION|MB_OK "ERROR in uninstaller: $0"
...
1) If there is failure I always see in my msgbox that the uninstaller returned -1, even if in the uninstaller I do before quiting
Why do I always see the $0 being -1?
SetErrorLevel 2
2) In help in "D.1 Error Levels" is written: "1 - Installation aborted by user (cancel button)". But with the procedure above what I notice is that regardless from what page I chose cancel (default NSIS page, or custom page) the value showed in the msgbox is always -1. Why is that?
3) If I quit the uninstaller in a custom page function the return value is success, but if I quit from the uninstall section I get failure (-1). Why the different behaviour when Quit is called in the uninstall section and in the custom-pages-functions?
4) In help in "4.9.1.1 Delete" is written: "The error flag is set if files are found and cannot be deleted.". But I tried that by doing in the uninstaller:
and momo.exe was in use while running the setup and with the very above code (msgbox) I get success, so the uninstaller didn't return error, even though the file was not deleted b/c was in use. Why diff behaviour than what's written in help?
Delete /REBOOTOK "$INSTDIR\momo.exe"
Thx,
Viv