Alistair Leslie-Hughes : mscoree: Implement IMetahostPolicy GetRequestedRuntime.

Alexandre Julliard julliard at winehq.org
Fri Nov 22 10:23:06 CST 2013


Module: wine
Branch: master
Commit: d8f54b4d4922de8a73527368ec1d741db543b621
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d8f54b4d4922de8a73527368ec1d741db543b621

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Tue Nov  5 15:13:34 2013 +1100

mscoree: Implement IMetahostPolicy GetRequestedRuntime.

---

 dlls/mscoree/metahost.c |   48 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index 6d87b25..3a7e109 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];
+    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 && !exefile[0])
+        exefile = NULL;
+
     if (exefile && !config_file)
     {
         strcpyW(local_config_file, exefile);




More information about the wine-cvs mailing list