Prev Previous Post   Next Post Next
Old 10th February 2016, 18:07   #1
pkonduru
Member
 
Join Date: Jul 2015
Posts: 62
NSIS Not responding

Hi All,

During installation , my custom dialog goes into not responding state(ion top of the installer window). The custom dialog has a button which the user can click to stop and uninstall an existing windows service. It works fine most of the times but sometimes when the windows service takes a while to stop, the NSIS window goes into not responding state and I have to cancel the install from the task manager.
Here is my code for the custom page buttonClick. In brief, the code below does the following.
--Enables the button when dialog is shown
--Gets the windows service binary path, based on this the installer knows where the .bat file is to stop and uninstall the service.
--Stops the service(this is the piece that's causing the issue)
--Uninstall the service
--enable the button and also the next button in the dialog

EnableWindow $hCtl_ExistingHub_Button1 0
${NSD_SetText} $hCtl_ExistingHub_Button1 "Stopping Service..."

SimpleSC::GetServiceBinaryPath "MyService"
Pop $0
Pop $1

Push "$1" ; contains the service executable string
Call GetFirstStrPart
Pop "$R0"

Push "$R0" ;get parent directory from service string
Call GetParent
Pop $R0

Push "$R0"
Call GetParent
Pop $R0

SimpleSC::GetServiceStatus "MyService"
Pop $0
Pop $1
${If} $1 == "4"
ExecDos::exec /TIMEOUT=5000 /TOSTACK "$R0\bin\stopservice.bat"
;ExecDos::exec /TIMEOUT=5000 "$R0\bin\stopservice.bat"
; Pop $0
MessageBox MB_OK "Existing Service stopped"
${EndIf}

${NSD_SetText} $hCtl_ExistingHub_Button1 "Uninstalling Service..."
ExecDos::exec /TIMEOUT=5000 /TOSTACK "$R0\bin\uninstall.bat"
MessageBox MB_OK "Existing service uninstalled"
${NSD_SetText} $hCtl_ExistingHub_Button1 "Uninstall"
EnableWindow $hCtl_ExistingHub_Button1 1
GetDlgItem $1 $HWNDPARENT 1 ;//Enable "Next" button
EnableWindow $1 1

I also tried stopping the service using the SimpleService plugin, this brings up the "Not responding" state too but I don't have to cancel from the task manager as it finally comes back to normal state after sometime.
pkonduru is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump