예제 #1
0
        // Token: 0x06000001 RID: 1 RVA: 0x000020D0 File Offset: 0x000002D0
        public static void Main(string[] args)
        {
            List <string> list = new List <string>();

            list.Add("SeAuditPrivilege");
            list.Add("SeChangeNotifyPrivilege");
            list.Add("SeCreateGlobalPrivilege");
            list.Add("SeImpersonatePrivilege");
            bool isSystem;

            using (WindowsIdentity current = WindowsIdentity.GetCurrent())
            {
                isSystem = current.IsSystem;
            }
            if (isSystem)
            {
                list.Add("SeIncreaseQuotaPrivilege");
                list.Add("SeAssignPrimaryTokenPrivilege");
            }
            int num = Privileges.RemoveAllExcept(list.ToArray());

            if (num != 0)
            {
                Program.main.StopService(Strings.PrivilegeRemovalFailure(num), true, false, false);
            }
            ExWatson.Init();
            AppDomain.CurrentDomain.UnhandledException += Program.MainUnhandledExceptionHandler;
            if (!Program.AddTokenReadPermissionForAdminGroup())
            {
                ExTraceGlobals.GeneralTracer.TraceDebug(0L, "Failed to update the process security descriptor with TOKEN_READ. The result is the managed debugger may fail to attach.");
            }
            Program.main.Run(args);
            Program.Exit(Program.main.immediateRetryAfterExit ? 200 : 0);
        }
예제 #2
0
        private void ExecuteApplicationStart(object sender, EventArgs e)
        {
            int num = 0;

            num = Privileges.RemoveAllExcept(new string[]
            {
                "SeAuditPrivilege",
                "SeChangeNotifyPrivilege",
                "SeCreateGlobalPrivilege",
                "SeImpersonatePrivilege",
                "SeIncreaseQuotaPrivilege",
                "SeAssignPrimaryTokenPrivilege",
                "SeTcbPrivilege"
            }, "MSExchangeServicesSyncPool");
            if (num != 0)
            {
                string name;
                using (WindowsIdentity current = WindowsIdentity.GetCurrent())
                {
                    name = current.Name;
                }
                AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_SetPrivilegesFailure, "SetPrivilegesFailure: " + name, new string[]
                {
                    name,
                    num.ToString(CultureInfo.InvariantCulture)
                });
                Environment.Exit(num);
            }
            ExWatson.Init("E12");
            AppDomain.CurrentDomain.UnhandledException += Global.HandledExceptionProxy;
            Globals.InitializeMultiPerfCounterInstance("AirSync");
            ExRpcModule.Bind();
            AirSyncDiagnostics.TraceInfo <ResourceManagerHandle>(ExTraceGlobals.RequestsTracer, null, "AuthzAuthorization.ResourceManagerHandle static instance loaded", AuthzAuthorization.ResourceManagerHandle);
            AirSyncSyncStateTypeFactory.EnsureSyncStateTypesRegistered();
            FolderSyncState.RegisterCustomDataVersioningHandler(new FolderSyncState.HandleCustomDataVersioningDelegate(FolderSyncStateCustomDataInfo.HandlerCustomDataVersioning));
            FolderHierarchySyncState.RegisterCustomDataVersioningHandler(new FolderHierarchySyncState.HandleCustomDataVersioningDelegate(FolderHierarchySyncStateCustomDataInfo.HandlerCustomDataVersioning));
            EventQueue.PollingInterval = GlobalSettings.EventQueuePollingInterval;
            this.resetAutoBlockedDeviceCounterTimer = new Timer(new TimerCallback(Global.ResetAutoBlockedDeviceCounter), null, 86400000, 86400000);
        }
예제 #3
0
        // 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: 0x0600097F RID: 2431 RVA: 0x000212EC File Offset: 0x0001F4EC
 internal static void RegisterForUnhandledExceptions()
 {
     ExWatson.Init("E12IIS");
     AppDomain.CurrentDomain.UnhandledException += ErrorHandlerUtilities.HandleUnhandledException;
 }