Restart Windows 8.1 local Service from a C++ app?

102 views Asked by At

I have a C++ desktop app that talks to a foreign (not written by me) Windows 8.1 Local Service. The service talks to a USB device. Unfortunately, the service has a bug that causes it to become unresponsive if the USB device is detached, even if detached properly using the USB device manager utility. Currently I have to go into the Windows 8.1 Local Services control panel and restart the service manually.

I can detect if the service is unresponsive from my app. So what I want to do is if upon startup I detect that condition, I restart the service from my app. Is there a WinApi or other call or technique available that will help me do that? I've found some C# examples like this one:

How to restart windows service?

But nothing for C++. I am using Visual Studio 2013 for development.

1

There are 1 answers

1
MSalters On

Just call ControlService. [Filler]