mscoree: Implement IMetahostPolicy GetRequestedRuntime

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Thu Nov 21 02:43:39 CST 2013


Hi,
Thanks Vincent for you help.

Changelog:
     mscoree: Implement IMetahostPolicy GetRequestedRuntime


Best Regards
  Alistair Leslie-Hughes
-------------- next part --------------
>From 84f5873e2090125f10df478f1e8ae8047a533814 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 | 45 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index 6d87b25..c157953 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 && lstrlenW(pwzBinary) > 0)
+    {
+        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 =
-- 
1.8.3.2



More information about the wine-patches mailing list