mscoree: Better support RUNTIME_INFO_UPGRADE_VERSION in, GetRequestedRuntimeInfo
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Sun Mar 11 05:49:50 CDT 2012
Hi,
Changelog:
mscoree: Better support RUNTIME_INFO_UPGRADE_VERSION in
GetRequestedRuntimeInfo
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From a2a612d77877f2a22f313225bba3bfb6d6ace2a4 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Sun, 11 Mar 2012 20:27:50 +1100
Subject: [PATCH] Better support RUNTIME_INFO_UPGRADE_VERSION in
GetRequestedRuntimeInfo
To: wine-patches <wine-patches at winehq.org>
---
dlls/mscoree/metahost.c | 15 ++++++++++-----
dlls/mscoree/tests/mscoree.c | 10 ++++++++++
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index 49fb0ee..8c070d7 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -1006,8 +1006,7 @@ static BOOL parse_runtime_version(LPCWSTR version, DWORD *major, DWORD *minor, D
return FALSE;
}
-HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
- LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
+HRESULT get_runtime_version(LPCWSTR pwzVersion, DWORD runtime_flags, REFIID iid, LPVOID *ppRuntime)
{
int i;
DWORD major, minor, build;
@@ -1028,7 +1027,7 @@ HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
for (i=0; i<NUM_RUNTIMES; i++)
{
if (runtimes[i].major == major && runtimes[i].minor == minor &&
- runtimes[i].build == build)
+ (runtimes[i].build == build || (runtime_flags & RUNTIME_INFO_UPGRADE_VERSION)) )
{
if (runtimes[i].mono_abi_version)
return ICLRRuntimeInfo_QueryInterface(&runtimes[i].ICLRRuntimeInfo_iface, iid,
@@ -1041,10 +1040,16 @@ HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
}
}
- FIXME("Unrecognized version %s\n", debugstr_w(pwzVersion));
+ WARN("Unrecognized version %s\n", debugstr_w(pwzVersion));
return CLR_E_SHIM_RUNTIME;
}
+HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
+ LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
+{
+ return get_runtime_version(pwzVersion, 0, &IID_ICLRRuntimeInfo, ppRuntime);
+}
+
HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost* iface,
LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
{
@@ -1310,7 +1315,7 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
if (version)
{
- return CLRMetaHost_GetRuntime(0, version, &IID_ICLRRuntimeInfo, (void**)result);
+ return get_runtime_version(version, runtimeinfo_flags, &IID_ICLRRuntimeInfo, (void**)result);
}
if (runtimeinfo_flags & RUNTIME_INFO_UPGRADE_VERSION)
diff --git a/dlls/mscoree/tests/mscoree.c b/dlls/mscoree/tests/mscoree.c
index 56351c3..c6facc5 100644
--- a/dlls/mscoree/tests/mscoree.c
+++ b/dlls/mscoree/tests/mscoree.c
@@ -60,6 +60,7 @@ static BOOL init_functionpointers(void)
static void test_versioninfo(void)
{
+ const WCHAR v2_0_0[] = {'v','2','.','0','.','0',0};
const WCHAR v2_0[] = {'v','2','.','0','.','5','0','7','2','7',0};
const WCHAR v1_1[] = {'v','1','.','1','.','4','3','2','2',0};
@@ -143,6 +144,15 @@ static void test_versioninfo(void)
hr = pGetRequestedRuntimeInfo( NULL, v2_0, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08x\n", hr);
ok(!winetest_strcmpW(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
+
+ memset(version, 0, sizeof(version));
+ hr = pGetRequestedRuntimeInfo( NULL, v2_0_0, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
+ ok(hr == CLR_E_SHIM_RUNTIME, "GetRequestedRuntimeInfo returned %08x\n", hr);
+
+ memset(version, 0, sizeof(version));
+ hr = pGetRequestedRuntimeInfo( NULL, v2_0_0, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
+ ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08x\n", hr);
+ ok(!winetest_strcmpW(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
}
static void test_loadlibraryshim(void)
--
1.7.5.4
More information about the wine-patches
mailing list