Jacek Caban : mshtml: Added PluginHost::GetMoniker implementation.

Alexandre Julliard julliard at winehq.org
Fri Dec 10 11:57:02 CST 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Dec 10 16:37:53 2010 +0100

mshtml: Added PluginHost::GetMoniker implementation.

---

 dlls/mshtml/pluginhost.c    |   23 ++++++++++++++++++++---
 dlls/mshtml/tests/activex.c |   25 +++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index 7b7e210..9f6f2d5 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -283,11 +283,28 @@ static HRESULT WINAPI PHClientSite_SaveObject(IOleClientSite *iface)
 }
 
 static HRESULT WINAPI PHClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign,
-                                            DWORD dwWhichMoniker, IMoniker **ppmk)
+        DWORD dwWhichMoniker, IMoniker **ppmk)
 {
     PluginHost *This = impl_from_IOleClientSite(iface);
-    FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
+
+    switch(dwWhichMoniker) {
+    case OLEWHICHMK_CONTAINER:
+        if(!This->doc || !This->doc->basedoc.window || !This->doc->basedoc.window->mon) {
+            FIXME("no moniker\n");
+            return E_UNEXPECTED;
+        }
+
+        *ppmk = This->doc->basedoc.window->mon;
+        IMoniker_AddRef(*ppmk);
+        break;
+    default:
+        FIXME("which %d\n", dwWhichMoniker);
+        return E_NOTIMPL;
+    }
+
+    return S_OK;
 }
 
 static HRESULT WINAPI PHClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
diff --git a/dlls/mshtml/tests/activex.c b/dlls/mshtml/tests/activex.c
index 3e5f7b8..89b8af4 100644
--- a/dlls/mshtml/tests/activex.c
+++ b/dlls/mshtml/tests/activex.c
@@ -162,6 +162,22 @@ static void set_plugin_readystate(READYSTATE state)
     IPropertyNotifySink_Release(prop_notif);
 }
 
+static void test_mon_displayname(IMoniker *mon, const char *exname)
+{
+    LPOLESTR display_name;
+    DWORD mksys;
+    HRESULT hres;
+
+    hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
+    ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
+    ok(!strcmp_wa(display_name, exname), "display_name = %s\n", wine_dbgstr_w(display_name));
+    CoTaskMemFree(display_name);
+
+    hres = IMoniker_IsSystemMoniker(mon, &mksys);
+    ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
+    ok(mksys == MKSYS_URLMONIKER, "mksys = %d\n", mksys);
+}
+
 static HRESULT ax_qi(REFIID,void**);
 
 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv)
@@ -332,6 +348,7 @@ static HRESULT WINAPI PersistPropertyBag_Load(IPersistPropertyBag *face, IProper
 {
     IBindHost *bind_host, *bind_host2;
     IServiceProvider *sp;
+    IMoniker *mon;
     VARIANT v;
     HRESULT hres;
 
@@ -399,6 +416,14 @@ static HRESULT WINAPI PersistPropertyBag_Load(IPersistPropertyBag *face, IProper
 
     ok(iface_cmp((IUnknown*)bind_host, (IUnknown*)bind_host2), "bind_host != bind_host2\n");
     IBindHost_Release(bind_host2);
+
+    mon = NULL;
+    hres = IOleClientSite_GetMoniker(client_site, OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_CONTAINER, &mon);
+    ok(hres == S_OK, "GetMoniker failed: %08x\n", hres);
+    ok(mon != NULL, "mon == NULL\n");
+    test_mon_displayname(mon, "about:blank");
+    IMoniker_Release(mon);
+
     IBindHost_Release(bind_host);
 
     set_plugin_readystate(READYSTATE_COMPLETE);




More information about the wine-cvs mailing list