Old 18th January 2012, 07:25   #121
sr164w
Junior Member
 
Join Date: Nov 2011
Posts: 10
Can I use this plugin in for commercial use of my installer?
sr164w is offline   Reply With Quote
Old 19th January 2012, 05:22   #122
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 506
Send a message via ICQ to T.Slappy
By default all plug-ins can be used in commercial installers.
If it is not strictly prohibited in plug-in readme then feel free to use it.

Cool looking skinned Graphical Installers: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsignedsw.com
Develop NSIS projects in Visual Studio 2005-2017: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.2 Tokyo: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 10th December 2012, 09:44   #123
dixonich
Junior Member
 
Join Date: Dec 2012
Posts: 1
Hello! My problem. Services plug-in not work! Help please!Service does not start!
code:

!define PRODUCT_NAME "MyApp"
!define PRODUCT_VERSION "19"
!define pkgdir "C:\Swe"

!include "MUI.nsh"
SetCompressor /SOLID lzma

!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "Russian"

Name "${PRODUCT_NAME}"
Caption "Установка ${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe"
ShowInstDetails show

Section
SetOutPath "C:\"

File "${pkgdir}\SystemTrayDemo.exe"

SimpleSC::InstallService "ServiceStartD" "Testing123D" "16" "2" "C:\SystemTrayDemo.exe" "" "" ""
SimpleSC::StartService "ServiceStartD" "" 30
SectionEnd

dixonich is offline   Reply With Quote
Old 10th December 2012, 14:01   #124
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,576
Can you start it if you run services.msc (Computer management)?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 10th December 2012, 18:23   #125
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Quote:
Originally Posted by dixonich View Post
Hello! My problem. Services plug-in not work! Help please!Service does not start!
code:

!define PRODUCT_NAME "MyApp"
!define PRODUCT_VERSION "19"
!define pkgdir "C:\Swe"

!include "MUI.nsh"
SetCompressor /SOLID lzma

!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE "Russian"

Name "${PRODUCT_NAME}"
Caption "Установка ${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}-${PRODUCT_VERSION}.exe"
ShowInstDetails show

Section
SetOutPath "C:\"

File "${pkgdir}\SystemTrayDemo.exe"

SimpleSC::InstallService "ServiceStartD" "Testing123D" "16" "2" "C:\SystemTrayDemo.exe" "" "" ""
SimpleSC::StartService "ServiceStartD" "" 30
SectionEnd

Which error mesage do you got (GetErrorMessage)? Are you using the unicode version of NSIS?

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 6th October 2013, 07:34   #126
nuoyantaizi
Junior Member
 
Join Date: Oct 2013
Posts: 2
Hi,Speed78
Nice to meet you.I have a problem when use NSIS Simple Service Plugin to install a windows service named "Apache".
When i use "SimpleSC::InstallService ...." ,the service is installed ok,but it can not start,the error is "required components not installed".
I have a try to use "apache/bin/httpd -k install",i saw the dependences are "AFD",and "TCP/IP Protocal Driver / IPSEC driver".
So,how can i use simplesc to install this apache ?

By the way,StartSercie,StopService need 30 seconds,that's so long! My production need to install 4 service on user's computer,so that's need too much time! Can you tell me if the SimpleSC can do this like "sc start httpd","sc stop httpd" ?

Best Regards
From your chinese friend
nuoyantaizi is offline   Reply With Quote
Old 7th October 2013, 22:45   #127
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Quote:
When i use "SimpleSC::InstallService ...." ,the service is installed ok,but it can not start,the error is "required components not installed".
I have a try to use "apache/bin/httpd -k install",i saw the dependences are "AFD",and "TCP/IP Protocal Driver / IPSEC driver".
So,how can i use simplesc to install this apache ?
Use "AFD/IPSec/Tcpip" as dependencies in the InstallService command (see http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin)
jpderuiter is offline   Reply With Quote
Old 10th October 2013, 14:28   #128
nuoyantaizi
Junior Member
 
