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

This commit is contained in:
Vincent Povirk 2010-10-01 14:11:09 -05:00 committed by Alexandre Julliard
parent 9d770349df
commit 2c2d53024f
5 changed files with 70 additions and 18 deletions

View File

@ -28,6 +28,7 @@
#include "dbghelp.h" #include "dbghelp.h"
#include "ole2.h" #include "ole2.h"
#include "corhdr.h" #include "corhdr.h"
#include "metahost.h"
#include "mscoree_private.h" #include "mscoree_private.h"
#include "wine/debug.h" #include "wine/debug.h"

View File

@ -29,6 +29,7 @@
#include "cor.h" #include "cor.h"
#include "mscoree.h" #include "mscoree.h"
#include "metahost.h"
#include "mscoree_private.h" #include "mscoree_private.h"
#include "wine/debug.h" #include "wine/debug.h"

View File

@ -899,3 +899,51 @@ extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj)
{ {
return ICLRMetaHost_QueryInterface((ICLRMetaHost*)&GlobalCLRMetaHost, riid, 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;
}

View File

@ -21,6 +21,7 @@
#include <stdarg.h> #include <stdarg.h>
#define COBJMACROS
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/library.h" #include "wine/library.h"
#include "windef.h" #include "windef.h"
@ -516,35 +517,33 @@ HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWST
LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength) LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength)
{ {
HRESULT ret; HRESULT ret;
DWORD ver_len, dir_len; ICLRRuntimeInfo *info;
WCHAR dirW[MAX_PATH], verW[MAX_PATH]; 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, debugstr_w(pwszVersion), debugstr_w(pConfigurationFile), startupFlags, runtimeInfoFlags, pDirectory,
dwDirectory, dwDirectoryLength, pVersion, cchBuffer, dwlength); dwDirectory, dwDirectoryLength, pVersion, cchBuffer, dwlength);
if (!pwszVersion && !(runtimeInfoFlags & RUNTIME_INFO_UPGRADE_VERSION)) if (!dwDirectoryLength) dwDirectoryLength = &length_dummy;
return CLR_E_SHIM_RUNTIME;
ret = GetCORSystemDirectory(dirW, dwDirectory, &dir_len); if (!dwlength) dwlength = &length_dummy;
if (ret == S_OK) ret = get_runtime_info(pExe, pwszVersion, pConfigurationFile, startupFlags, runtimeInfoFlags, TRUE, &info);
if (SUCCEEDED(ret))
{ {
if (dwDirectoryLength) *dwlength = cchBuffer;
*dwDirectoryLength = dir_len; ret = ICLRRuntimeInfo_GetVersionString(info, pVersion, dwlength);
if (pDirectory)
lstrcpyW(pDirectory, dirW);
ret = GetCORVersion(verW, cchBuffer, &ver_len); if (SUCCEEDED(ret))
if (ret == S_OK)
{ {
if (dwlength) *dwDirectoryLength = dwDirectory;
*dwlength = ver_len; ret = ICLRRuntimeInfo_GetRuntimeDirectory(info, pDirectory, dwDirectoryLength);
if (pVersion)
lstrcpyW(pVersion, verW);
} }
ICLRRuntimeInfo_Release(info);
} }
return ret; return ret;
} }

View File

@ -45,6 +45,9 @@ typedef struct CLRRuntimeInfo
struct RuntimeHost *loaded_runtime; struct RuntimeHost *loaded_runtime;
} CLRRuntimeInfo; } 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 */ /* Mono 2.6 embedding */
typedef struct _MonoDomain MonoDomain; typedef struct _MonoDomain MonoDomain;
typedef struct _MonoAssembly MonoAssembly; typedef struct _MonoAssembly MonoAssembly;