// Token: 0x06000002 RID: 2 RVA: 0x000020F8 File Offset: 0x000002F8 public static void Main(string[] args) { CommonDiagnosticsLog.Initialize(HostId.MailboxDeliveryService); MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StartProcess); int num = Privileges.RemoveAllExcept(new string[] { "SeAuditPrivilege", "SeChangeNotifyPrivilege", "SeCreateGlobalPrivilege" }); if (num != 0) { Environment.Exit(num); } MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.RegisterWatson); ExWatson.Init("E12IIS"); AppDomain.CurrentDomain.UnhandledException += MailboxTransportDeliveryService.MainUnhandledExceptionHandler; MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.RegisterWatsonAction); ExWatson.RegisterReportAction(new WatsonRegKeyReportAction(MailboxTransportDeliveryService.watsonRegKeyReportActionString), WatsonActionScope.Process); MailboxTransportDeliveryService.runningAsService = !Environment.UserInteractive; bool flag = false; bool flag2 = false; foreach (string text in args) { if (text.StartsWith("-?", StringComparison.Ordinal)) { MailboxTransportDeliveryService.Usage(); Environment.Exit(0); } else if (text.StartsWith("-console")) { flag = true; } else if (text.StartsWith("-wait")) { flag2 = true; } } if (!MailboxTransportDeliveryService.runningAsService) { if (!flag) { MailboxTransportDeliveryService.Usage(); Environment.Exit(0); } Console.WriteLine("Starting {0}, running in console mode.", Assembly.GetExecutingAssembly().GetName().Name); if (flag2) { Console.WriteLine("Press ENTER to continue."); Console.ReadLine(); } } MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.InitializePerformanceCounterInstance); Globals.InitializeSinglePerfCounterInstance(); SettingOverrideSync.Instance.Start(true); MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.LoadTransportAppConfig); string text2; if (!Components.TryLoadTransportAppConfig(out text2)) { MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStartFailure, null, new string[] { text2 }); MailboxTransportDeliveryService.PublishServiceStartFailureNotification(text2); Environment.Exit(1); } MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.CreateService); MailboxTransportDeliveryService.mailboxTransportDeliveryService = new MailboxTransportDeliveryService(); if (!MailboxTransportDeliveryService.runningAsService) { ExServiceBase.RunAsConsole(MailboxTransportDeliveryService.mailboxTransportDeliveryService); return; } ServiceBase.Run(MailboxTransportDeliveryService.mailboxTransportDeliveryService); }
// Token: 0x06000005 RID: 5 RVA: 0x00002340 File Offset: 0x00000540 protected override void OnStartInternal(string[] args) { MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StartService); MailboxTransportDeliveryService.diag.TracePfd <int, DateTime>(0L, "PFD EMS {0} Starting MailboxDeliveryService ({1})", 24475, DateTime.UtcNow); bool flag = false; bool flag2 = false; string text = string.Empty; try { MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.RegisterPamComponent); ProcessAccessManager.RegisterComponent(this); MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StartMessageTracking); MessageTrackingLog.Start("MSGTRKMD"); MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.LoadConfiguration); StorageExceptionHandler.Init(); DeliveryConfiguration.Instance.Load(MailboxTransportDeliveryService.messageListener); try { ProcessAccessManager.RegisterComponent(SettingOverrideSync.Instance); this.isDiagnosticHandlerRegisteredForSettingOverrideSync = true; } catch (RpcException ex) { MailboxTransportDeliveryService.diag.TraceError <string>(0L, "Failed to register SettingOverride component with Rpc Server. Error : {0}", ex.ToString()); } MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.StartBackgroundThread); MailboxTransportDeliveryService.backgroundThread = new BackgroundThreadDelivery(); MailboxTransportDeliveryService.backgroundThread.Start(false, ServiceState.Active); MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStartSuccess, null, new string[0]); MailboxTransportDeliveryService.LogStage(MailboxTransportDeliveryService.Stage.ServiceStarted); MailboxTransportDeliveryService.diag.TracePfd <int>(0L, "PFD EMS {0} MailTransportDeliveryService Started", 26523); flag = true; } catch (ADTransientException ex2) { MailboxTransportDeliveryService.diag.TraceError <string>(0L, "Failed to start MailboxDeliveryService. Error: {0}", ex2.ToString()); MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStartFailure, null, new string[] { ex2.ToString() }); MailboxTransportDeliveryService.PublishServiceStartFailureNotification(ex2.Message); Environment.Exit(1); } catch (ConfigurationErrorsException ex3) { text = ex3.Message; flag2 = true; } catch (HandlerParseException ex4) { text = ex4.Message; flag2 = true; } finally { if (!flag) { MailboxTransportEventLogger.LogEvent(MSExchangeDeliveryEventLogConstants.Tuple_DeliveryServiceStartFailure, null, new string[] { text }); MailboxTransportDeliveryService.PublishServiceStartFailureNotification(text); MailboxTransportDeliveryService.diag.TraceError(0L, "Failed to start MailboxDeliveryService"); if (flag2) { base.Stop(); } } } }