I've been trying NSIS for a couple of days now.
I'm creating a serial validation page with 4 fields 5 chars each. I've read the forums, the read-me's for InstallOptions and System, and some examples in the WiKi, and still cant put this to work!
I'd thank any help at this.
Here are my two functions, along with the initialization code.
!define Key1 $R1 ; Serial Part 1
!define Key2 $R2 ; Serial Part 2
!define Key3 $R3 ; Serial Part 3
!define Key4 $R4 ; Serial Part 4
; Things that need to be extracted on startup (keep these lines before ; any File command!)
; Use ReserveFile for your own InstallOptions INI files too!
ReserveFile "wndSerial.ini"
ReserveFile "files\other\ValidateSN.dll"
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
Function SetCustom
;Display the InstallOptions dialog
Push ${Key1}
Push ${Key2}
Push ${Key3}
Push ${Key4}
Push $R0
InstallOptions::dialog "$PLUGINSDIR\wndSerial.ini"
Pop $R0
Pop ${Key4}
Pop ${Key3}
Pop ${Key2}
Pop ${Key1}
FunctionEnd
Function ValidateCustom
FlushINI "$PLUGINSDIR\wndSerial.ini"
; Serial number inits
!insertmacro MUI_INSTALLOPTIONS_READ ${Key1} "$PLUGINSDIR\wndSerial.ini" "Field 2" "State"
!insertmacro MUI_INSTALLOPTIONS_READ ${Key2} "$PLUGINSDIR\wndSerial.ini" "Field 3" "State"
!insertmacro MUI_INSTALLOPTIONS_READ ${Key3} "$PLUGINSDIR\wndSerial.ini" "Field 4" "State"
!insertmacro MUI_INSTALLOPTIONS_READ ${Key4} "$PLUGINSDIR\wndSerial.ini" "Field 5" "State"
SetPluginUnload alwaysoff
; Call the function to validate the netmamma serial number
System::Call "user32::MessageBox(i $HWNDPARENT, t .r1, t 'Test', i 0)"
System::Call "$PLUGINSDIR\ValidateSN.dll::ValidateSN (t,t,t,t)i (.${Key1},.${Key2},.${Key3},.${Key4}).r0"
; --- get output
Pop $0
StrCmp $0 "1" serial_ok serial_wrong
serial_ok:
MessageBox MB_OK "OK-OK-OK-OK"
Goto done
serial_wrong:
MessageBox MB_OK "$0"
Abort
done:
; Continue installation
MessageBox MB_OK "$0"
FunctionEnd Can anyone help out with this, any help will be greatly appreciated! 🙁 Thanks in advance,
smoura