I have a server application running as a service. Let's say the name of the executable is MyService.exe. I have built in some service controlling features in my service.
"MyService.exe -i" is installing the service by calling CreateService(...)
"MyService.exe -r" removes the service from the system by calling DeleteService(...)
I have two versions of the service with different names. The name of the service is hardcoded, i.e. once I've compiled MyService.exe with CreateService (..."ServiceA"...) and the second time with CreateService(..."ServiceB"...). So far I have two executables in two different directories.
If I call "ServiceA\MyService.exe -i", the ServiceA is registered. When I start the Windows Service Control Manager, I see the newly installed service and can start/stop it manually. It's the same for "ServiceB\MyService.exe -i", ServiceB is registered and can be started/stopped.
So far everything worked fine, but now I'm facing a problem: When ServiceA is running, I cannot install ServiceB. "ServiceB\MyService.exe -i" returns immediately without executing a single line of code (I've inserted a printf command on the first line in the main-method ) and no error message either. If ServiceA is installed but not running, I can install and register ServiceB without problems.
Once both services are installed, I can run both of them at the same time without any problems.
Any idea where the problem is? Thanks a lot for your help in advance...