Old 22nd July 2008, 13:45   #41
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
This to me would suggest a problem with the service itself. I personally have had no problems with SimpleSC installing, starting, stopping or uninstalling services.

I have seen that kind of error in a service that does not start the main thread in its start method.

Stu
Afrow UK is offline   Reply With Quote
Old 22nd July 2008, 20:01   #42
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hello Till,

please try this script:

----------------------
Name "test"
OutFile "test.exe"

!Define SERVICE "TapiSrv"

Section
MessageBox MB_OK "NOTE: Result '0' means it was success otherwise '1'"

MessageBox MB_OK "Starting Service: ${SERVICE}"
SimpleSC::StartService "${SERVICE}" ""
Pop $0
MessageBox MB_OK "Result: $0"

SectionEnd
----------------------

This script will start the tapi service (In german: "Telefonie"... I don´t know the name in english )

I tested this script without any problems. If you also have no problems with this script I think the problem is your service. Can you check this and please give me a feedback!?

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 23rd July 2008, 07:13   #43
elllit
Junior Member
 
Join Date: Jun 2008
Location: Germany
Posts: 18
Speed78,

thanks for helping me.

The result your skript gives me is "1056".

The service "Telefonie" is running on my system and I can't stop it apperently (Error "1053" again). When I try to stop it via the services control list it says it needs to stop "RAS-Verbindungsverwaltung" which has "Telefonie" as a dependency. This is where the error comes into place. I guess it is used in the background somehow(?).

I'll talk with guys who code the service to check if the problem is on that side, following Afrow UK's suggestion which I also considered as another spot to search for a solution. But trying to find the error on oneself is the first way to go, isn't it?

Till
elllit is offline   Reply With Quote
Old 23rd July 2008, 10:52   #44
elllit
Junior Member
 
Join Date: Jun 2008
Location: Germany
Posts: 18
Update:

I manged to get one service running with the help of a developer. The problem was that a dependency wasn given for the service, which I didn't know about.

Anyways, installing the other service mine is depending on solved the problem.

I hope its as "easy" with the other service. I will ask the colleague on monday and report about it.

I apology for bothering you as it was a fault on my side
elllit is offline   Reply With Quote
Old 14th August 2008, 21:02   #45
elunkes
Junior Member
 
Join Date: Aug 2008
Location: Sao Paulo - Brazil
Posts: 5
How can i get the LOGON NAME in a service

we have

SimpleSC::SetServiceLogon [name_of_service] [account] [password]

but i want something like this

GetServiceLogon (or something)

can ai get it ?
elunkes is offline   Reply With Quote
Old 15th August 2008, 02:37   #46
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hi,

the next day I will released a new version of the plugin. I will implement this function in the new version.

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 17th August 2008, 17:01   #47
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
New Version 1.22

Hi,

I´ve released a new version of the NSIS Simple Service Plugin. The changes are:


- SimpleSC::GrantServiceLogonPrivilege and SimpleSC::RemoveServiceLogonPrivilege works now correct with domain names like MyDomain\MyUser.

- Added function SimpleSC::GetServiceLogon to get the logon username of a service.


You can find more informations and download file on the wiki page (http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin).

Thanks to everyone for reporting bugs and requesting features. If you have any questions please let me now.

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 18th August 2008, 14:27   #48
elunkes
Junior Member
 
Join Date: Aug 2008
Location: Sao Paulo - Brazil
Posts: 5
Hi Speed78,

this version of SimpleSC was detected as a TROJAN when i used it in my compilation script

With version 1.21 there is no problem (but also there is no new functions)

without a antivirus , the new functions works right.

i'm using "Avast" in my computer.

could you review this version 1.22?

thank you
elunkes is offline   Reply With Quote
Old 18th August 2008, 17:40   #49
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hi,

I´ve checked the file and here the results.


http://www.virustotal.com/en/analisi...4b4943e04615dd

I´ve contacted AntiVir and Webwasher. AntiVir gave me the answer that the file is a FALSE-POSITIVE File and that they will modify the virus definitions. Webwasher gave me no answer at the moment.

