Is it possible to have a program restart automatically if it crashes?
Something like:
Let Windows be your watchdog. You can call ChangeServiceConfig2 to set the failure actions for your service. (If your server isn't a service, then you're doing it wrong.) Specify SERVICE_CONFIG_FAILURE_ACTIONS
for the dwInfoLevel
parameter, and in the SERVICE_FAILURE_ACTIONS structure, set lpsaActions
to an array of one or more SC_ACTION values. The type you want is SC_ACTION_RESTART
.