Esempio n. 1
0
        public static IEnumerable <Guid> MsiEnumProducts()
        {
            var sbProductCode = new StringBuilder(39);
            var iIdx          = 0;

            while (MsiWrapper.MsiEnumProducts(iIdx++, sbProductCode) == 0)
            {
                var guidString = sbProductCode.ToString();
                if (GuidTools.GuidTryParse(guidString, out var guid))
                {
                    yield return(guid);
                }
                else
                {
                    Console.WriteLine($@"Invalid MSI guid in MsiEnumProducts: {guidString}");
                }
            }
        }
Esempio n. 2
0
        private static Guid GetGuid(RegistryKey uninstallerKey)
        {
            // Look for a GUID registry entry
            var tempGuidString = uninstallerKey.GetStringSafe(RegistryNameBundleProviderKey);

            if (GuidTools.GuidTryParse(tempGuidString, out var resultGuid))
            {
                return(resultGuid);
            }

            if (GuidTools.TryExtractGuid(uninstallerKey.GetKeyName(), out resultGuid))
            {
                return(resultGuid);
            }
            string uninstallString = GetUninstallString(uninstallerKey);

            // Look for a valid GUID in the path
            return(GuidTools.TryExtractGuid(uninstallString, out resultGuid) ? resultGuid : Guid.Empty);
        }
        public IEnumerable <IJunkResult> FindJunk(ApplicationUninstallerEntry target)
        {
            if (string.IsNullOrEmpty(target.InstallLocation))
            {
                yield break;
            }

            foreach (var userAssistGuid in UserAssistGuids)
            {
                using (var key = RegistryTools.OpenRegistryKey(
                           $@"{SoftwareRegKeyScanner.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(target.InstallLocation,
                                                     StringComparison.InvariantCultureIgnoreCase))
                        {
                            var junk = new RegistryValueJunk(key.Name, valueName, target, this);
                            junk.DisplayValueName = convertedName;
                            junk.Confidence.Add(ConfidenceRecords.ExplicitConnection);
                            yield return(junk);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        private static Guid GetGuid(RegistryKey uninstallerKey)
        {
            // Look for a GUID registry entry
            var tempGuidString =
                uninstallerKey.GetValue(ApplicationUninstallerEntry.RegistryNameBundleProviderKey) as string;
            Guid resultGuid;

            if (GuidTools.GuidTryParse(tempGuidString, out resultGuid))
            {
                return(resultGuid);
            }

            if (GuidTools.TryExtractGuid(uninstallerKey.GetKeyName(), out resultGuid))
            {
                return(resultGuid);
            }

            var uninstallString =
                uninstallerKey.GetValue(ApplicationUninstallerEntry.RegistryNameUninstallString) as string;

            // Look for a valid GUID in the path
            return(GuidTools.TryExtractGuid(uninstallString, out resultGuid) ? resultGuid : Guid.Empty);
        }