I´m really confused about this because I only change some lines in the code and the scanner found a "pseudo"-virus.

I couldn´t determine some problems with "Avast". So you can take a look to the VirusTotal-URL.

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 18th August 2008, 19:55   #50
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
New Version 1.23

Hi,

I´ve released a new version of the NSIS Simple Service Plugin. I detected that the compiler optimazation results in a false-positive virusscan, so I´ve removed it a I hope the problem is solved now.

You can find more informations and download file on the wiki page (http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin).

Thanks to everyone for reporting bugs and requesting features. If you have any questions please let me now.

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 19th August 2008, 00:59   #51
elunkes
Junior Member
 
Join Date: Aug 2008
Location: Sao Paulo - Brazil
Posts: 5
Now it works fine!!

thank you!
elunkes is offline   Reply With Quote
Old 12th February 2009, 11:49   #52
phunkydizco
Junior Member
 
Join Date: Jul 2005
Posts: 19
I have a service that takes some time to stop. How can I stop the service and wait until it is really stopped?
phunkydizco is offline   Reply With Quote
Old 12th February 2009, 15:48   #53
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hello,

take a look at the documentation: http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin

The "SimpleSC::StopService"-Function is what you are searching for.

Kind regards

Rainer

Last edited by Speed78; 12th February 2009 at 16:26.
Speed78 is offline   Reply With Quote
Old 13th April 2009, 11:06   #54
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
New Version 1.24

Hi,

I´ve released a new version of the NSIS Simple Service Plugin. The changes are:


- Fixed wait for status bug if the service status changed. Now, if a service stops, starts aso. the plugin will work like the recommendations in the MSDN. On some systems (especially 64Bit systems) the plugin returns "Stopped" although the service was not really stopped.

It is recommend to update your version of this plugin. You can find more informations and download file on the wiki page (http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin).

If you have any questions please let me now.

Best regards

Rainer
Speed78 is offline   Reply With Quote
Old 18th April 2009, 17:12   #55
amclellan
Junior Member
 
Join Date: Apr 2009
Posts: 2
Setting only the binary path

I've been using version 1.24 of SimpleSC and I really appreciate it's ease of use. I'm currently working on a issue where the a service has been previously installed and now I'm trying to update only the binary path if it happened to be installed in a different location without changing the other settings associated with the service. Is there a SetServiceBinaryPath or some other way of performing this action.

Thanks

Allan McLellan
amclellan is offline   Reply With Quote
Old 18th April 2009, 17:25   #56
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hello Allan,

unfortunately, there is no possiblity to change the binary path. At the moment I recommend the following procedure:

1. Deinstall the service old "RemoveService"
2. Install the new service with the new binary path "InstallService".

Nethertheless, I will add the method "SetServiceBinaryPath" in the next version of this plugin, but this will take some weeks.

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 18th April 2009, 18:07   #57
amclellan
Junior Member
 
Join Date: Apr 2009
Posts: 2
Hi

Thanks for getting back to me so quickly. I'm currently checking to see if the new binary path equals the old binary path and if they don't then pop up a message box requiring the user to manually go in and change it via the service manager. It's not the nicest, but it doesn't really happen all that often. Again thanks for the quick response.

Allan
amclellan is offline   Reply With Quote
Old 18th April 2009, 18:22   #58
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hello Allan,

I think to compare the binary path of the old service with the new service is a good idea. But if the paths are not equal I think it´s more comfortable just to remove the old service (Take a look at SimpleSC::RemoveService) and install it again (Take a look at SimpleSC::InstallService). I think this should work. At the moment there is not possiblity to change the binary path in the service manager directly (AFAIK until Windows 2003). So the only way to change it is via command line "sc.exe".

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 22nd April 2009, 01:32   #59
saill
Junior Member
 
Join Date: Apr 2009
Location: Alameda, CA, USA
Posts: 3
Quote:
Originally posted by elllit


