public StartupObject(string name, string fpath, StartupKind skind, string lcommand = "", bool isCritical = false, bool isDisabled = false) { this.Name = name; this.FilePath = fpath; this.Type = skind; this.LaunchCommand = lcommand; this.IsCriticalApp = isCritical; this.IsDisabled = isDisabled; }
public List <StartupObject> GetRootHiveEntries(RegistryKey rootHiveKey, StartupKind keyType) { var regEntries = new List <StartupObject>(); var defaultSubKey = @"Software\Microsoft\Windows\CurrentVersion\Run"; using (RegistryKey rootkey = rootHiveKey.OpenSubKey(defaultSubKey)) { foreach (var key in rootkey.GetValueNames()) { string keyValue = $"{rootkey.GetValue(key)}"; Tuple <string, string> cleanValues = GetCleanRegValues(keyValue); string filepath = cleanValues.Item1; string launchCommand = cleanValues.Item2; var regObject = new StartupObject(key, filepath, keyType, launchCommand); regEntries.Add(regObject); } } return(regEntries); }