示例#1
0
        private static void UpdateArpEntry(SubscriptionState subState, ShellExposureInformation shellExposureInformation)
        {
            DefinitionIdentity subscriptionId            = subState.SubscriptionId;
            string             str                       = string.Format(CultureInfo.InvariantCulture, "rundll32.exe dfshim.dll,ShArpMaintain {0}", new object[] { subscriptionId.ToString() });
            string             str2                      = string.Format(CultureInfo.InvariantCulture, "dfshim.dll,2", new object[0]);
            AssemblyManifest   currentDeploymentManifest = subState.CurrentDeploymentManifest;
            Description        effectiveDescription      = subState.EffectiveDescription;

            using (RegistryKey key = UninstallRoot.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"))
            {
                using (RegistryKey key2 = key.CreateSubKey(GenerateArpKeyName(subscriptionId)))
                {
                    string[] strArray = new string[] {
                        "DisplayName", shellExposureInformation.ARPDisplayName, "DisplayIcon", str2, "DisplayVersion", currentDeploymentManifest.Identity.Version.ToString(), "Publisher", effectiveDescription.FilteredPublisher, "UninstallString", str, "HelpLink", effectiveDescription.SupportUrl, "UrlUpdateInfo", subState.DeploymentProviderUri.AbsoluteUri, "ShortcutFolderName", shellExposureInformation.AppVendor,
                        "ShortcutFileName", shellExposureInformation.AppProduct, "ShortcutSuiteName", shellExposureInformation.AppSuiteName, "SupportShortcutFileName", shellExposureInformation.AppSupportShortcut, "ShortcutAppId", shellExposureInformation.ShortcutAppId
                    };
                    Logger.AddInternalState("Updating ARP entry.");
                    for (int i = strArray.Length - 2; i >= 0; i -= 2)
                    {
                        string name = strArray[i];
                        string str4 = strArray[i + 1];
                        if (str4 != null)
                        {
                            key2.SetValue(name, str4);
                        }
                        else
                        {
                            key2.DeleteValue(name, false);
                        }
                    }
                }
            }
        }
示例#2
0
 private static void RemoveArpEntry(DefinitionIdentity subId)
 {
     using (RegistryKey key = UninstallRoot.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", true))
     {
         string subkey = null;
         try
         {
             if (key != null)
             {
                 subkey = GenerateArpKeyName(subId);
                 key.DeleteSubKeyTree(subkey);
             }
         }
         catch (ArgumentException exception)
         {
             throw new DeploymentException(ExceptionTypes.InvalidARPEntry, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_ArpEntryRemovalFailure"), new object[] { subkey }), exception);
         }
     }
 }