Alistair Leslie-Hughes : mscoree: Partially implement ICLRMetaHost RequestRuntimeLoadedNotification.

Alexandre Julliard julliard at winehq.org
Fri Oct 11 10:11:13 CDT 2013


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

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Wed Oct  2 12:13:54 2013 +1000

mscoree: Partially implement ICLRMetaHost RequestRuntimeLoadedNotification.

---

 dlls/mscoree/metahost.c       |   13 +++++++++++--
 dlls/mscoree/tests/metahost.c |   18 ++++++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index f6558d9..f84e455 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -986,6 +986,8 @@ static const struct IEnumUnknownVtbl InstalledRuntimeEnum_Vtbl = {
 struct CLRMetaHost
 {
     ICLRMetaHost ICLRMetaHost_iface;
+
+    RuntimeLoadedCallbackFnPtr callback;
 };
 
 static struct CLRMetaHost GlobalCLRMetaHost;
@@ -1168,9 +1170,16 @@ static HRESULT WINAPI CLRMetaHost_EnumerateLoadedRuntimes(ICLRMetaHost* iface,
 static HRESULT WINAPI CLRMetaHost_RequestRuntimeLoadedNotification(ICLRMetaHost* iface,
     RuntimeLoadedCallbackFnPtr pCallbackFunction)
 {
-    FIXME("%p\n", pCallbackFunction);
+    TRACE("%p\n", pCallbackFunction);
 
-    return E_NOTIMPL;
+    if(!pCallbackFunction)
+        return E_POINTER;
+
+    WARN("Callback currently will not be called.\n");
+
+    GlobalCLRMetaHost.callback = pCallbackFunction;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI CLRMetaHost_QueryLegacyV2RuntimeBinding(ICLRMetaHost* iface,
diff --git a/dlls/mscoree/tests/metahost.c b/dlls/mscoree/tests/metahost.c
index a9872f0..7794e74 100644
--- a/dlls/mscoree/tests/metahost.c
+++ b/dlls/mscoree/tests/metahost.c
@@ -142,6 +142,23 @@ static void test_getruntime(void)
     ok(hr == CLR_E_SHIM_RUNTIME, "GetVersion failed, hr=%x\n", hr);
 }
 
+static void WINAPI notification_callback(ICLRRuntimeInfo *pRuntimeInfo, CallbackThreadSetFnPtr pfnCallbackThreadSet,
+    CallbackThreadUnsetFnPtr pfnCallbackThreadUnset)
+{
+    ok(0, "Unexpected call\n");
+}
+
+static void test_notification(void)
+{
+    HRESULT hr;
+
+    hr = ICLRMetaHost_RequestRuntimeLoadedNotification(metahost, NULL);
+    ok(hr == E_POINTER, "GetVersion failed, hr=%x\n", hr);
+
+    hr = ICLRMetaHost_RequestRuntimeLoadedNotification(metahost,notification_callback);
+    ok(hr == S_OK, "GetVersion failed, hr=%x\n", hr);
+}
+
 START_TEST(metahost)
 {
     if (!init_pointers())
@@ -150,6 +167,7 @@ START_TEST(metahost)
     test_enumruntimes();
 
     test_getruntime();
+    test_notification();
 
     cleanup();
 }




More information about the wine-cvs mailing list