Old 2nd February 2005, 15:53   #1
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
Exclamation How can I DISABLE a windows service?

Hi, I have a question.
How can I DISABLE a windows service?
what instructions should I use?
Chilli24 is offline   Reply With Quote
Old 2nd February 2005, 16:23   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Use the services plugin from here:
http://nsis.sourceforge.net/archive/download.php

-Stu
Afrow UK is offline   Reply With Quote
Old 2nd February 2005, 20:50   #3
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
Thanks for your reply but that doesn't help me very much. I need to DISABLE a service not to pause or stop it.
Any ideea how I can do that?
Chilli24 is offline   Reply With Quote
Old 3rd February 2005, 11:09   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Tried...
services::SendServiceCommand 'disable' 'MyServiceName'
...?

If that doesn't work, use this (DOS command):
http://www.computerhope.com/disable.htm#03

You can call it like so:
ReadEnvStr $R0 COMSPEC
nsExec::Exec "'$R0' /C '<command>'"

-Stu
Afrow UK is offline   Reply With Quote
Old 3rd February 2005, 11:26   #5
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
I've tried both examples. None of them worked. Here is the code:
Example 1:

Section "disable help"
services::SendServiceCommand 'disable' 'helpsvc'
SectionEnd
; here the compiler says invalid command

Example 2:

Section "disable help"
ReadEnvStr $R0 COMSPEC
nsExec::ExecToLog "'$R0' /C 'disable helpsvc'"
SectionEnd
; no errors but it does nothing

Am I doing something wrong?
Chilli24 is offline   Reply With Quote
Old 3rd February 2005, 16:10   #6
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
I found the answer. Here is the code to disable Help and Support service for example:

nsExec::ExecToLog 'sc config helpsvc start= "disabled"'
Chilli24 is offline   Reply With Quote
Old 4th February 2005, 19:23   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Look at the bottom of the following page:

http://www.experts-exchange.com/Prog..._20806097.html

It shouldn't be hard to compile that as a plug-in. You can also compile it as a regular DLL and call it with the System plug-in.

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 4th February 2005, 22:05   #8
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
Unhappy

I wasn't able to compile that as a dll file. It gave me some errors. I've created a different dll but I'm not sure is perfectly build though. I've also read the "Calling an external DLL using the System.dll plugin" article but I didn't quite understand how to call from inside .nsi the function from my dll file.
If someone has time to help I would appreciate that.
Thanks.
Attached Images
File Type: bmp stivadll.dll.bmp (24.0 KB, 133 views)
Chilli24 is offline   Reply With Quote
Old 4th February 2005, 22:26   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The DLL you've attached doesn't have any exported functions, so there's nothing to call.

Open up Contrib\ExDLL\exdll.dsw and add the code in exdll.c. Compile it in release mode and you should your plug-in ready for usage in the Plugins folder. To use it, use this in your script:
code:
ExDLL::ExportedFunctionName parameters

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 4th February 2005, 22:48   #10
Chilli24
Member
 
Chilli24's Avatar
 
Join Date: Jan 2005
Location: Seattle, WA
Posts: 66
Thanks. I will try this. But, do you think that the dll file is good for what I need? Do you think the function ReconfigureSampleService is correctly build?
Chilli24 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