Archive: Can't abort from custom page leave function


Can't abort from custom page leave function
I have a simple "service pack" installer which needs to check two prerequisites before installing, and if those prerequisites aren't met, the installer needs to abort after informing the user.

I can do this check easily in the onInit() and un.onInit() functions and use the MessageBox functions to display the appropriate message. However, I thought it would be nicer to have a custom page which would check the prerequisites, display the appropriate text, set a flag if the installer needs to abort, and check the flag in its leave function. Here is my code:

Page custom InstallCheckPage OnLeaveInstallCheckPage

Function InstallCheckPage
nsDialogs::Create 1018
Pop $0
StrCpy $ABORT_INSTALLATION "No"
; Check to see if the prerequisite is installed
ReadRegStr $0 HKLM "$PREREQUISITE_KEY" "ProductName"
${IF} $0 != "xxMWD-PCSuite V02.10"
StrCpy $ABORT_INSTALLATION "Yes"
${NSD_CreateLabel} 0 10u 75% 40u "Preparing to install $DESCRIPTION...$\r$\n$\r$\n$PREREQUISITE_DESCRIPTION does not appear to be installed on this PC.$\r$\nPlease install $PREREQUISITE_DESCRIPTION before installing this service pack"
${ELSE}
; Now see if this package is already installed
ReadRegStr $0 HKLM "$INSTALL_KEY" "DisplayName"
${IF} $0 != ""
StrCpy $ABORT_INSTALLATION "Yes"
${NSD_CreateLabel} 0 10u 75% 40u "Preparing to install $DESCRIPTION...$\r$\n$\r$\n$DESCRIPTION appears to be already installed on this PC!"
${ELSE}
${NSD_CreateLabel} 0 10u 75% 40u "Preparing to install $DESCRIPTION...$\r$\n$\r$\n$LONG_DESCRIPTION"
${ENDIF}
${ENDIF}
Pop $0
nsDialogs::Show
FunctionEnd

Function OnLeaveInstallCheckPage
${IF} $ABORT_INSTALLATION == "Yes"
Abort
${ENDIF}
FunctionEnd


I have confirmed that my flag is being set, the OnLeaveInstallCheckPage function is being called when I click "Next", and that the flag is being correctly evaluated. However, not only is the install is NOT being aborted, but the page doesn't move on to the next page - the intsall check page remains up. Clicking "Cancel" DOES close the page as expected.

Since the leave handler is apparently not an appropriate place to call abort, what is the proper way for me to do this?

Thanks!


It's all in the manual:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.4.1
http://nsis.sourceforge.net/Docs/Chapter4.html#4.5.3

(If you want to force installer exit, you should use quit.)