Ejemplo n.º 1
0
        public static bool TryGetPerMachineBundleRegistrationById(string bundleId, out BundleRegistration registration)
        {
            var registrationKeyPath = $"{BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY_WOW6432NODE}\\{bundleId}";

            using var registrationKey = Registry.LocalMachine.OpenSubKey(registrationKeyPath);
            var success = registrationKey != null;

            registration = success ? GetBundleRegistration(registrationKey) : null;
            return(success);
        }
Ejemplo n.º 2
0
        public static bool TryGetPerUserBundleRegistrationById(string bundleId, out BundleRegistration registration)
        {
            var registrationKeyPath = $"{BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY}\\{bundleId}";

            using var registrationKey = Registry.CurrentUser.OpenSubKey(registrationKeyPath);
            var success = registrationKey != null;

            registration = success ? GetBundleRegistration(registrationKey) : null;
            return(success);
        }
Ejemplo n.º 3
0
        public bool TryGetRegistration(out BundleRegistration registration)
        {
            var bundleSymbol = this.GetBundleSymbol();
            var bundleId     = bundleSymbol.BundleId;

            if (bundleSymbol.PerMachine)
            {
                return(BundleRegistration.TryGetPerMachineBundleRegistrationById(bundleId, out registration));
            }
            else
            {
                return(BundleRegistration.TryGetPerUserBundleRegistrationById(bundleId, out registration));
            }
        }
Ejemplo n.º 4
0
        private static BundleRegistration GetBundleRegistration(RegistryKey idKey)
        {
            var registration = new BundleRegistration();

            registration.AddonCodes    = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_ADDON_CODE) as string[];
            registration.CachePath     = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH) as string;
            registration.DetectCodes   = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_DETECT_CODE) as string[];
            registration.PatchCodes    = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_PATCH_CODE) as string[];
            registration.ProviderKey   = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_PROVIDER_KEY) as string;
            registration.Tag           = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_TAG) as string;
            registration.UpgradeCodes  = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_UPGRADE_CODE) as string[];
            registration.Version       = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_VERSION) as string;
            registration.DisplayName   = idKey.GetValue(BURN_REGISTRATION_REGISTRY_BUNDLE_DISPLAY_NAME) as string;
            registration.EngineVersion = idKey.GetValue(BURN_REGISTRATION_REGISTRY_ENGINE_VERSION) as string;
            registration.EstimatedSize = idKey.GetValue(REGISTRY_BUNDLE_ESTIMATED_SIZE) as int?;
            registration.Installed     = idKey.GetValue(REGISTRY_BUNDLE_INSTALLED) as int?;
            registration.ModifyPath    = idKey.GetValue(REGISTRY_BUNDLE_MODIFY_PATH) as string;
            registration.Publisher     = idKey.GetValue(REGISTRY_BUNDLE_PUBLISHER) as string;
            registration.UrlInfoAbout  = idKey.GetValue(REGISTRY_BUNDLE_URL_INFO_ABOUT) as string;
            registration.UrlUpdateInfo = idKey.GetValue(REGISTRY_BUNDLE_URL_UPDATE_INFO) as string;

            registration.QuietUninstallString = idKey.GetValue(REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING) as string;
            if (!String.IsNullOrEmpty(registration.QuietUninstallString))
            {
                var closeQuote = registration.QuietUninstallString.IndexOf("\"", 1);
                if (closeQuote > 0)
                {
                    registration.QuietUninstallCommand          = registration.QuietUninstallString.Substring(1, closeQuote - 1).Trim();
                    registration.QuietUninstallCommandArguments = registration.QuietUninstallString.Substring(closeQuote + 1).Trim();
                }
            }

            registration.UninstallString = idKey.GetValue(REGISTRY_BUNDLE_UNINSTALL_STRING) as string;
            if (!String.IsNullOrEmpty(registration.UninstallString))
            {
                var closeQuote = registration.UninstallString.IndexOf("\"", 1);
                if (closeQuote > 0)
                {
                    registration.UninstallCommand          = registration.UninstallString.Substring(1, closeQuote - 1).Trim();
                    registration.UninstallCommandArguments = registration.UninstallString.Substring(closeQuote + 1).Trim();
                }
            }

            return(registration);
        }