0

I am trying to jump forward 1 page in my installer. I have a custom page in my NSIS installer. This custom page prompts the user to input a serial number. If they are valid I will jump the installer forward to the next page (the welcome page) if not we remain on the page. I will be jumping to the next page from within both the Initialse and Finalise functions.

Every time I try to jump to the next page the installer just closes. I have tried Abort and Return but both cause the installer to close. I have also trid Call RelGoToPage where $R9 is 1 but this sends the user back the page they are already on, ie, an infinite loop.

Whats going wrong and how can I make my installer jump to the next page.

# Page Definition
Page Custom SerialPageInitialise SerialPageFinalise

# Page Implementation
Function SerialPageInitialise
    !insertmacro ValidateSUser
    ${If} $isValidUser > 0 # If user if valid
        Return # Go to next page...Doesn't work just closes the whole installer
        #Abort # Doesn't work just closes the whole installer
    ${EndIf}
FunctionEnd

# For the following function: the message "A" always shows then the installer closes
Function SerialPageFinalise
    ${NSD_GetText} $SerialEditBx $R9
    !insertmacro ValidateUserExpanded "$R9"
    ${If} $isValidUser > 0 # If user if valid
        MessageBox MB_OK "A"
    ${Else}
        MessageBox MB_OK|MB_ICONEXCLAMATION "Authentication Failed. You are not a recognised client."
        Abort
    ${EndIf}
FunctionEnd
Mack
  • 593
  • 1
  • 5
  • 7

1 Answers1

0

Works fine for me:

!include LogicLib.nsh
!include nsDialogs.nsh

var isValidUser
var SerialEditBx
!macro ValidateUserExpanded param
StrCpy $isValidUser 0
${If} ${param} = 666
    StrCpy $isValidUser 1
${EndIf}
!macroend

!macro ValidateSUser
MessageBox mb_yesno "ValidateSUser?" IDNO nope
!insertmacro ValidateUserExpanded 666
nope:
!macroend

Function SerialPageInitialise
!insertmacro ValidateSUser
${If} $isValidUser > 0
    Abort ; Skip page
${EndIf}
nsDialogs::Create 1018
Pop $0
${NSD_CreateText} 0 13u 50% 13u "667"
Pop $SerialEditBx
nsDialogs::Show
FunctionEnd

Function SerialPageFinalise
${NSD_GetText} $SerialEditBx $R9
!insertmacro ValidateUserExpanded "$R9"
${If} $isValidUser > 0 # If user if valid
    MessageBox MB_OK "OK"
${Else}
    MessageBox MB_OK|MB_ICONEXCLAMATION "Authentication Failed. You are not a recognised client."
    Abort ; Don't allow going to next page
${EndIf}
FunctionEnd

Page Custom SerialPageInitialise SerialPageFinalise
Page InstFiles
Anders
  • 97,548
  • 12
  • 110
  • 164