Example #1
0
        private IEnumerable <JunkNode> ScanAppCompatFlags()
        {
            if (string.IsNullOrEmpty(Uninstaller.InstallLocation))
            {
                yield break;
            }

            foreach (var fullCompatKey in AppCompatFlags.SelectMany(compatKey => new[]
            {
                compatKey + @"\Layers",
                compatKey + @"\Compatibility Assistant\Store"
            }))
            {
                using (var key = RegistryTools.OpenRegistryKey(fullCompatKey))
                {
                    if (key == null)
                    {
                        continue;
                    }

                    foreach (var valueName in key.GetValueNames())
                    {
                        // Check for matches
                        if (valueName.StartsWith(Uninstaller.InstallLocation,
                                                 StringComparison.InvariantCultureIgnoreCase))
                        {
                            var junk = new RegistryValueJunkNode(key.Name, valueName, Uninstaller.DisplayName);
                            junk.Confidence.Add(ConfidencePart.ExplicitConnection);
                            yield return(junk);
                        }
                    }
                }
            }
        }
Example #2
0
        private IEnumerable <JunkNode> ScanFirewallRules()
        {
            const string firewallRulesKey =
                @"SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules";
            const string fullFirewallRulesKey = @"HKEY_LOCAL_MACHINE\" + firewallRulesKey;

            var results = new List <JunkNode>();

            if (string.IsNullOrEmpty(Uninstaller.InstallLocation))
            {
                return(results);
            }

            using (var key = Registry.LocalMachine.OpenSubKey(firewallRulesKey))
            {
                if (key != null)
                {
                    foreach (var valueName in GetValueNamesSafe(key))
                    {
                        var value = key.GetValue(valueName) as string;
                        if (string.IsNullOrEmpty(value))
                        {
                            continue;
                        }

                        var start     = value.IndexOf("|App=", StringComparison.InvariantCultureIgnoreCase) + 5;
                        var charCount = value.IndexOf('|', start) - start;
                        var fullPath  = Environment.ExpandEnvironmentVariables(value.Substring(start, charCount));
                        if (fullPath.StartsWith(Uninstaller.InstallLocation, StringComparison.InvariantCultureIgnoreCase))
                        {
                            var node = new RegistryValueJunkNode(fullFirewallRulesKey, valueName,
                                                                 Uninstaller.DisplayName);
                            node.Confidence.Add(ConfidencePart.ExplicitConnection);
                            results.Add(node);
                        }
                    }
                }
            }

            return(results);
        }
Example #3
0
        private IEnumerable <JunkNode> ScanUserAssist()
        {
            if (string.IsNullOrEmpty(Uninstaller.InstallLocation))
            {
                yield break;
            }

            foreach (var userAssistGuid in UserAssistGuids)
            {
                using (var key = RegistryTools.OpenRegistryKey(
                           $@"{KeyCu}\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{userAssistGuid}\Count"))
                {
                    if (key == null)
                    {
                        continue;
                    }

                    foreach (var valueName in key.GetValueNames())
                    {
                        // Convert the value name to a usable form
                        var  convertedName = Rot13(valueName);
                        var  guidEnd       = convertedName.IndexOf('}') + 1;
                        Guid g;
                        if (guidEnd > 0 && GuidTools.GuidTryParse(convertedName.Substring(0, guidEnd), out g))
                        {
                            convertedName = NativeMethods.GetKnownFolderPath(g) + convertedName.Substring(guidEnd);
                        }

                        // Check for matches
                        if (convertedName.StartsWith(Uninstaller.InstallLocation,
                                                     StringComparison.InvariantCultureIgnoreCase))
                        {
                            var junk = new RegistryValueJunkNode(key.Name, valueName, Uninstaller.DisplayName);
                            junk.Confidence.Add(ConfidencePart.ExplicitConnection);
                            yield return(junk);
                        }
                    }
                }
            }
        }
Example #4
0
        private IEnumerable <JunkNode> ScanInstallerFolders()
        {
            var installLocation = Uninstaller.InstallLocation;

            if (string.IsNullOrEmpty(installLocation))
            {
                yield break;
            }

            using (var key = Registry.LocalMachine.OpenSubKey(
                       @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders"))
            {
                if (key == null)
                {
                    yield break;
                }

                foreach (var path in key.GetValueNames())
                {
                    if (!TestPathsMatch(installLocation, path))
                    {
                        continue;
                    }

                    var node = new RegistryValueJunkNode(key.Name, path, Uninstaller.DisplayName);
                    node.Confidence.Add(ConfidencePart.ExplicitConnection);

                    if (OtherUninstallers.Any(x => TestPathsMatch(x.InstallLocation, path)))
                    {
                        node.Confidence.Add(ConfidencePart.DirectoryStillUsed);
                    }

                    yield return(node);
                }
            }
        }