public static string GetIdFromRegistryOrFile(string id) { string str1 = (string)RegistryUtils.GetRegistryValue("Software\\BlueStacksInstaller", id, (object)"", RegistryKeyKind.HKEY_LOCAL_MACHINE); if (!string.IsNullOrEmpty(str1)) { return(str1); } try { string str2 = Path.Combine(new DirectoryInfo(ShortcutHelper.CommonDesktopPath).Parent.FullName, "BlueStacks"); if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } string path = Path.Combine(str2, id); if (File.Exists(path)) { string str3 = File.ReadAllText(path); if (!string.IsNullOrEmpty(str3)) { str1 = str3; } } } catch { } if (!string.IsNullOrEmpty(str1)) { return(str1); } RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\BlueStacksInstaller"); if (registryKey != null) { str1 = (string)registryKey.GetValue(id, (object)""); } return(str1); }
public static void MoveUnifiedInstallerRegistryFromWow64() { try { RegistryKey registryKey1 = Registry.LocalMachine.OpenSubKey(Strings.RegistryBaseKeyPath); if (registryKey1 != null && !string.IsNullOrEmpty((string)registryKey1.GetValue("Version", (object)null))) { return; } RegistryKey registryKey2 = Registry.LocalMachine.OpenSubKey("Software", true); RegistryKey sourceKey = Registry.LocalMachine.OpenSubKey("Software\\WOW6432Node\\BlueStacks" + Strings.GetOemTag()); if (sourceKey == null) { return; } RegistryKey subKey = registryKey2.CreateSubKey("BlueStacks" + Strings.GetOemTag()); RegistryUtils.RecurseCopyKey(sourceKey, subKey); registryKey2.DeleteSubKeyTree("WOW6432Node\\BlueStacks" + Strings.GetOemTag()); RegistryUtils.GrantAllAccessPermission(subKey); } catch { } }
private static string PostInternal( string url, Dictionary <string, string> data, Dictionary <string, string> headers, bool gzip, int retries, int sleepTimeMSecs, int timeout, string vmName, bool isOnUIThreadOnPurpose, string oem = "bgp") { if (Thread.CurrentThread.ManagedThreadId == 1 && !isOnUIThreadOnPurpose) { Logger.Warning("WARNING: This network call is from UI Thread and its stack trace is {0}", (object)new StackTrace().ToString()); } NameValueCollection headerCollection = HTTPUtils.GetRequestHeaderCollection(vmName); if (data == null) { data = new Dictionary <string, string>(); } Uri uri = new Uri(url); if (uri.Host.Contains("localhost") || uri.Host.Contains("127.0.0.1")) { RegistryKey registryKey = RegistryUtils.InitKeyWithSecurityCheck("Software\\BlueStacks" + (oem.Equals("bgp", StringComparison.InvariantCultureIgnoreCase) ? "" : "_" + oem)); headerCollection.Add("x_api_token", (string)registryKey.GetValue("ApiToken", (object)"")); } else { headerCollection.Remove("x_api_token"); data = Utils.AddCommonData(data); } return(HTTP.Post(url, data, headers, gzip, retries, sleepTimeMSecs, timeout, headerCollection, Utils.GetUserAgent(oem))); }
private static bool IsOSWin10() { return(((string)RegistryUtils.GetRegistryValue("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductName", (object)"", RegistryKeyKind.HKEY_LOCAL_MACHINE)).Contains("Windows 10")); }