mscoree: Implement IMetahostPolicy GetRequestedRuntime (try 2)
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Fri Nov 22 02:16:19 CST 2013
Hi,
Add check to get_runtime_info for an empty filename.
Changelog:
mscoree: Implement IMetahostPolicy GetRequestedRuntime
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From ee7a1f6c5c432ebd56f340fc2fd16e4c9a1aa24f Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Tue, 5 Nov 2013 15:13:34 +1100
Subject: [PATCH] Implement IMetahostPolicy GetRequestedRuntime
To: wine-patches <wine-patches at winehq.org>
---
dlls/mscoree/metahost.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index 6d87b25..4b89207 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -1190,11 +1190,52 @@ static HRESULT WINAPI metahostpolicy_GetRequestedRuntime(ICLRMetaHostPolicy *ifa
LPWSTR pwzImageVersion, DWORD *pcchImageVersion, DWORD *pdwConfigFlags, REFIID riid,
LPVOID *ppRuntime)
{
- FIXME("%d %p %p %p %p %p %p %p %s %p\n", dwPolicyFlags, pwzBinary, pCfgStream,
+ ICLRRuntimeInfo *result;
+ HRESULT hr;
+ WCHAR filename[MAX_PATH] = {0};
+ const WCHAR *path = NULL;
+ int flags = 0;
+
+ TRACE("%d %p %p %p %p %p %p %p %s %p\n", dwPolicyFlags, pwzBinary, pCfgStream,
pwzVersion, pcchVersion, pwzImageVersion, pcchImageVersion, pdwConfigFlags,
debugstr_guid(riid), ppRuntime);
- return E_NOTIMPL;
+ if (pCfgStream)
+ FIXME("ignoring config file stream\n");
+
+ if (pdwConfigFlags)
+ FIXME("ignoring config flags\n");
+
+ if(dwPolicyFlags & METAHOST_POLICY_USE_PROCESS_IMAGE_PATH)
+ {
+ GetModuleFileNameW(0, filename, MAX_PATH);
+ path = filename;
+ }
+ else if(pwzBinary)
+ {
+ path = pwzBinary;
+ }
+
+ if(dwPolicyFlags & METAHOST_POLICY_APPLY_UPGRADE_POLICY)
+ flags |= RUNTIME_INFO_UPGRADE_VERSION;
+
+ hr = get_runtime_info(path, pwzImageVersion, NULL, 0, flags, FALSE, &result);
+ if (SUCCEEDED(hr))
+ {
+ if (pwzImageVersion)
+ {
+ /* Ignoring errors on purpose */
+ ICLRRuntimeInfo_GetVersionString(result, pwzImageVersion, pcchImageVersion);
+ }
+
+ hr = ICLRRuntimeInfo_QueryInterface(result, riid, ppRuntime);
+
+ ICLRRuntimeInfo_Release(result);
+ }
+
+ TRACE("<- 0x%08x\n", hr);
+
+ return hr;
}
static const struct ICLRMetaHostPolicyVtbl CLRMetaHostPolicy_vtbl =
@@ -1327,6 +1368,9 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
if (runtimeinfo_flags & ~supported_runtime_flags)
FIXME("unsupported runtimeinfo flags %x\n", runtimeinfo_flags & ~supported_runtime_flags);
+ if(exefile && lstrlenW(exefile) == 0)
+ exefile = NULL;
+
if (exefile && !config_file)
{
strcpyW(local_config_file, exefile);
--
1.8.3.2
More information about the wine-patches
mailing list