static HRESULT WINAPI ClServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv) { DocHost *This = impl_from_IServiceProvider(iface); if(IsEqualGUID(&IID_IHlinkFrame, guidService)) { TRACE("(%p)->(IID_IHlinkFrame %s %p)\n", This, debugstr_guid(riid), ppv); return IDispatch_QueryInterface(This->disp, riid, ppv); } if(IsEqualGUID(&IID_IWebBrowserApp, guidService)) { TRACE("IWebBrowserApp service\n"); return IDispatch_QueryInterface(This->disp, riid, ppv); } if(IsEqualGUID(&IID_IShellBrowser, guidService)) { TRACE("(%p)->(IID_IShellBrowser %s %p)\n", This, debugstr_guid(riid), ppv); if(!This->browser_service) { HRESULT hres; hres = create_browser_service(This, &This->browser_service); if(FAILED(hres)) return hres; } return IShellBrowser_QueryInterface(&This->browser_service->IShellBrowser_iface, riid, ppv); } FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); return E_NOINTERFACE; }
static HRESULT WINAPI DocObjectService_QueryInterface( IDocObjectService* iface, REFIID riid, void **ppvObject) { ShellBrowser *This = impl_from_IDocObjectService(iface); return IShellBrowser_QueryInterface(&This->IShellBrowser_iface, riid, ppvObject); }
static void test_ShellWindows(void) { IShellWindows *shellwindows; LONG cookie, cookie2, ret; IDispatch *disp; VARIANT v, v2; HRESULT hr; HWND hwnd; hr = CoCreateInstance(&CLSID_ShellWindows, NULL, CLSCTX_LOCAL_SERVER, &IID_IShellWindows, (void**)&shellwindows); ok(hr == S_OK, "got 0x%08x\n", hr); /* TODO: remove when explorer startup with clean prefix is fixed */ if (hr != S_OK) return; if (0) { /* NULL out argument - currently crashes on Wine */ hr = IShellWindows_Register(shellwindows, NULL, 0, SWC_EXPLORER, NULL); ok(hr == HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER), "got 0x%08x\n", hr); } hr = IShellWindows_Register(shellwindows, NULL, 0, SWC_EXPLORER, &cookie); todo_wine ok(hr == E_POINTER, "got 0x%08x\n", hr); hr = IShellWindows_Register(shellwindows, (IDispatch*)shellwindows, 0, SWC_EXPLORER, &cookie); todo_wine ok(hr == E_POINTER, "got 0x%08x\n", hr); hr = IShellWindows_Register(shellwindows, (IDispatch*)shellwindows, 0, SWC_EXPLORER, &cookie); todo_wine ok(hr == E_POINTER, "got 0x%08x\n", hr); hwnd = CreateWindowExA(0, "button", "test", BS_CHECKBOX | WS_VISIBLE | WS_POPUP, 0, 0, 50, 14, 0, 0, 0, NULL); ok(hwnd != NULL, "got %p, error %d\n", hwnd, GetLastError()); cookie = 0; hr = IShellWindows_Register(shellwindows, NULL, HandleToLong(hwnd), SWC_EXPLORER, &cookie); todo_wine { ok(hr == S_OK, "got 0x%08x\n", hr); ok(cookie != 0, "got %d\n", cookie); } cookie2 = 0; hr = IShellWindows_Register(shellwindows, NULL, HandleToLong(hwnd), SWC_EXPLORER, &cookie2); todo_wine { ok(hr == S_OK, "got 0x%08x\n", hr); ok(cookie2 != 0 && cookie2 != cookie, "got %d\n", cookie2); } hr = IShellWindows_Revoke(shellwindows, cookie); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); hr = IShellWindows_Revoke(shellwindows, cookie2); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); hr = IShellWindows_Revoke(shellwindows, 0); todo_wine ok(hr == S_FALSE, "got 0x%08x\n", hr); /* we can register ourselves as desktop, but FindWindowSW still returns real desktop window */ cookie = 0; hr = IShellWindows_Register(shellwindows, NULL, HandleToLong(hwnd), SWC_DESKTOP, &cookie); todo_wine { ok(hr == S_OK, "got 0x%08x\n", hr); ok(cookie != 0, "got %d\n", cookie); } disp = (void*)0xdeadbeef; ret = 0xdead; VariantInit(&v); hr = IShellWindows_FindWindowSW(shellwindows, &v, &v, SWC_DESKTOP, &ret, SWFO_NEEDDISPATCH, &disp); ok(hr == S_OK || broken(hr == S_FALSE), "got 0x%08x\n", hr); if (hr == S_FALSE) { /* winxp and earlier */ win_skip("SWC_DESKTOP is not supported, some tests will be skipped.\n"); /* older versions allowed to regiser SWC_DESKTOP and access it with FindWindowSW */ ok(disp == NULL, "got %p\n", disp); ok(ret == 0, "got %d\n", ret); } else { static const IID *browser_riids[] = { &IID_IWebBrowser2, &IID_NULL }; static const IID *viewdual_riids[] = { &IID_IShellFolderViewDual3, &IID_NULL }; IShellFolderViewDual *view; IShellBrowser *sb, *sb2; IServiceProvider *sp; IDispatch *doc, *app; IWebBrowser2 *wb; IShellView *sv; IUnknown *unk; ok(disp != NULL, "got %p\n", disp); ok(ret != HandleToUlong(hwnd), "got %d\n", ret); /* IDispatch-related tests */ test_dispatch_typeinfo(disp, browser_riids); /* IWebBrowser2 */ hr = IDispatch_QueryInterface(disp, &IID_IWebBrowser2, (void**)&wb); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IWebBrowser2_Refresh(wb); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); hr = IWebBrowser2_get_Application(wb, &app); ok(hr == S_OK, "got 0x%08x\n", hr); ok(disp == app, "got %p, %p\n", app, disp); IDispatch_Release(app); hr = IWebBrowser2_get_Document(wb, &doc); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); if (hr == S_OK) test_dispatch_typeinfo(doc, viewdual_riids); IWebBrowser2_Release(wb); /* IServiceProvider */ hr = IDispatch_QueryInterface(disp, &IID_IShellFolderViewDual, (void**)&view); ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); hr = IDispatch_QueryInterface(disp, &IID_IServiceProvider, (void**)&sp); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IShellBrowser, (void**)&sb); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IShellBrowser, (void**)&sb2); ok(hr == S_OK, "got 0x%08x\n", hr); ok(sb == sb2, "got %p, %p\n", sb, sb2); hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IOleWindow, (void**)&unk); ok(hr == S_OK, "got 0x%08x\n", hr); IUnknown_Release(unk); hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IExplorerBrowser, (void**)&unk); ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); hr = IShellBrowser_QueryInterface(sb, &IID_IExplorerBrowser, (void**)&unk); ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); hr = IShellBrowser_QueryInterface(sb, &IID_IWebBrowser2, (void**)&unk); ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); hr = IShellBrowser_QueryInterface(sb, &IID_IDispatch, (void**)&unk); ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); hr = IShellBrowser_QueryActiveShellView(sb, &sv); ok(hr == S_OK, "got 0x%08x\n", hr); IShellView_Release(sv); IShellBrowser_Release(sb2); IShellBrowser_Release(sb); hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IUnknown, (void**)&unk); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IUnknown_QueryInterface(unk, &IID_IShellBrowser, (void**)&sb2); ok(hr == S_OK, "got 0x%08x\n", hr); IShellBrowser_Release(sb2); IUnknown_Release(unk); hr = IServiceProvider_QueryService(sp, &SID_STopLevelBrowser, &IID_IShellView, (void**)&sv); ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); IServiceProvider_Release(sp); IDispatch_Release(disp); } disp = (void*)0xdeadbeef; ret = 0xdead; VariantInit(&v); hr = IShellWindows_FindWindowSW(shellwindows, &v, &v, SWC_DESKTOP, &ret, 0, &disp); ok(hr == S_OK || broken(hr == S_FALSE) /* winxp */, "got 0x%08x\n", hr); ok(disp == NULL, "got %p\n", disp); ok(ret != HandleToUlong(hwnd), "got %d\n", ret); disp = (void*)0xdeadbeef; ret = 0xdead; V_VT(&v) = VT_I4; V_I4(&v) = cookie; VariantInit(&v2); hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_BROWSER, &ret, SWFO_COOKIEPASSED, &disp); todo_wine ok(hr == S_FALSE, "got 0x%08x\n", hr); ok(disp == NULL, "got %p\n", disp); ok(ret == 0, "got %d\n", ret); hr = IShellWindows_Revoke(shellwindows, cookie); todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); DestroyWindow(hwnd); IShellWindows_Release(shellwindows); }