diff --git a/src/ServiceControlInstaller.Engine/Services/ServiceRecoveryHelper.cs b/src/ServiceControlInstaller.Engine/Services/ServiceRecoveryHelper.cs index fface96256..4fab1b06c7 100644 --- a/src/ServiceControlInstaller.Engine/Services/ServiceRecoveryHelper.cs +++ b/src/ServiceControlInstaller.Engine/Services/ServiceRecoveryHelper.cs @@ -80,8 +80,7 @@ public static void SetRecoveryOptions(string serviceName) void SetRestartOnFailure(string serviceName) { - const int actionCount = 2; - const uint delay = 60000; + const int actionCount = 3; var service = IntPtr.Zero; var failureActionsPtr = IntPtr.Zero; @@ -95,18 +94,27 @@ void SetRestartOnFailure(string serviceName) var action1 = new SC_ACTION { Type = SC_ACTION_TYPE.SC_ACTION_RESTART, - Delay = delay + Delay = 10000 }; Marshal.StructureToPtr(action1, actionPtr, false); var action2 = new SC_ACTION { - Type = SC_ACTION_TYPE.SC_ACTION_NONE, - Delay = delay + Type = SC_ACTION_TYPE.SC_ACTION_RESTART, + Delay = 30000 }; + Marshal.StructureToPtr(action2, (IntPtr)((long)actionPtr + Marshal.SizeOf(typeof(SC_ACTION))), false); + var action3 = new SC_ACTION + { + Type = SC_ACTION_TYPE.SC_ACTION_RESTART, + Delay = 60000 + }; + + Marshal.StructureToPtr(action3, (IntPtr)((long)actionPtr + (Marshal.SizeOf(typeof(SC_ACTION)) * 2)), false); + var failureActions = new SERVICE_FAILURE_ACTIONS { dwResetPeriod = 0,