Join Date: Oct 2013
Posts: 2
Smile Thank you very much

Quote:
Originally Posted by jpderuiter View Post
Use "AFD/IPSec/Tcpip" as dependencies in the InstallService command (see http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin)
To jpderuiter,
thank you very much!

I have a try what you said,the dependences are installed successfully! thanks again!
But tha apache software can not start yet.i don't know why,i think the software has its own process when use "-k install".but i still thanks you told me how to use the dependence parameter

Another question,do you know how to install a .NET service except using "installutil.exe" ?
I have a .exe that developed by .net framework 4.0,i try to use SimpleSC to install ,and i failed,i must to use the .NET install tool "installutil.exe" to install it.

Ah,do you understand what i said ? ,i am sorry about my english.

but,all of these are ok! i have write a .exe instead of that one.

Thanks again!

i have to improve my english now ,today i met a German teacher,thanks to God,there is a senior student there ,and she can speak german very well~
nuoyantaizi is offline   Reply With Quote
Old 10th October 2013, 16:00   #129
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
You only need to use installutil.exe if the .NET service uses the ServiceInstaller/ServiceProcessInstaller classes to define its install configuration. If you just create the service and only extend the ServiceBase class then you can install it using the normal Windows APIs (i.e. SimpleSC will work).

Stu
Afrow UK is offline   Reply With Quote
Old 30th April 2015, 17:35   #130
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 224
SimpleSC 1.30 crashes the installer when StartService, StopService etc. is used and Timeout parameter is omitted. Took me awhile to figure it out because I was recompiling an old script that worked fine with v1.29. So no big problem but it would be better if it just used the default timeout value instead of crashing.

PostEnd:
aerDNA is offline   Reply With Quote
Old 31st May 2017, 14:01   #131
dothebart
Junior Member
 
Join Date: May 2017
Posts: 6
GetServiceFailure / GetServiceFailureFlag returning 0?

I've been trying to add error handling to my installer; Service registering, adding a description, naming and starting works really well.

I'm producing a case where my service will abort its start, set dwWin32ExitCode to ERROR_SERVICE_SPECIFIC_ERROR, dwServiceSpecificExitCode to 1 and report that back. In that case the regular startup invocation via SimpleSC:

code:

SimpleSC::StartService 'ARANGODB' '' 40
Pop $0
DetailPrint "Status: $0"



Will timeout, and then print out the statuscode 1053 others saw in this Forum too.

Revalidating with sc shows the popper SERVICE_EXIT_CODE 1 :
code:

sc query "ArangoDB"

SERVICE_NAME: ArangoDB
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1066 (0x42a)
SERVICE_EXIT_CODE : 1 (0x1)
CHECKPOINT : 0x0
WAIT_HINT : 0x0



However, trying to invoke these calls as cut'n'pasted from the wiki:
code:

SimpleSC::ServiceIsRunning 'ARANGODB'
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; returns 1 (service is running) - returns 0 (service is not running)
DetailPrint "ServiceIsRunning 0: $0 1: $1 ${TRI_SVC_NAME}"

SimpleSC::GetServiceFailureFlag 'ARANGODB'
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; returns the service flag
DetailPrint "GetServiceFailureFlag 0: $0 1: $1"


SimpleSC::GetServiceFailure 'ARANGODB'
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Pop $1 ; returns the reset period
Pop $2 ; returns the reboot message
Pop $3 ; returns the command
Pop $4 ; returns the first action (See "action_type_x" in the parameters)
Pop $5 ; returns the first action delay
Pop $6 ; returns the second action (See "action_type_x" in the parameters)
Pop $7 ; returns the second action delay
Pop $8 ; returns the third action (See "action_type_x" in the parameters)
Pop $9 ; returns the third action delay
DetailPrint "GetServiceFailure 0: $0 1: $1 2: $2 3: $3 4: $4 5: $5 6: $6 7: $7 8: $8 9: $9"



will only print 0's for all variables.

I've tried not setting the ServiceDescription, not setting the Friendly name, switching the all ASCII servicename from camelcase to uppercase, lowercase... No success...

