Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 25th February 2021, 10:35   #1
shekara
Junior Member
 
Join Date: Oct 2020
Posts: 33
can SimpleSC::GetErrorMessage be used outside the function or macro it is called?

using NSIS Simple SC plugin i am trying to manipulate services and get return value. however i am not able to use Get Error message outside a function or macro. is it possible.. below is my sample code

!macro ServiceStop serviceName Timeout
Push $0
Push $1
SimpleSC::ExistsService "${ServiceName}"
Pop $0
${If}
$0 = 0
SimpleSC::GetServiceStatus "${serviceName}"
${If} $0 == 0
${If} $1 != 1
SimpleSC::StopService "${serviceName}" 1 ${Timeout} ; 1 - wait 60 - timeouts in secs
Pop $0
${Endif}
${Endif}
${Endif}
Pop $1
Exch $0
!macroend

Function GetServiceErrorReturnCode
ClearErrors
Exch $0
${If} $0 != 0
Push "0 not equal 0. service action returned $0 ."
Push $0
SimpleSC::GetErrorMessage
Pop $0
${Endif}
Pop $0
FunctionEnd

!macro GetServiceErrorReturnCode RetCode
Push "${RetCode}"
Call GetServiceErrorReturnCode
!macroend Section

!insertmacro ServiceStop "SN" 10
Pop $0
${If} $0 != 0
!insertmacro GetServiceErrorReturnCode $0
MessageBox MB_OK "$0"
${Endif}
SectionEnd
shekara is offline   Reply With Quote
Reply
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