Vincent Povirk : mscoree: Search shared addon locations for mono runtime.
Alexandre Julliard
julliard at winehq.org
Thu Apr 4 15:38:09 CDT 2019
Module: wine
Branch: master
Commit: dc2c580bdfab2b6850241afae66d7dee5db94c0e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=dc2c580bdfab2b6850241afae66d7dee5db94c0e
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Thu Apr 4 10:05:31 2019 -0500
mscoree: Search shared addon locations for mono runtime.
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mscoree/Makefile.in | 2 ++
dlls/mscoree/metahost.c | 67 +++++++++++++++++++++++++++++++++++++++++-
dlls/mscoree/mscoree_main.c | 2 +-
dlls/mscoree/mscoree_private.h | 2 ++
4 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/dlls/mscoree/Makefile.in b/dlls/mscoree/Makefile.in
index 634869e..9ae43df 100644
--- a/dlls/mscoree/Makefile.in
+++ b/dlls/mscoree/Makefile.in
@@ -11,3 +11,5 @@ C_SRCS = \
mscoree_main.c
IDL_SRCS = mscoree_classes.idl
+
+metahost_EXTRADEFS = -DINSTALL_DATADIR="\"${datadir}\""
diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index d6af7b6..3c4f803 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -712,10 +712,75 @@ static BOOL get_mono_path_registry(LPWSTR path)
return ret;
}
+static BOOL get_mono_path_unix(const char *unix_dir, LPWSTR path)
+{
+ static WCHAR * (CDECL *p_wine_get_dos_file_name)(const char*);
+ LPWSTR dos_dir;
+ WCHAR mono_dll_path[MAX_PATH];
+ BOOL ret;
+
+ if (!p_wine_get_dos_file_name)
+ {
+ p_wine_get_dos_file_name = (void*)GetProcAddress(GetModuleHandleA("kernel32"), "wine_get_dos_file_name");
+ if (!p_wine_get_dos_file_name)
+ return FALSE;
+ }
+
+ dos_dir = p_wine_get_dos_file_name(unix_dir);
+ if (!dos_dir)
+ return FALSE;
+
+ ret = find_mono_dll(dos_dir, mono_dll_path);
+ if (ret)
+ strcpyW(path, dos_dir);
+
+ heap_free(dos_dir);
+
+ return ret;
+}
+
+static BOOL get_mono_path_datadir(LPWSTR path)
+{
+ const char *data_dir;
+ char *package_dir;
+ int len;
+ BOOL ret;
+
+ if((data_dir = wine_get_data_dir()))
+ {
+ len = strlen(data_dir);
+ package_dir = heap_alloc(len + sizeof("/mono/wine-mono-" WINE_MONO_VERSION));
+ memcpy(package_dir, data_dir, len);
+ strcpy(package_dir+len, "/mono/wine-mono-" WINE_MONO_VERSION);
+ }
+ else if((data_dir = wine_get_build_dir()))
+ {
+ len = strlen(data_dir);
+ package_dir = heap_alloc(len + sizeof("/../wine-mono-" WINE_MONO_VERSION));
+ memcpy(package_dir, data_dir, len);
+ strcpy(package_dir+len, "/../wine-mono-" WINE_MONO_VERSION);
+ }
+ else
+ {
+ return FALSE;
+ }
+
+ ret = get_mono_path_unix(package_dir, path);
+
+ heap_free(package_dir);
+
+ return ret;
+}
+
static BOOL get_mono_path(LPWSTR path)
{
return get_mono_path_local(path) ||
- get_mono_path_registry(path);
+ get_mono_path_registry(path) ||
+ get_mono_path_datadir(path) ||
+ get_mono_path_unix(INSTALL_DATADIR "/wine/mono/wine-mono-" WINE_MONO_VERSION, path) ||
+ (strcmp(INSTALL_DATADIR, "/usr/share") &&
+ get_mono_path_unix("/usr/share/wine/mono/wine-mono-" WINE_MONO_VERSION, path)) ||
+ get_mono_path_unix("/opt/wine/mono/wine-mono-" WINE_MONO_VERSION, path);
}
struct InstalledRuntimeEnum
diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c
index 198e279..7bb6359 100644
--- a/dlls/mscoree/mscoree_main.c
+++ b/dlls/mscoree/mscoree_main.c
@@ -682,7 +682,7 @@ static BOOL install_wine_mono(void)
LONG len;
BOOL ret;
- static const char* mono_version = "4.8.1";
+ static const char* mono_version = WINE_MONO_VERSION;
static const char* mono_upgrade_code = "{DE624609-C6B5-486A-9274-EF0B854F6BC5}";
static const WCHAR controlW[] = {'\\','c','o','n','t','r','o','l','.','e','x','e',0};
diff --git a/dlls/mscoree/mscoree_private.h b/dlls/mscoree/mscoree_private.h
index 4e7ee01..7761099 100644
--- a/dlls/mscoree/mscoree_private.h
+++ b/dlls/mscoree/mscoree_private.h
@@ -45,6 +45,8 @@ extern HRESULT assembly_get_runtime_version(ASSEMBLY *assembly, LPSTR *version)
extern HRESULT assembly_get_vtable_fixups(ASSEMBLY *assembly, VTableFixup **fixups, DWORD *count) DECLSPEC_HIDDEN;
extern HRESULT assembly_get_native_entrypoint(ASSEMBLY *assembly, NativeEntryPointFunc *func) DECLSPEC_HIDDEN;
+#define WINE_MONO_VERSION "4.8.1"
+
/* Mono embedding */
typedef struct _MonoDomain MonoDomain;
typedef struct _MonoAssembly MonoAssembly;
More information about the wine-cvs
mailing list