aboutsummaryrefslogtreecommitdiffstats
path: root/QtVsTools.Core
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2022-02-02 12:31:46 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2022-02-02 11:47:33 +0000
commitc3855a07eadc66c302fe75b4a6f9255c084eba2e (patch)
treec4b7d42240dd4220fc5d6214edd2e7f85e75d746 /QtVsTools.Core
parent6218ca9130dcec3de346c9475c61a18abf3df383 (diff)
Fix Vs2017 build, amends patch 4b76a7 and d8c550
Change-Id: Iff98da39a1496b2cf89bd109359af9d3715cd0b5 Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Diffstat (limited to 'QtVsTools.Core')
-rw-r--r--QtVsTools.Core/HelperFunctions.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/QtVsTools.Core/HelperFunctions.cs b/QtVsTools.Core/HelperFunctions.cs
index f80a9100..1327a864 100644
--- a/QtVsTools.Core/HelperFunctions.cs
+++ b/QtVsTools.Core/HelperFunctions.cs
@@ -28,6 +28,9 @@
using EnvDTE;
using Microsoft.VisualStudio.VCProjectEngine;
+#if VS2017
+using Microsoft.Win32;
+#endif
using QtVsTools.Core.QtMsBuild;
using System;
using System.Collections.Generic;
@@ -1539,6 +1542,34 @@ namespace QtVsTools.Core
return true;
}
+#if VS2017
+ private static string GetRegistrySoftwareString(string subKeyName, string valueName)
+ {
+ var keyName = new StringBuilder();
+ keyName.Append(@"SOFTWARE\");
+ if (System.Environment.Is64BitOperatingSystem && IntPtr.Size == 4)
+ keyName.Append(@"WOW6432Node\");
+ keyName.Append(subKeyName);
+ try {
+ using (var key = Registry.LocalMachine.OpenSubKey(keyName.ToString(), false)) {
+ if (key == null)
+ return ""; //key not found
+ RegistryValueKind valueKind = key.GetValueKind(valueName);
+ if (valueKind != RegistryValueKind.String
+ && valueKind != RegistryValueKind.ExpandString) {
+ return ""; //wrong value kind
+ }
+ Object objValue = key.GetValue(valueName);
+ if (objValue == null)
+ return ""; //error getting value
+ return objValue.ToString();
+ }
+ } catch {
+ return "";
+ }
+ }
+#endif
+
public static string GetWindows10SDKVersion()
{
#if VS2019 || VS2022