Пример #1
0
        public static Dictionary <string, Models.Tuple <string, bool> > LoadStartupItems()
        {
            StartupItemHolderClass startupItemHolderClass = new StartupItemHolderClass();

            using (RegistryKey hkcrRun = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run")) {
                startupItemHolderClass.UpdateStartupDictionaryForKey(hkcrRun, true);
            }
            using (RegistryKey hkcrRunDisabled =
                       Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run-")) {
                startupItemHolderClass.UpdateStartupDictionaryForKey(hkcrRunDisabled, false);
            }
            using (RegistryKey hklmRun = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run")) {
                startupItemHolderClass.UpdateStartupDictionaryForKey(hklmRun, true);
            }
            using (RegistryKey hklmRunDisabled = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run-")) {
                startupItemHolderClass.UpdateStartupDictionaryForKey(hklmRunDisabled, false);
            }
            if (WindowsVer.Is64BitOs())
            {
                using (RegistryKey hklmWowRun = Registry.LocalMachine.OpenSubKey(@"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run")) {
                    startupItemHolderClass.UpdateStartupDictionaryForKey(hklmWowRun, true);
                }
            }
            return(startupItemHolderClass.StartupItemDictionary);
        }
 public static Dictionary<string, Models.Tuple<string, bool>> LoadStartupItems()
 {
     StartupItemHolderClass startupItemHolderClass = new StartupItemHolderClass();
     using (RegistryKey hkcrRun = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run")) {
         startupItemHolderClass.UpdateStartupDictionaryForKey(hkcrRun, true);
     }
     using (RegistryKey hkcrRunDisabled =
             Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run-")) {
         startupItemHolderClass.UpdateStartupDictionaryForKey(hkcrRunDisabled, false);
     }
     using (RegistryKey hklmRun = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run")) {
         startupItemHolderClass.UpdateStartupDictionaryForKey(hklmRun, true);
     }
     using (RegistryKey hklmRunDisabled = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run-")) {
         startupItemHolderClass.UpdateStartupDictionaryForKey(hklmRunDisabled, false);
     }
     if (WindowsVer.Is64BitOs()) {
         using (RegistryKey hklmWowRun = Registry.LocalMachine.OpenSubKey(@"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run")) {
             startupItemHolderClass.UpdateStartupDictionaryForKey(hklmWowRun, true);
         }
     }
     return startupItemHolderClass.StartupItemDictionary;
 }