How to unistall a service
Hello everybody, I have created my own service and now I'm finally able to see it in SCM. So it's installed and is running correctly. I can start it and stop it. But how can I unistall it? I mean, how can I remove it so that it doesn't appear in the SCM anymore?
Thank you,
Annalisa
# 1 Re: How to unistall a service
Hello everybody, I have created my own service and now I'm finally able to see it in SCM. So it's installed and is running correctly. I can start it and stop it. But how can I unistall it? I mean, how can I remove it so that it doesn't appear in the SCM anymore?
Thank you,
Annalisa
Please look up - DeleteService (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/deleteservice.asp)
The web-page contains a link to a sample too.
Ciao,
Sid :wave:
# 2 Re: How to unistall a service
I called that function but it doesn't fit to my situation if I'm not wrong. In fact my exe is already running..I mean, I rewrote the code with that function , but I still have th first one running. I hope if i have been clear
# 3 Re: How to unistall a service
I called that function but it doesn't fit to my situation if I'm not wrong. In fact my exe is already running..I mean, I rewrote the code with that function , but I still have th first one running. I hope if i have been clear
The Service will be deleted only after all handles to it have been released. So, this is a Win API to be called by an Installer or an outside-application intending to delete the service from the sytem.
To quote MSDN -
The database entry is not removed until all open handles to the service have been closed by calls to the CloseServiceHandle function, and the service is not running.
Also, hope you read this line -
A running service is stopped by a call to the ControlService function with the SERVICE_CONTROL_STOP control code.
And this one -
If the service cannot be stopped, the database entry is removed when the system is restarted.
So - if your call to DeleteService succeeded, restart your system, and let me know if the Service is now de-registered from SCM.
Sid
# 4 Re: How to unistall a service
You were right. I was just a bit silly! :) I have called DeleteService() in the right way and from another application and the service has been deleted. Sorry.
Thank you so much!! :D
Annalisa
# 5 Re: How to unistall a service
You were right. I was just a bit silly! :) I have called DeleteService() in the right way and from another application and the service has been deleted. Sorry.
Thank you so much!! :D
Annalisa
You are welcome. ;)
Ciao,
Sid!