diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index b356653b43e..3c186822201 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -634,8 +634,16 @@ static HRESULT exec_enable_interaction(HTMLDocument *This, DWORD nCmdexecopt, VA static HRESULT exec_on_unload(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) { - FIXME("(%p)->(%ld %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut); - return E_NOTIMPL; + TRACE("(%p)->(%ld %p %p)\n", This, nCmdexecopt, pvaIn, pvaOut); + + /* Tests show that we have nothing more to do here */ + + if(pvaOut) { + V_VT(pvaOut) = VT_BOOL; + V_BOOL(pvaOut) = VARIANT_TRUE; + } + + return S_OK; } static HRESULT exec_show_page_setup(HTMLDocument *This, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) @@ -775,7 +783,7 @@ static HRESULT WINAPI OleCommandTarget_QueryStatus(IOleCommandTarget *iface, con } } - if(pguidCmdGroup) + if(pCmdText) FIXME("Set pCmdText\n"); }else { FIXME("Unsupported pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup)); @@ -797,9 +805,13 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID } return exec_table[nCmdID].func(This, nCmdexecopt, pvaIn, pvaOut); + }else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) { + FIXME("unsupported nCmdID %ld of CGID_Explorer group\n", nCmdID); + TRACE("%p %p\n", pvaIn, pvaOut); + return OLECMDERR_E_NOTSUPPORTED; }else if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) { FIXME("unsupported nCmdID %ld of CGID_ShellDocView group\n", nCmdID); - return OLECMDERR_E_UNKNOWNGROUP; + return OLECMDERR_E_NOTSUPPORTED; } FIXME("Unsupported pguidCmdGroup %s\n", debugstr_guid(pguidCmdGroup)); diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 96a8710ebed..45e95304f74 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -210,8 +210,7 @@ static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, static const WCHAR wszHTML_Document[] = {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0}; - ok(expect_SetActiveObject, "unexpected call\n"); - called_SetActiveObject = TRUE; + CHECK_EXPECT2(SetActiveObject); if(expect_SetActiveObject_active) { ok(pActiveObject != NULL, "pActiveObject = NULL\n"); @@ -1077,6 +1076,7 @@ static HRESULT QueryInterface(REFIID riid, void **ppv) /* TODO: * IServiceProvider + * IOleInPlaceSiteEx * {D48A6EC6-6A4A-11CF-94A7-444553540000} * {7BB0B520-B1A7-11D2-BB23-00C04F79ABCD} * {000670BA-0000-0000-C000-000000000046} @@ -1365,6 +1365,31 @@ static void test_OleCommandTarget_fail(IUnknown *unk) IOleCommandTarget_Release(cmdtrg); } +static void test_exec_onunload(IUnknown *unk) +{ + IOleCommandTarget *cmdtrg; + VARIANT var; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg); + ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08lx\n", hres); + if(FAILED(hres)) + return; + + memset(&var, 0x0a, sizeof(var)); + hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD, + OLECMDEXECOPT_DODEFAULT, NULL, &var); + ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08lx\n", hres); + ok(V_VT(&var) == VT_BOOL, "V_VT(var)=%d, expected VT_BOOL\n", V_VT(&var)); + ok(V_BOOL(&var) == VARIANT_TRUE, "V_BOOL(var)=%x, expected VARIANT_TRUE\n", V_BOOL(&var)); + + hres = IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_ONUNLOAD, + OLECMDEXECOPT_DODEFAULT, NULL, NULL); + ok(hres == S_OK, "Exec(..., OLECMDID_ONUNLOAD, ...) failed: %08lx\n", hres); + + IOleCommandTarget_Release(cmdtrg); +} + static HWND create_container_window(void) { static const WCHAR wszHTMLDocumentTest[] = @@ -1825,6 +1850,7 @@ static void test_HTMLDocument_hlink(void) test_download(); #endif + test_exec_onunload(unk); test_Window(unk, TRUE); test_InPlaceDeactivate(unk, TRUE); test_Close(unk, FALSE); @@ -1835,7 +1861,6 @@ static void test_HTMLDocument_hlink(void) ref = IUnknown_Release(unk); ok(ref == 0, "ref=%ld, expected 0\n", ref); - } START_TEST(htmldoc)