Beispiel #1
0
 protected void ConfigureFailureActionsFlag()
 {
     base.DoNativeServiceTask(this.Name, ServiceAccessFlags.AllAccess, delegate(IntPtr service)
     {
         TaskLogger.Trace("Configuring failure actions flag...", new object[0]);
         ServiceFailureActionsFlag serviceFailureActionsFlag         = default(ServiceFailureActionsFlag);
         serviceFailureActionsFlag.fFailureActionsOnNonCrashFailures = this.failureActionsFlag;
         if (!NativeMethods.ChangeServiceConfig2(service, ServiceConfigInfoLevels.FailureActionsFlag, ref serviceFailureActionsFlag))
         {
             base.WriteError(TaskWin32Exception.FromErrorCodeAndVerbose(Marshal.GetLastWin32Error(), Strings.ErrorChangeServiceConfig2(this.Name)), ErrorCategory.WriteError, null);
         }
     });
 }
 public static extern bool ChangeServiceConfig2(IntPtr serviceController, ServiceConfigInfoLevels infoLevel, ref ServiceFailureActionsFlag failureActionsFlag);