Commit 2c2d5302 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

mscoree: Use the new Mono runtime search code in GetRequestedRuntimeInfo.

parent 9d770349
......@@ -28,6 +28,7 @@
#include "dbghelp.h"
#include "ole2.h"
#include "corhdr.h"
#include "metahost.h"
#include "mscoree_private.h"
#include "wine/debug.h"
......
......@@ -29,6 +29,7 @@
#include "cor.h"
#include "mscoree.h"
#include "metahost.h"
#include "mscoree_private.h"
#include "wine/debug.h"
......
......@@ -899,3 +899,51 @@ extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj)
{
return ICLRMetaHost_QueryInterface((ICLRMetaHost*)&GlobalCLRMetaHost, riid, ppobj);
}
HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result)
{
static const DWORD supported_startup_flags = 0;
static const DWORD supported_runtime_flags = RUNTIME_INFO_UPGRADE_VERSION;
int i;
if (exefile)
FIXME("ignoring exe filename %s\n", debugstr_w(exefile));
if (config_file)
FIXME("ignoring config filename %s\n", debugstr_w(config_file));
if (startup_flags & ~supported_startup_flags)
FIXME("unsupported startup flags %x\n", startup_flags & ~supported_startup_flags);
if (runtimeinfo_flags & ~supported_runtime_flags)
FIXME("unsupported runtimeinfo flags %x\n", runtimeinfo_flags & ~supported_runtime_flags);
if (version)
{
return CLRMetaHost_GetRuntime(0, version, &IID_ICLRRuntimeInfo, (void**)result);
}
if (runtimeinfo_flags & RUNTIME_INFO_UPGRADE_VERSION)
{
find_runtimes();
if (legacy)
i = 2;
else
i = NUM_RUNTIMES;
while (i--)
{
if (runtimes[i].mono_abi_version)
return IUnknown_QueryInterface((IUnknown*)&runtimes[i],
&IID_ICLRRuntimeInfo, (void**)result);
}
ERR("No %s.NET runtime installed\n", legacy ? "legacy " : "");
return CLR_E_SHIM_RUNTIME;
}
return CLR_E_SHIM_RUNTIME;
}
......@@ -21,6 +21,7 @@
#include <stdarg.h>
#define COBJMACROS
#include "wine/unicode.h"
#include "wine/library.h"
#include "windef.h"
......@@ -516,35 +517,33 @@ HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWST
LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength)
{
HRESULT ret;
DWORD ver_len, dir_len;
WCHAR dirW[MAX_PATH], verW[MAX_PATH];
ICLRRuntimeInfo *info;
DWORD length_dummy;
FIXME("(%s, %s, %s, 0x%08x, 0x%08x, %p, 0x%08x, %p, %p, 0x%08x, %p) semi-stub\n", debugstr_w(pExe),
TRACE("(%s, %s, %s, 0x%08x, 0x%08x, %p, 0x%08x, %p, %p, 0x%08x, %p)\n", debugstr_w(pExe),
debugstr_w(pwszVersion), debugstr_w(pConfigurationFile), startupFlags, runtimeInfoFlags, pDirectory,
dwDirectory, dwDirectoryLength, pVersion, cchBuffer, dwlength);
if (!pwszVersion && !(runtimeInfoFlags & RUNTIME_INFO_UPGRADE_VERSION))
return CLR_E_SHIM_RUNTIME;
if (!dwDirectoryLength) dwDirectoryLength = &length_dummy;
ret = GetCORSystemDirectory(dirW, dwDirectory, &dir_len);
if (!dwlength) dwlength = &length_dummy;
if (ret == S_OK)
{
if (dwDirectoryLength)
*dwDirectoryLength = dir_len;
if (pDirectory)
lstrcpyW(pDirectory, dirW);
ret = get_runtime_info(pExe, pwszVersion, pConfigurationFile, startupFlags, runtimeInfoFlags, TRUE, &info);
ret = GetCORVersion(verW, cchBuffer, &ver_len);
if (SUCCEEDED(ret))
{
*dwlength = cchBuffer;
ret = ICLRRuntimeInfo_GetVersionString(info, pVersion, dwlength);
if (ret == S_OK)
if (SUCCEEDED(ret))
{
if (dwlength)
*dwlength = ver_len;
if (pVersion)
lstrcpyW(pVersion, verW);
*dwDirectoryLength = dwDirectory;
ret = ICLRRuntimeInfo_GetRuntimeDirectory(info, pDirectory, dwDirectoryLength);
}
ICLRRuntimeInfo_Release(info);
}
return ret;
}
......
......@@ -45,6 +45,9 @@ typedef struct CLRRuntimeInfo
struct RuntimeHost *loaded_runtime;
} CLRRuntimeInfo;
extern HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
DWORD startup_flags, DWORD runtimeinfo_flags, BOOL legacy, ICLRRuntimeInfo **result);
/* Mono 2.6 embedding */
typedef struct _MonoDomain MonoDomain;
typedef struct _MonoAssembly MonoAssembly;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment