public static ShellExposure.ShellExposureInformation CreateShellExposureInformation(DefinitionIdentity subscriptionIdentity) { ShellExposure.ShellExposureInformation exposureInformation = (ShellExposure.ShellExposureInformation)null; string path2_1 = (string)null; string str1 = (string)null; string path2_2 = (string)null; string str2 = (string)null; string str3 = ""; using (RegistryKey registryKey1 = ShellExposure.UninstallRoot.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")) { if (registryKey1 != null) { using (RegistryKey registryKey2 = registryKey1.OpenSubKey(ShellExposure.GenerateArpKeyName(subscriptionIdentity))) { if (registryKey2 != null) { path2_1 = registryKey2.GetValue("ShortcutFolderName") as string; str1 = registryKey2.GetValue("ShortcutFileName") as string; path2_2 = registryKey2.GetValue("ShortcutSuiteName") == null ? "" : registryKey2.GetValue("ShortcutSuiteName") as string; str2 = registryKey2.GetValue("SupportShortcutFileName") as string; str3 = registryKey2.GetValue("ShortcutAppId") == null ? "" : registryKey2.GetValue("ShortcutAppId") as string; } } } } if (path2_1 != null && str1 != null && str2 != null) { exposureInformation = new ShellExposure.ShellExposureInformation(); exposureInformation._applicationRootFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), path2_1); exposureInformation._applicationFolderPath = !string.IsNullOrEmpty(path2_2) ? Path.Combine(exposureInformation._applicationRootFolderPath, path2_2) : exposureInformation._applicationRootFolderPath; exposureInformation._applicationShortcutPath = Path.Combine(exposureInformation._applicationFolderPath, str1 + ".appref-ms"); exposureInformation._supportShortcutPath = Path.Combine(exposureInformation._applicationFolderPath, str2 + ".url"); exposureInformation._desktopShortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), str1 + ".appref-ms"); exposureInformation._appVendor = path2_1; exposureInformation._appProduct = str1; exposureInformation._appSupportShortcut = str2; exposureInformation._shortcutAppId = str3; exposureInformation._appSuiteName = path2_2; } return(exposureInformation); }
private static void RemoveArpEntry(DefinitionIdentity subId) { using (RegistryKey registryKey = ShellExposure.UninstallRoot.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", true)) { string subkey = (string)null; try { if (registryKey == null) { return; } subkey = ShellExposure.GenerateArpKeyName(subId); registryKey.DeleteSubKeyTree(subkey); } catch (ArgumentException ex) { throw new DeploymentException(ExceptionTypes.InvalidARPEntry, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_ArpEntryRemovalFailure"), new object[1] { (object)subkey }), (Exception)ex); } } }
public static ShellExposure.ShellExposureInformation CreateShellExposureInformation(DefinitionIdentity subscriptionIdentity) { ShellExposure.ShellExposureInformation information = null; string str = null; string str2 = null; string str3 = null; string str4 = null; string str5 = ""; using (RegistryKey key = ShellExposure.UninstallRoot.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")) { if (key != null) { using (RegistryKey key2 = key.OpenSubKey(ShellExposure.GenerateArpKeyName(subscriptionIdentity))) { if (key2 != null) { str = key2.GetValue("ShortcutFolderName") as string; str2 = key2.GetValue("ShortcutFileName") as string; if (key2.GetValue("ShortcutSuiteName") != null) { str3 = key2.GetValue("ShortcutSuiteName") as string; } else { str3 = ""; } str4 = key2.GetValue("SupportShortcutFileName") as string; if (key2.GetValue("ShortcutAppId") != null) { str5 = key2.GetValue("ShortcutAppId") as string; } else { str5 = ""; } } } } } if (((str != null) && (str2 != null)) && (str4 != null)) { information = new ShellExposure.ShellExposureInformation { _applicationRootFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), str) }; if (string.IsNullOrEmpty(str3)) { information._applicationFolderPath = information._applicationRootFolderPath; } else { information._applicationFolderPath = Path.Combine(information._applicationRootFolderPath, str3); } information._applicationShortcutPath = Path.Combine(information._applicationFolderPath, str2 + ".appref-ms"); information._supportShortcutPath = Path.Combine(information._applicationFolderPath, str4 + ".url"); information._desktopShortcutPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), str2 + ".appref-ms"); information._appVendor = str; information._appProduct = str2; information._appSupportShortcut = str4; information._shortcutAppId = str5; information._appSuiteName = str3; } return(information); }
private static void UpdateArpEntry(SubscriptionState subState, ShellExposure.ShellExposureInformation shellExposureInformation) { DefinitionIdentity subscriptionId = subState.SubscriptionId; string str1 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "rundll32.exe dfshim.dll,ShArpMaintain {0}", new object[1] { (object)subscriptionId.ToString() }); string str2 = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "dfshim.dll,2", new object[0]); AssemblyManifest deploymentManifest = subState.CurrentDeploymentManifest; Description effectiveDescription = subState.EffectiveDescription; using (RegistryKey subKey1 = ShellExposure.UninstallRoot.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall")) { using (RegistryKey subKey2 = subKey1.CreateSubKey(ShellExposure.GenerateArpKeyName(subscriptionId))) { string[] strArray = new string[24] { "DisplayName", shellExposureInformation.ARPDisplayName, "DisplayIcon", str2, "DisplayVersion", deploymentManifest.Identity.Version.ToString(), "Publisher", effectiveDescription.FilteredPublisher, "UninstallString", str1, "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."); int index = strArray.Length - 2; while (index >= 0) { string name = strArray[index]; string str3 = strArray[index + 1]; if (str3 != null) { subKey2.SetValue(name, (object)str3); } else { subKey2.DeleteValue(name, false); } index -= 2; } } } }