[PATCH 2/4] mscoree: Check for mono runtime path in registry.
Vincent Povirk
vincent at codeweavers.com
Thu Apr 4 10:05:30 CDT 2019
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
---
dlls/mscoree/metahost.c | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index fc1d178751c..d6af7b64b38 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -667,7 +667,7 @@ static BOOL find_mono_dll(LPCWSTR path, LPWSTR dll_path)
return (attributes != INVALID_FILE_ATTRIBUTES);
}
-static BOOL get_mono_path(LPWSTR path)
+static BOOL get_mono_path_local(LPWSTR path)
{
static const WCHAR subdir_mono[] = {'\\','m','o','n','o','\\','m','o','n','o','-','2','.','0', 0};
WCHAR base_path[MAX_PATH], mono_dll_path[MAX_PATH];
@@ -685,6 +685,39 @@ static BOOL get_mono_path(LPWSTR path)
return FALSE;
}
+static BOOL get_mono_path_registry(LPWSTR path)
+{
+ static const WCHAR keyname[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\','M','o','n','o',0};
+ static const WCHAR valuename[] = {'R','u','n','t','i','m','e','P','a','t','h',0};
+ WCHAR base_path[MAX_PATH], mono_dll_path[MAX_PATH];
+ HKEY hkey;
+ DWORD res, valuesize;
+ BOOL ret=FALSE;
+
+ /* @@ Wine registry key: HKCU\Software\Wine\Mono */
+ res = RegOpenKeyW(HKEY_CURRENT_USER, keyname, &hkey);
+ if (res != ERROR_SUCCESS)
+ return FALSE;
+
+ valuesize = sizeof(base_path);
+ res = RegGetValueW(hkey, NULL, valuename, RRF_RT_REG_SZ, NULL, base_path, &valuesize);
+ if (res == ERROR_SUCCESS && find_mono_dll(base_path, mono_dll_path))
+ {
+ strcpyW(path, base_path);
+ ret = TRUE;
+ }
+
+ RegCloseKey(hkey);
+
+ return ret;
+}
+
+static BOOL get_mono_path(LPWSTR path)
+{
+ return get_mono_path_local(path) ||
+ get_mono_path_registry(path);
+}
+
struct InstalledRuntimeEnum
{
IEnumUnknown IEnumUnknown_iface;
--
2.17.1
More information about the wine-devel
mailing list