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: 561
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 installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: 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: 5,411
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: 114
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,434
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: 225
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: 5,411
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: 5,411
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
Old 2nd May 2021, 18:16   #135
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 114
SimpleSC Unicode Version released!

Dear all,

I know this thread is really pretty old but I'm happy to can say that I'm released the unicode version of the SimpleSC-Plugin so that NSIS 3.x is fully supported now. This plugin version has the same functions like the ANSI version. The ANSI version is still supported. You can find both versions here: https://nsis.sourceforge.io/NSIS_Simple_Service_Plugin

Thanks to Gabriel how triggered me to finish this port.

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 6th August 2021, 17:30   #136
stopthemess
Junior Member
 
Join Date: Dec 2012
Posts: 11
Thank you for your work. The plugin works nicely, but it's very large (1mb). In fact, it's larger than my installed app! Can something be done about it? Thanks.

Perhaps you're bringing in UI code, which can be removed to reduce the file size.
See:
https://forum.lazarus.freepascal.org...?topic=29171.0

Also relevant pages I found:
https://freepascalanswers.wordpress....ecutable-size/
https://wiki.freepascal.org/Size_Matters
stopthemess is offline   Reply With Quote
Old 6th August 2021, 17:40   #137
stopthemess
Junior Member
 
Join Date: Dec 2012
Posts: 11
I see that the ANSI version is 62 KB, a lot smaller than the 1 MB Unicode version.
stopthemess is offline   Reply With Quote
Old 17th August 2021, 19:44   #138
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 114
Hi,

I know that the size is huge and there is no UI code in the DLL. If I create an empty DLL with Delphi 10.3 (RIO) (I'm not using Lazarus) the size is in "Release" mode 1 MB by default - in "Debug" around 5 MB.

I tried to remove the RTTI features which reduces the size to ~800KBs. I don't know if this is it worth - but I can do this with the next release.

Other options are:
- Use the ANSI DLL and a non Unicode Installer
- Use a better compressor in the NSIS setup to reduce the size of your installer
- Use UPX and compress the SimpleSC plugin (in my opinion the worst solution)
- Don't use the plugin and use Windows "net sh" or "sc" commands. (in my opinion the unprofessional solution)


The plugin is used only by the installer. Therefore I think a 1MB DLL is huge but in >= 2021 the size should no longer matter so much (it's only my opinion!)

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 17th August 2021, 19:50   #139
stopthemess
Junior Member
 
Join Date: Dec 2012
Posts: 11
Thank you for the reply. So how's the ANSI DLL not so large?
Perhaps you can also try this:
https://engineertips.wordpress.com/2...ble-file-size/
There are also tips here, perhaps something can be useful:
https://stackoverflow.com/q/3199476/2604492
https://stackoverflow.com/a/2150478/2604492
stopthemess is offline   Reply With Quote
Old 17th August 2021, 23:11   #140
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 114
The ANSI file was compiled with Delphi 6. The unicode version was compiled with Delphi 10.3 (Rio).

I just tried your links but nothing of this really worked. When I add the Linker to use the runtime library I get in NSIS the same result as my last input parameter. If I set the PeFlags to 1 I get the same behaviour.

What seems to work is to remove RTTI. That reduce the size to 800KB. I think thats all what I can do.

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 17th August 2021, 23:24   #141
stopthemess
Junior Member
 
Join Date: Dec 2012
Posts: 11
Hmmm, and what if you use Delphi 2009? Sorry for nagging, but as you said "using sc/net - the unprofessional solution", it feels to me that bringing a 1mb plugin is also an unprofessional solution.
stopthemess is offline   Reply With Quote
Old 17th August 2021, 23:33   #142
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 114
Hey,

I think a 1MB plugin DLL with native NSIS support is a professional solution - 1MB is really not so huge - not 2021. The installer size is not so much greater if you select a good compressor. Therefore there should be no reason not using this DLL.

If you disagree - no problem... you can try it on your own. Buy and download Delphi 2009, use my code and try it. Feel free to change whatever you want - its open source .

Best regards

Rainer
Speed78 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