// Token: 0x0600000A RID: 10 RVA: 0x00002AC8 File Offset: 0x00000CC8 private void TimeSliceThreadMain() { int num = 0; AntispamUpdates antispamUpdates = new AntispamUpdates(); string microsoftUpdateCabPath = AntispamUpdateSvc.GetMicrosoftUpdateCabPath(); while (!this.timeSliceThreadShutdown.WaitOne(num, false)) { try { antispamUpdates.LoadConfiguration(string.Empty); OptInStatus optInStatus = this.hygieneUpdate.SetMicrosoftUpdateOptinStatus(antispamUpdates.MicrosoftUpdate, microsoftUpdateCabPath); if (optInStatus != antispamUpdates.MicrosoftUpdate) { antispamUpdates.MicrosoftUpdate = optInStatus; antispamUpdates.SaveConfiguration(string.Empty); } } catch (SecurityException ex) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuOptFail, null, new string[] { ex.Message }); } catch (IOException ex2) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuOptFail, null, new string[] { ex2.Message }); } catch (UnauthorizedAccessException ex3) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuOptFail, null, new string[] { ex3.Message }); } if (antispamUpdates.MicrosoftUpdate == OptInStatus.Configured && antispamUpdates.UpdateMode == AntispamUpdateMode.Automatic) { this.hygieneUpdate.DoUpdate(); } num = AntispamUpdateSvc.pollInterval * 1000; if (this.hygieneUpdate.ConsoleDiagnostics) { Console.WriteLine("Sleeping {0} Seconds", num / 1000); } } }
// Token: 0x06000004 RID: 4 RVA: 0x00002528 File Offset: 0x00000728 public OptInStatus SetMicrosoftUpdateOptinStatus(OptInStatus optIn, string cabLocation) { bool flag = optIn == OptInStatus.RequestDisabled || optIn == OptInStatus.RequestNotifyDownload || optIn == OptInStatus.RequestNotifyInstall || optIn == OptInStatus.RequestScheduled; try { IWindowsUpdateAgentInfo windowsUpdateAgentInfo = new WindowsUpdateAgentInfoClass(); string text = windowsUpdateAgentInfo.GetInfo("ProductVersionString") as string; if (string.IsNullOrEmpty(text)) { if (flag) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuOpt, null, new string[0]); } if (this.ConsoleDiagnostics) { Console.WriteLine("Unable to determine WUA Version"); } return(OptInStatus.NotConfigured); } Version v = new Version(text); if (v < HygieneUpdate.AgentMinVersion) { if (flag) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuOpt, null, new string[0]); } if (this.ConsoleDiagnostics) { Console.WriteLine("Out of date client"); } return(OptInStatus.NotConfigured); } } catch (COMException) { if (flag) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuOpt, null, new string[0]); } if (this.ConsoleDiagnostics) { Console.WriteLine("Unable to determine Windows Update Agent version"); } return(OptInStatus.NotConfigured); } try { IUpdateServiceManager updateServiceManager = new UpdateServiceManagerClass(); foreach (object obj in updateServiceManager.Services) { IUpdateService updateService = (IUpdateService)obj; if (this.ConsoleDiagnostics) { Console.WriteLine("Service {0}: {1} {2}", updateService.ServiceID, updateService.IsRegisteredWithAU, updateService.IsManaged); } if ((string.Compare("7971f918-a847-4430-9279-4a52d1efe18d", updateService.ServiceID, StringComparison.OrdinalIgnoreCase) == 0 && updateService.IsRegisteredWithAU) || updateService.IsManaged) { if (this.ConsoleDiagnostics) { Console.WriteLine("Microsoft Update already registered."); } return(OptInStatus.Configured); } } if (!flag) { return(OptInStatus.NotConfigured); } if (string.IsNullOrEmpty(cabLocation)) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuOpt, null, new string[0]); if (this.ConsoleDiagnostics) { Console.WriteLine("Invalid CAB location"); } } updateServiceManager.AddService("7971f918-a847-4430-9279-4a52d1efe18d", cabLocation); updateServiceManager.RegisterServiceWithAU("7971f918-a847-4430-9279-4a52d1efe18d"); IAutomaticUpdates automaticUpdates = new AutomaticUpdatesClass(); if (!automaticUpdates.Settings.ReadOnly && automaticUpdates.Settings.NotificationLevel == null) { automaticUpdates.Settings.NotificationLevel = optIn; automaticUpdates.Settings.ScheduledInstallationDay = 0; automaticUpdates.Settings.Save(); } } catch (COMException ex) { if (flag) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuOptFail, null, new string[] { ex.Message }); } if (this.ConsoleDiagnostics) { Console.WriteLine("Failed: {0}", ex.Message); } return(OptInStatus.NotConfigured); } catch (InvalidCastException ex2) { UpdateSvcEventLogger.LogEvent(AntispamUpdateServiceEventLogConstants.Tuple_MuGetFail, null, new string[] { ex2.Message }); if (this.ConsoleDiagnostics) { Console.WriteLine("Failed: {0}", ex2.Message); } return(OptInStatus.NotConfigured); } return(OptInStatus.Configured); }