1

I am referencing this answered question...

I see that one can manually configure a service to restart using Services control panel. Is there a way to set these values in code, either from the Service itself or, more likely, from the Service Installer?

Community
  • 1
  • 1
Cesar Maiorino
  • 563
  • 5
  • 16

2 Answers2

2

Use the SERVICE_CONFIG_FAILURE_ACTIONS option of the ChangeServiceConfig2 function.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
2

I did not specify it in my original question, but I am working in c#./net, and had some trouble getting the calls to win32 just right (I don't have a lot of experience in this area). In the end, I found a nice implementation/explanation, which helped me finally get it right.

Here's the link:

http://netcode.ru/dotnet/?lang=&katID=30&skatID=277&artID=7660

Cesar Maiorino
  • 563
  • 5
  • 16