/// <summary>
 /// Watches the assigned registry keys
 /// </summary>
 /// <remarks>
 /// Because of API limitations no all changes are monitored.
 /// See https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regnotifychangekeyvalue
 /// Not monitored are changes via RegRestoreKey https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regrestorekeya
 /// </remarks>
 public void StartWatcher()
 {
     Logger.Trace("StartWatcher called for {DisableBasePath}", DisableBasePath);
     if (monitor != null)
     {
         Logger.Trace("Watcher already running");
         return;
     }
     lastEnableStatus = GetCurrentEnableStatus();
     monitor          = new RegistryChangeMonitor(DisableBasePath);
     monitor.Changed += ChangeHandler;
     monitor.Error   += ErrorHandler;
     monitor.Start();
     Logger.Trace("Watcher started");
 }
        /// <summary>
        /// Watches the assigned registry keys
        /// </summary>
        /// <remarks>
        /// Because of API limitations no all changes are monitored.
        /// See https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regnotifychangekeyvalue
        /// Not monitored are changes via RegRestoreKey https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regrestorekeya
        /// </remarks>
        public void StartWatcher()
        {
            Logger.Trace("StartWatcher called for {BasePath}", BasePath);
            RegistryDisableService?.StartWatcher();
            if (monitor != null)
            {
                Logger.Trace("Watcher already started");
                return;
            }
            var currentAutoStarts = (List <AutoStartEntry>)GetCurrentAutoStarts();

            lastAutostarts = new List <RegistryAutoStartEntry>();
            foreach (var currentAutoStart in currentAutoStarts)
            {
                lastAutostarts.Add((RegistryAutoStartEntry)currentAutoStart);
            }
            monitor          = new RegistryChangeMonitor(BasePath);
            monitor.Changed += ChangeHandler;
            monitor.Error   += ErrorHandler;
            monitor.Start();
            Logger.Trace("Watcher started");
        }