From 1efc54088b9dcb924ecce63c4b6760f224391ec1 Mon Sep 17 00:00:00 2001 From: David Hedberg Date: Fri, 20 Aug 2010 07:45:58 +0200 Subject: [PATCH] shell32: Add IShellBrowser stub. --- dlls/shell32/ebrowser.c | 204 ++++++++++++++++++++++++++++++++++ dlls/shell32/tests/ebrowser.c | 55 ++++++++- 2 files changed, 258 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c index 1a71e02db4d..ff035ba513c 100644 --- a/dlls/shell32/ebrowser.c +++ b/dlls/shell32/ebrowser.c @@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); typedef struct _ExplorerBrowserImpl { const IExplorerBrowserVtbl *lpVtbl; + const IShellBrowserVtbl *lpsbVtbl; LONG ref; BOOL destroyed; } ExplorerBrowserImpl; @@ -54,6 +55,10 @@ static HRESULT WINAPI IExplorerBrowser_fnQueryInterface(IExplorerBrowser *iface, { *ppvObject = This; } + else if(IsEqualIID(riid, &IID_IShellBrowser)) + { + *ppvObject = &This->lpsbVtbl; + } if(*ppvObject) { @@ -255,6 +260,204 @@ static const IExplorerBrowserVtbl vt_IExplorerBrowser = IExplorerBrowser_fnGetCurrentView }; +/************************************************************************** + * IShellBrowser Implementation + */ + +static inline ExplorerBrowserImpl *impl_from_IShellBrowser(IShellBrowser *iface) +{ + return (ExplorerBrowserImpl *)((char*)iface - FIELD_OFFSET(ExplorerBrowserImpl, lpsbVtbl)); +} + +static HRESULT WINAPI IShellBrowser_fnQueryInterface(IShellBrowser *iface, + REFIID riid, void **ppvObject) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + TRACE("%p\n", This); + return IUnknown_QueryInterface((IUnknown*) This, riid, ppvObject); +} + +static ULONG WINAPI IShellBrowser_fnAddRef(IShellBrowser *iface) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + TRACE("%p\n", This); + return IUnknown_AddRef((IUnknown*) This); +} + +static ULONG WINAPI IShellBrowser_fnRelease(IShellBrowser *iface) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + TRACE("%p\n", This); + return IUnknown_Release((IUnknown*) This); +} + +static HRESULT WINAPI IShellBrowser_fnGetWindow(IShellBrowser *iface, HWND *phwnd) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%p)\n", This, phwnd); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnContextSensitiveHelp(IShellBrowser *iface, + BOOL fEnterMode) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%d)\n", This, fEnterMode); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnInsertMenusSB(IShellBrowser *iface, + HMENU hmenuShared, + LPOLEMENUGROUPWIDTHS lpMenuWidths) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + TRACE("%p (%p, %p)\n", This, hmenuShared, lpMenuWidths); + + /* Not implemented. */ + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnSetMenuSB(IShellBrowser *iface, + HMENU hmenuShared, + HOLEMENU holemenuReserved, + HWND hwndActiveObject) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + TRACE("%p (%p, %p, %p)\n", This, hmenuShared, holemenuReserved, hwndActiveObject); + + /* Not implemented. */ + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnRemoveMenusSB(IShellBrowser *iface, + HMENU hmenuShared) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + TRACE("%p (%p)\n", This, hmenuShared); + + /* Not implemented. */ + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnSetStatusTextSB(IShellBrowser *iface, + LPCOLESTR pszStatusText) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%s)\n", This, debugstr_w(pszStatusText)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnEnableModelessSB(IShellBrowser *iface, + BOOL fEnable) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%d)\n", This, fEnable); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnTranslateAcceleratorSB(IShellBrowser *iface, + MSG *pmsg, WORD wID) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%p, 0x%x)\n", This, pmsg, wID); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnBrowseObject(IShellBrowser *iface, + LPCITEMIDLIST pidl, UINT wFlags) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnGetViewStateStream(IShellBrowser *iface, + DWORD grfMode, + IStream **ppStrm) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (0x%x, %p)\n", This, grfMode, ppStrm); + + *ppStrm = NULL; + return E_FAIL; +} + +static HRESULT WINAPI IShellBrowser_fnGetControlWindow(IShellBrowser *iface, + UINT id, HWND *phwnd) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + TRACE("%p (%d, %p)\n", This, id, phwnd); + + /* Not implemented. */ + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnSendControlMsg(IShellBrowser *iface, + UINT id, UINT uMsg, + WPARAM wParam, LPARAM lParam, + LRESULT *pret) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%d, %d, %lx, %lx, %p)\n", This, id, uMsg, wParam, lParam, pret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnQueryActiveShellView(IShellBrowser *iface, + IShellView **ppshv) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%p)\n", This, ppshv); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnOnViewWindowActive(IShellBrowser *iface, + IShellView *pshv) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%p)\n", This, pshv); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellBrowser_fnSetToolbarItems(IShellBrowser *iface, + LPTBBUTTONSB lpButtons, + UINT nButtons, UINT uFlags) +{ + ExplorerBrowserImpl *This = impl_from_IShellBrowser(iface); + FIXME("stub, %p (%p, %d, 0x%x)\n", This, lpButtons, nButtons, uFlags); + + return E_NOTIMPL; +} + +static const IShellBrowserVtbl vt_IShellBrowser = { + IShellBrowser_fnQueryInterface, + IShellBrowser_fnAddRef, + IShellBrowser_fnRelease, + IShellBrowser_fnGetWindow, + IShellBrowser_fnContextSensitiveHelp, + IShellBrowser_fnInsertMenusSB, + IShellBrowser_fnSetMenuSB, + IShellBrowser_fnRemoveMenusSB, + IShellBrowser_fnSetStatusTextSB, + IShellBrowser_fnEnableModelessSB, + IShellBrowser_fnTranslateAcceleratorSB, + IShellBrowser_fnBrowseObject, + IShellBrowser_fnGetViewStateStream, + IShellBrowser_fnGetControlWindow, + IShellBrowser_fnSendControlMsg, + IShellBrowser_fnQueryActiveShellView, + IShellBrowser_fnOnViewWindowActive, + IShellBrowser_fnSetToolbarItems +}; + HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) { ExplorerBrowserImpl *eb; @@ -270,6 +473,7 @@ HRESULT WINAPI ExplorerBrowser_Constructor(IUnknown *pUnkOuter, REFIID riid, voi eb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ExplorerBrowserImpl)); eb->ref = 1; eb->lpVtbl = &vt_IExplorerBrowser; + eb->lpsbVtbl = &vt_IShellBrowser; ret = IExplorerBrowser_QueryInterface((IExplorerBrowser*)eb, riid, ppv); IExplorerBrowser_Release((IExplorerBrowser*)eb); diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c index 35c87bda85e..e2e4b4f33fc 100644 --- a/dlls/shell32/tests/ebrowser.c +++ b/dlls/shell32/tests/ebrowser.c @@ -55,7 +55,7 @@ static void test_QueryInterface(void) test_qinterface(IID_IUnknown, S_OK); test_qinterface(IID_IExplorerBrowser, S_OK); - todo_wine test_qinterface(IID_IShellBrowser, S_OK); + test_qinterface(IID_IShellBrowser, S_OK); todo_wine test_qinterface(IID_IOleWindow, S_OK); todo_wine test_qinterface(IID_ICommDlgBrowser, S_OK); todo_wine test_qinterface(IID_ICommDlgBrowser2, S_OK); @@ -77,6 +77,58 @@ static void test_QueryInterface(void) ok(lres == 0, "Got %d\n", lres); } +static void test_SB_misc(void) +{ + IExplorerBrowser *peb; + IShellBrowser *psb; + HRESULT hr; + HWND retHwnd; + LONG lres; + + ebrowser_instantiate(&peb); + hr = IExplorerBrowser_QueryInterface(peb, &IID_IShellBrowser, (void**)&psb); + ok(hr == S_OK, "Got 0x%08x\n", hr); + if(FAILED(hr)) + { + skip("Failed to get IShellBrowser interface.\n"); + return; + } + + /* Some unimplemented methods */ + retHwnd = (HWND)0xDEADBEEF; + hr = IShellBrowser_GetControlWindow(psb, FCW_TOOLBAR, &retHwnd); + ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr); + ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n"); + + hr = IShellBrowser_GetControlWindow(psb, FCW_STATUS, &retHwnd); + ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr); + ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n"); + + hr = IShellBrowser_GetControlWindow(psb, FCW_TREE, &retHwnd); + ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr); + ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n"); + + hr = IShellBrowser_GetControlWindow(psb, FCW_PROGRESS, &retHwnd); + ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr); + ok(retHwnd == (HWND)0xDEADBEEF, "HWND overwritten\n"); + + /* ::InsertMenuSB */ + hr = IShellBrowser_InsertMenusSB(psb, NULL, NULL); + ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr); + + /* ::RemoveMenusSB */ + hr = IShellBrowser_RemoveMenusSB(psb, NULL); + ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr); + + /* ::SetMenuSB */ + hr = IShellBrowser_SetMenuSB(psb, NULL, NULL, NULL); + ok(hr == E_NOTIMPL, "got (0x%08x)\n", hr); + + IShellBrowser_Release(psb); + lres = IExplorerBrowser_Release(peb); + ok(lres == 0, "Got %d\n", lres); +} + static BOOL test_instantiate_control(void) { IExplorerBrowser *peb; @@ -103,6 +155,7 @@ START_TEST(ebrowser) } test_QueryInterface(); + test_SB_misc(); OleUninitialize(); }