Hi All,
I've written a service and I'm having trouble uninstalling it. Rather than just uninstalling the OS marks the service for deletion and gives this error if I try and uninstall again:
ERROR_SERVICE_MARKED_FOR_DELETE
The initial removal returns no error.
I know a reboot is a temprary solution.
What could I be doing wrong?
Thanks, rotis23Code:int MyDeleteService() { SC_HANDLE hService,schSCManager; config *my_config; if(InitService(my_config)) { printf("Error initialising - check config file!\n"); return 1; } schSCManager = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS); if (schSCManager == NULL) return GetLastError(); hService=OpenService(schSCManager,my_config->my_server.serviceName,SERVICE_ALL_ACCESS); if (hService == NULL) return GetLastError(); if(DeleteService(hService)==0) return GetLastError(); if(CloseServiceHandle(hService)==0) return GetLastError(); CleanupService(); return 0; }



LinkBack URL
About LinkBacks


