Corrupted Service cannot be removed from SCM
Hi all, I have been messing with SCM lately, and have created a service of mine ( well actually from an existing code )
Installed it... and edited code some more... and perhaps I forgot to set some param ( like i changed the Service Name perhaps )
After that, the service, ( if I start it at SCM) says that the exe or something cannot be found, tried recreating the service... the exe and installing it again
still nothing happens
I deleted its entries at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\[SERVICE NAME]
and when I go back to SCM, the service is still there although.. I cannot view its properties anymore. :(
How do I remove this entry? It's sore to the eyes really. :sick:
Please help, I can't rest until I removed this one.
and yes, after this grievous mistake I was able to finally make my service working so no problem there. :(
Many thanks in advance :thumb:
Re: Corrupted Service cannot be removed from SCM
You can uninstall the service but sometimes you need to reboot before the changes update in the SCM.
VB Code:
Public Function UnInstallService() As Boolean
Dim hSCManager As Long
Dim hService As Long
Dim lRetVal As Long
hSCManager = OpenSCManager("ComputerName", vbNullString, SC_MANAGER_CREATE_SERVICE)
hService = OpenService(hSCManager, SERVICE_NAME, SERVICE_ALL_ACCESS)
lRetVal = DeleteService(hService)
CloseServiceHandle hService
CloseServiceHandle hSCManager
If lRetVal = 1 Then
UnInstallService = True
Else
UnInstallService = False
End If
End Function
:)
Re: Corrupted Service cannot be removed from SCM
THanks RD, I will try it
... hmm... but I can't view the property page of this particular service already... so I don't know its name :(
I tried shutting down a couple of times but this particular pain of a service is still there. :(
Re: Corrupted Service cannot be removed from SCM
Probably because some of the registry settings are now missing. Hopefully the DeleteService API wil overcome this (holding breath and crossing fingers...).
:D
Re: Corrupted Service cannot be removed from SCM
Hmmm... okie will try later. :(
I deleted the registry settings because... that's what adam said.. it would do remove the service...
I'll try this code ('cause I'm doing a rushed project today) but if it won't do, then I might just have to live with it (anyways it is not my laptop *evil laugh*)... :(