mscoree: Partial implement ICLRMetaHost RequestRuntimeLoadedNotification (try 3)

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Oct 8 03:47:48 CDT 2013


Hi,


Changelog:
       mscoree: Partial implement ICLRMetaHost 
RequestRuntimeLoadedNotification


Best Regards
    Alistair Leslie-Hughes


-------------- next part --------------
>From ad64c5070aeeccc0381c6e90d92996732a7a6721 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Wed, 2 Oct 2013 12:13:54 +1000
Subject: [PATCH] Partial implement ICLRMetaHost
 RequestRuntimeLoadedNotification
To: wine-patches <wine-patches at winehq.org>

---
 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 519e991..a205bf0 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..adc7b76 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();
 }
-- 
1.8.1.2



More information about the wine-patches mailing list