mscoree: Search shared addon locations for mono runtime.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2019-04-04 10:05:31 -05:00 committed by Alexandre Julliard
parent 179797a6fb
commit dc2c580bdf
4 changed files with 71 additions and 2 deletions

View File

@ -11,3 +11,5 @@ C_SRCS = \
mscoree_main.c mscoree_main.c
IDL_SRCS = mscoree_classes.idl IDL_SRCS = mscoree_classes.idl
metahost_EXTRADEFS = -DINSTALL_DATADIR="\"${datadir}\""

View File

@ -712,10 +712,75 @@ static BOOL get_mono_path_registry(LPWSTR path)
return ret; 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) static BOOL get_mono_path(LPWSTR path)
{ {
return get_mono_path_local(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 struct InstalledRuntimeEnum

View File

@ -682,7 +682,7 @@ static BOOL install_wine_mono(void)
LONG len; LONG len;
BOOL ret; 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 char* mono_upgrade_code = "{DE624609-C6B5-486A-9274-EF0B854F6BC5}";
static const WCHAR controlW[] = {'\\','c','o','n','t','r','o','l','.','e','x','e',0}; static const WCHAR controlW[] = {'\\','c','o','n','t','r','o','l','.','e','x','e',0};

View File

@ -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_vtable_fixups(ASSEMBLY *assembly, VTableFixup **fixups, DWORD *count) DECLSPEC_HIDDEN;
extern HRESULT assembly_get_native_entrypoint(ASSEMBLY *assembly, NativeEntryPointFunc *func) DECLSPEC_HIDDEN; extern HRESULT assembly_get_native_entrypoint(ASSEMBLY *assembly, NativeEntryPointFunc *func) DECLSPEC_HIDDEN;
#define WINE_MONO_VERSION "4.8.1"
/* Mono embedding */ /* Mono embedding */
typedef struct _MonoDomain MonoDomain; typedef struct _MonoDomain MonoDomain;
typedef struct _MonoAssembly MonoAssembly; typedef struct _MonoAssembly MonoAssembly;