Installing for the standard user works flawlessly. But giving an account name and password it fails with error code 1057 that is: "Account invalid or does not exist" or something... I triple checked the strings and even hardcoded them into the script w/o success. :-(

Im trying to install on a 2003 Server if that might help.

Thanks,

-- Till
Hi Till,

We ran into the same problem. Turns out Windows wants the account name to be preceded by ".\". We figured this out by having Windows report the account owning the service. This works on XP, we're hopeful it will hold for other Windows platforms.

Just to be safe, we started the service as admin, then set service logon to the desired account.

The code that worked looks like this:

SimpleSC::InstallService "MyService" "My Service Display Name" "272" "2" "C:\MyPath\MyService.exe" "" "" ""

SimpleSC::SetServiceLogon "MyService" ".\MyServiceUser" "MyServiceUserPassword"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
IntCmp $0 0 +1 Done Done ; If successful grant the service logon privilege to "MyServiceUser"
; Note: Every serviceuser must have the ServiceLogonPrivilege to start the service
SimpleSC::GrantServiceLogonPrivilege ".\MyServiceUser"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
Done:


Rainer, thanks for the great tool. Really saved our butts with this particular bug!

Saill
saill is offline   Reply With Quote
Old 22nd April 2009, 15:48   #60
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hi Saill,

if I understand you correctly your problem with SetServiceLogon is ".\"-prefix of a non domain-account? I will check this for the next plugin-version.

Kind regards,

Rainer
Speed78 is offline   Reply With Quote
Old 22nd April 2009, 20:55   #61
saill
Junior Member
 
Join Date: Apr 2009
Location: Alameda, CA, USA
Posts: 3
Hi Rainer,

Exactly. My experiments show that any for any [account] input you need to add the ".\" prefix. Once you do that, it works great.

No real need to fix it - a note in the documentation should do the trick.

Thanks a lot for the tool. We used it to make sure that our service was owned by the current user so we could kill our runtime cleanly at shutdown. Solved one of our trickiest Windows bugs!

Warm regards,

Saill
saill is offline   Reply With Quote
Old 23rd April 2009, 16:00   #62
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hello Saill,

I changed it in the online documentation but addionally I will change this in the next version.

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 24th April 2009, 18:17   #63
saill
Junior Member
 
Join Date: Apr 2009
Location: Alameda, CA, USA
Posts: 3
Hi Rainer,

That's great! I believe the .\ prefix is also necessary in the "account" input for:

SimpleSC::InstallSevice
SimpleSC::GrantServiceLogonPrivilege
SimpleSC::RemoveServiceLogonPrivilege

Warm regards,

Saill
saill is offline   Reply With Quote
Old 11th May 2009, 05:13   #64
Sadeesh
Junior Member
 
Join Date: May 2009
Posts: 9
Angry 1053 Error while starting the service

Hi,

I am trying to install a bat file as service.
I am able to create the service, but i am not able to start the service via script.
When i try to start the service manually i get the following windows error message.

"1053 service did not respond to the start or control request in a timely fashion"

Can anyone help me to fix this?

Thanks in advance,
Sadeesh
Sadeesh is offline   Reply With Quote
Old 11th May 2009, 09:37   #65
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,342
You can't use a batch file as a service. Not every program can be used as a service. It must be specifically designed for this purpose. There are some helpers that can turn any application to a service. Google "turn any application to a service" or something similar and you should be able to find them.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 12th May 2009, 07:19   #66
pineapplex
Junior Member
 
Join Date: Apr 2008
Posts: 4
Batch file as service

I found a solution in order to use a Batch file as service. I used Flash Mx to create an EXE file that contains a FSCommand opening the Batch file. At last, the batch file is working as service.

I hope it works for you.

But I have another question:

I have a service running (not a batch file, of course). What's the best way to "interact" with the service? I have the service running but I can't find the way to open my application and change some config parameters, for example.

Can you help me with this issue?

I'm sorry for my english. I hope you can understand me.

Best wishes from Spain.

Last edited by pineapplex; 12th May 2009 at 08:14.
pineapplex is offline   Reply With Quote
Old 15th May 2009, 20:22   #67
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 224
v1.24 - WZCSVC problem

Version 1.24 has a problem (at least on my system) with stopping the Wireless Zero Configuration.
SimpleSC::StopService "WZCSVC" does stop the service but is unaware of the status change and returns an error after the 30 s timeout ("The service did not respond to the start or control request in a timely fashion").
I tried several other windows services and there was no such problem. Version 1.23 deals with WZCSVC successfully. My system is XP SP2 but Wireless Zero Configuration has been updated (hotfix KB917021).

PostEnd:
aerDNA is offline   Reply With Quote
Old 21st May 2009, 15:15   #68
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
New Version 1.25

Hi,

I´ve released a new version of the NSIS Simple Service Plugin. The changes are:

- SimpleSC::SetServiceLogon supports now non-domain username without the ".\"-prefix
- SimpleSC::SetServiceBinaryPath function added

You can find more informations and download file on the wiki page (http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin).

If you have any questions please let me now.

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 21st May 2009, 15:18   #69
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Re: v1.24 - WZCSVC problem

Hello,

Quote:
Originally posted by aerDNA
Version 1.24 has a problem (at least on my system) with stopping the Wireless Zero Configuration.
SimpleSC::StopService "WZCSVC" does stop the service but is unaware of the status change and returns an error after the 30 s timeout ("The service did not respond to the start or control request in a timely fashion").
I tried several other windows services and there was no such problem. Version 1.23 deals with WZCSVC successfully. My system is XP SP2 but Wireless Zero Configuration has been updated (hotfix KB917021).
sry... I read this just now after releasing 1.25. I will check this on XP SP2 the next days. If you stop your service manually (via service control center) how much time takes it to stop the service (> 30 seconds) ?

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 21st May 2009, 15:54   #70
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 224
Re: Re: v1.24 - WZCSVC problem

Quote:
Originally posted by Speed78
If you stop your service manually (via service control center) how much time takes it to stop the service (> 30 seconds) ?
When stopped manually, everything's ok (takes about 2 sec). With SimpleSC 1.23 it's also fine. The problem is with v1.24-1.25. Starting the service works ok in new versions, although it takes several seconds longer than with 1.23.

PostEnd:
aerDNA is offline   Reply With Quote
Old 21st May 2009, 17:12   #71
pineapplex
Junior Member
 
Join Date: Apr 2008
Posts: 4
Hi Rainer,

What's the best way to "interact" with the service? I have the service running but I can't find the way to open my application and change some config parameters, for example.

Excuse me for my "stupid" question but I'm starting to use NSIS and I can't find a solution for this issue.

Thanks in advance.
pineapplex is offline   Reply With Quote
Old 21st May 2009, 19:07   #72
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Re: Re: Re: v1.24 - WZCSVC problem

Hi aerDNA,

Quote:
Originally posted by aerDNA
When stopped manually, everything's ok (takes about 2 sec). With SimpleSC 1.23 it's also fine. The problem is with v1.24-1.25. Starting the service works ok in new versions, although it takes several seconds longer than with 1.23.
I´ve changed the code stop-service in version 1.24 because on some conditions the service doesn´t stop correctly. So please can you give me the following information:

Please try to stop the service via the plugin >= 1.24. Open during stopping the service the service control manager and take a look to the service at the "Status"-column. Which state do you see? "Stopping..."?

Did the service have dependencies?

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 21st May 2009, 19:10   #73
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hi pineapplex,

Quote:
Originally posted by pineapplex
Hi Rainer,

What's the best way to "interact" with the service? I have the service running but I can't find the way to open my application and change some config parameters, for example.

Excuse me for my "stupid" question but I'm starting to use NSIS and I can't find a solution for this issue.

Thanks in advance.
there are several solutions to communicate with a service. You can use a TCP/IP socket, named pipes or shared memory. This depends on your knowledge about this methods and your service requirements.

Use this topics (TCP/IP socket, named pipes or shared memory) to get more addionally informations for you programming language.

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 21st May 2009, 19:37   #74
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Re: Re: Re: Re: v1.24 - WZCSVC problem

Hi aerDNA,

Quote:
Originally posted by Speed78
Hi aerDNA,



I´ve changed the code stop-service in version 1.24 because on some conditions the service doesn´t stop correctly. So please can you give me the following information:

Please try to stop the service via the plugin >= 1.24. Open during stopping the service the service control manager and take a look to the service at the "Status"-column. Which state do you see? "Stopping..."?

Did the service have dependencies?

Kind regards

Rainer
I can reproduce your behaviour now and I will fix asap.

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 21st May 2009, 20:40   #75
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
New Version 1.26

Hi,

I´ve released a new version of the NSIS Simple Service Plugin. The changes are:

- Fixed wait for status bug on starting, stopping, pausing or continuing a service

You can find more informations and download file on the wiki page (http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin).

Thanks to aerDNA for reporting this bug. If you have any questions please let me now.

Kind regards

Rainer
Speed78 is offline   Reply With Quote
Old 22nd May 2009, 14:31   #76
aerDNA
Senior Member
 
aerDNA's Avatar
 
Join Date: Feb 2007
Location: Rijeka, Croatia
Posts: 224
Glad I could help. There are several service plugins but personally I prefer yours. I used it to make a little util aimed specifically at managing WZC / WLAN Autoconfig. Compiled with v1.26 and works like a charm. So thank you.

PostEnd:
aerDNA is offline   Reply With Quote
Old 27th May 2009, 15:12   #77
kalix11
Junior Member
 
Join Date: May 2009
Posts: 6
I tried using V1.26 to Set Logon account info for the Service and was not able to do it. When I visited your plugin page at http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin and found there is a note: The function "SetServiceLogon" only works if the servicetype is "SERVICE_WIN32_OWN_PROCESS"

Would you please explain a little more about this servicetype? And how do I check and adjust the servicetype? Thanks a lot.
kalix11 is offline   Reply With Quote
Old 27th May 2009, 17:15   #78
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hello kalix11,

Quote:
Originally posted by kalix11
I tried using V1.26 to Set Logon account info for the Service and was not able to do it. When I visited your plugin page at http://nsis.sourceforge.net/NSIS_Simple_Service_Plugin and found there is a note: The function "SetServiceLogon" only works if the servicetype is "SERVICE_WIN32_OWN_PROCESS"
At the moment there is no possibility to get or set the service type. I would add these functions in the next version of the plugin.

If you create a service on your own you should know the service type.

Some useful link about the service type can be found here:

http://msdn.microsoft.com/en-us/library/ms681987(VS.85).aspx

See "lpServiceStartName [in, optional]" - lpServiceStartName is the username!

Kind regards

Rainer

Last edited by Speed78; 27th May 2009 at 17:42.
Speed78 is offline   Reply With Quote
Old 27th May 2009, 17:30   #79
kalix11
Junior Member
 
Join Date: May 2009
Posts: 6
Thank you for your reply. I checked my service using some 3rd party tool and found the servicetype is SERVICE_WIN32_OWN_PROCESS. Can you think of any reason why SetServiceLogon is not working? I tried username with ".\" or without ".\", all the same results. Or should I first grant LogonAsService privilege to the user account before I call SetServiceLogon?
kalix11 is offline   Reply With Quote
Old 27th May 2009, 17:48   #80
Speed78
Senior Member
 
Join Date: Jul 2003
Location: Germany
Posts: 109
Hi kalix11,

Quote:
Originally posted by kalix11
Thank you for your reply. I checked my service using some 3rd party tool and found the servicetype is SERVICE_WIN32_OWN_PROCESS. Can you think of any reason why SetServiceLogon is not working? I tried username with ".\" or without ".\", all the same results. Or should I first grant LogonAsService privilege to the user account before I call SetServiceLogon?
You don´t need this "\."-prefix in version 1.26 and you don´t need grant service logon before SetServiceLogon.

Make sure that the user exists. If the user exists please please check the error result using the GetErrorMessage-Function like in this example:

SimpleSC::SetServiceLogon "MyService" "MyServiceUser" "MyServiceUserPassword"
Pop $0 ; returns an errorcode (<>0) otherwise success (0)
IntCmp $0 0 Done +1 +1
Push $0
SimpleSC::GetErrorMessage
Pop $0
MessageBox MB_OK|MB_ICONSTOP "SetServiceLogon fails - Reason: $0"
Done:

Kind 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