public void Load(BinaryReader reader) { // Load system's features WindowsFeature.GetWindowsFeatures(ConfigurationManager.Features); // Get number of features int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { // Get feature info WindowsFeature feature = WindowsFeature.Parse(reader); // Search for feature in list WindowsFeature match = ConfigurationManager.Features.FirstOrDefault(x => x.Name == feature.Name); // If match was found if (match != null) { // Copy info to shown WindowsFeature match.Installed = feature.Installed; match.IsScored = feature.IsScored; } else { // Add feature to list ConfigurationManager.Features.Add(feature); } } }
// METHODS: #region // this will disable some of windows features, like taskmgr, regedit, etc. // there's a lot of features to be added, you could add anything :D public void DisableWindowsFeature(WindowsFeature feature, bool disable) { if (feature == WindowsFeature.regedit || feature == WindowsFeature.TaskManager) { reg.BaseRegistryKey = Registry.CurrentUser; reg.SubKey = @"Software\Microsoft\Windows\CurrentVersion\Policies\System"; if (feature == WindowsFeature.TaskManager) { reg.Write("DisableTaskMgr", (disable) ? 1 : 0); } else { reg.Write("DisableRegistryTools", (disable) ? 1 : 0); } } }
public void Load(BinaryReader reader) { // Get number of features int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { // Get feature info WindowsFeature feature = WindowsFeature.Parse(reader); // If feature isn't scored, skip if (!feature.IsScored) { continue; } // Add feature to scored list ScoredFeatures.Add(feature); } }
public SectionDetails GetScore() { SectionDetails details = new SectionDetails(0, new List <string>(), this); // Get windows features on system List <WindowsFeature> systemFeatures = WindowsFeature.GetWindowsFeatures(); // For each configured windows feature foreach (WindowsFeature scoredFeature in ScoredFeatures) { // For each system windows feature foreach (WindowsFeature systemFeature in systemFeatures) { // If features have the same name (same features) if (scoredFeature.Name == systemFeature.Name) { // If installation statuses are equal, give points if (scoredFeature.Installed == systemFeature.Installed) { details.Points++; if (scoredFeature.Installed) { details.Output.Add(TranslationManager.Translate("WindowsFeatureInstalled", scoredFeature.Name)); } else { details.Output.Add(TranslationManager.Translate("WindowsFeatureNotInstalled", scoredFeature.Name)); } } // Found match, break loop break; } } } return(details); }
public void PopulateFeatures() { // Get windows features WindowsFeature.GetWindowsFeatures(ConfigurationManager.Features); }