I'm using NSIS 3.02 via cmake and VS 2015 to compile the service; The Host is a Windows Server 2016; the Installer asks for privileges, which seem to be enough to de/register start/stop the service. Any ideas what else I could try?
dothebart is offline   Reply With Quote
Old 31st May 2017, 17:50   #132
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,576
1053 is ERROR_SERVICE_REQUEST_TIMEOUT "The service did not respond to the start or control request in a timely fashion"

There is no NSIS 3.02 yet, perhaps you just mean SVN trunk?

Works just fine for me
PHP Code:
RequestExecutionLevel admin
Section
!macro TestSvcStuff SVCNAME
SimpleSC
::ServiceIsRunning '${SVCNAME}'
Pop $returns an errorcode (<>0otherwise success (0)
Pop $returns 1 (service is running) - returns 0 (service is not running)
DetailPrint "ServiceIsRunning $$0=$0 $$1=$1 ${SVCNAME}"
SimpleSC::GetServiceFailureFlag '${SVCNAME}'
Pop $returns an errorcode (<>0otherwise success (0)
Pop $returns the service flag
DetailPrint 
"GetServiceFailureFlag 0: $0 1: $1"
SimpleSC::GetServiceFailure '${SVCNAME}'
Pop $returns an errorcode (<>0otherwise success (0)
Pop $returns the reset period 
Pop 
$returns the reboot message
Pop 
$returns the command
Pop 
$returns the first action (See "action_type_x" in the parameters)
Pop $returns the first action delay 
Pop 
$returns the second action (See "action_type_x" in the parameters)
Pop $returns the second action delay 
Pop 
$returns the third action (See "action_type_x" in the parameters)
Pop $returns the third action delay 
DetailPrint 
"GetServiceFailure 0: $0 1: $1 2: $2 3: $3 4: $4 5: $5 6: $6 7: $7 8: $8 9: $9"
!macroend
!insertmacro TestSvcStuff "Fax" Not running
!insertmacro TestSvcStuff "Power" Running
SectionEnd 
Are you actually trying to get the WIN32_EXIT_CODE and SERVICE_EXIT_CODE values?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 1st June 2017, 08:52   #133
dothebart
Junior Member
 
Join Date: May 2017
Posts: 6
Oh, yes. updated from rc2 to .01 ;-)

Yes, I wanted to get the exit codes, so I could detect in the installer whether the service start was aborted by error.

I can actually see non-0 numbers on your power service example, and failures 1060 (similar to invoking sc) for services not installed on that system.

My stopped by startup abort service (as the sc output in the last post) does only give nulls.
dothebart is offline   Reply With Quote
Old 1st June 2017, 12:27   #134
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,576
PHP Code:
!define SVCNAME "Fax"
!include LogicLib.nsh
!define /ifndef SERVICE_QUERY_STATUS 4
System
::Call 'ADVAPI32::OpenSCManager(p0, p0, i1)p.r1'
${If} $1 P<> 0
    System
::Call 'ADVAPI32::OpenService(pr1, t"${SVCNAME}", i${SERVICE_QUERY_STATUS})p.r2'
    
System::Call 'ADVAPI32::CloseServiceHandle(pr1)'
    
${If} $2 P<> 0
        System
::Call 'ADVAPI32::QueryServiceStatus(pr2, @r3)i.r0' NoteNSIS 3syntax to "allocate" a SERVICE_STATUS
        
${If} $<> 0
            System
::Call '*$3(i,i.r4,i,i.r5,i.r6)'
            
DetailPrint "CurrentState=$4 Win32ExitCode=$5 ServiceSpecificExitCode=$6"
        
${EndIf}
        
System::Call 'ADVAPI32::CloseServiceHandle(pr2)'
    
${EndIf}
${EndIf} 
There is a PayPal donation link on the SimpleSC wiki page so perhaps the author would be willing to add it for you...

IntOp $PostCount $PostCount + 1
Anders 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