I'm getting the following error in my script upon compile:
Function: "un.onInit"
Call must be used with function names starting with "un." in the uninstall section.
Usage: Call function_name | [:label_name]
The code that it's crashing on is below howver I'll just briefly explain what I'm doing. For both the installer and uninstaller I want it to call the function KillProgramExe to terminate the running program before its file is updated or so it can be delted upon uinstallation.
What is causing this bug?
Code below:
;**************************************************************************************************
;FUNCTION - ONINIT
;**************************************************************************************************
Function .onInit
;Check if the program exe is running before proceeding installation
Call KillProgramExe
SetOutPath $TEMP
File /oname=spltmp.bmp "Images\splash.bmp"
; optional
; File /oname=spltmp.wav "Data\splash.wav"
splash::show 1000 $TEMP\spltmp
Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normal, and '-1' if some error occured.
Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav
FunctionEnd
;**************************************************************************************************
;FUNCTION - UN.ONINIT
;**************************************************************************************************
Function un.onInit
;Check if the program exe is running before proceeding uninstallation
Call KillProgramExe
FunctionEnd
;**************************************************************************************************
;FUNCTION - KillProgramExe
;**************************************************************************************************
Function KillProgramExe
FindProcDLL::FindProc "${MUI_PROGRAM_FILENAME}.exe"
StrCmp $R0 1 foundexe notfoundexe
foundexe:
KillProcDLL::KillProc "${MUI_PROGRAM_FILENAME}.exe"
notfoundexe:
;MessageBox MB_OK "Program is not running"
FunctionEnd
un.onInst
5 posts
I mean I can get it to compile by duplicating the function KillProgramExe with adding a un. before its name but surely this isn't the way necessary.
Whats the point of havint two identical functions except for their name?
Whats the point of havint two identical functions except for their name?
No need to check first if running, the trykill will just function if app is not running anyhow.
the point is, that functions without un. prefix won't be compiled into the uninstaller.exe and so will not be usable inside uninstaller.exe.
Originally posted by Comm@nder21I see it makes sense now, just thought why duplicate identical functions but it's obviously because of how the NSIS compiler handles the script.
the point is, that functions without un. prefix won't be compiled into the uninstaller.exe and so will not be usable inside uninstaller.exe.
Thanks.