Results 1 to 5 of 5

Thread: Corrupted Service cannot be removed from SCM

  1. #1

    Thread Starter
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    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.

    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

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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:
    1. Public Function UnInstallService() As Boolean
    2.  
    3.     Dim hSCManager As Long
    4.     Dim hService As Long
    5.     Dim lRetVal As Long
    6.  
    7.     hSCManager = OpenSCManager("ComputerName", vbNullString, SC_MANAGER_CREATE_SERVICE)
    8.     hService = OpenService(hSCManager, SERVICE_NAME, SERVICE_ALL_ACCESS)
    9.     lRetVal = DeleteService(hService)
    10.     CloseServiceHandle hService
    11.     CloseServiceHandle hSCManager
    12.     If lRetVal = 1 Then
    13.         UnInstallService = True
    14.     Else
    15.         UnInstallService = False
    16.     End If
    17.  
    18. End Function
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    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.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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...).

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    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*)...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width