[PATCH 1/5] shell32: Implement IExplorerBrowser::BrowseToObject.

David Hedberg david.hedberg at gmail.com
Wed Aug 25 08:24:32 CDT 2010


---
 dlls/shell32/ebrowser.c       |   16 ++++++++++++++--
 dlls/shell32/tests/ebrowser.c |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c
index daf5d4a..0d11d13 100644
--- a/dlls/shell32/ebrowser.c
+++ b/dlls/shell32/ebrowser.c
@@ -633,9 +633,21 @@ static HRESULT WINAPI IExplorerBrowser_fnBrowseToObject(IExplorerBrowser *iface,
                                                         IUnknown *punk, UINT uFlags)
 {
     ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
-    FIXME("stub, %p (%p, 0x%x)\n", This, punk, uFlags);
+    LPITEMIDLIST pidl;
+    HRESULT hr;
+    TRACE("%p (%p, 0x%x)\n", This, punk, uFlags);
 
-    return E_NOTIMPL;
+    if(!punk)
+        return IExplorerBrowser_fnBrowseToIDList(iface, NULL, uFlags);
+
+    hr = SHGetIDListFromObject(punk, &pidl);
+    if(SUCCEEDED(hr))
+    {
+        hr = IExplorerBrowser_BrowseToIDList(iface, pidl, uFlags);
+        ILFree(pidl);
+    }
+
+    return hr;
 }
 
 static HRESULT WINAPI IExplorerBrowser_fnFillFromObject(IExplorerBrowser *iface,
diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c
index 60472a4..442d8dc 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -760,6 +760,7 @@ static void test_navigation(void)
 {
     IExplorerBrowser *peb, *peb2;
     IFolderView *pfv;
+    IShellItem *psi;
     IShellFolder *psf;
     LPITEMIDLIST pidl_current, pidl_child;
     DWORD cookie, cookie2;
@@ -920,6 +921,38 @@ static void test_navigation(void)
     lres = IExplorerBrowser_Release(peb);
     ok(lres == 0, "Got lres %d\n", lres);
 
+    /* BrowseToObject tests */
+    ebrowser_instantiate(&peb);
+    ebrowser_initialize(peb);
+
+    /* Browse to the desktop by passing an IShellFolder */
+    hr = SHGetDesktopFolder(&psf);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    if(SUCCEEDED(hr))
+    {
+        hr = IExplorerBrowser_BrowseToObject(peb, (IUnknown*)psf, SBSP_DEFBROWSER);
+        ok(hr == S_OK, "got (0x%08x)\n", hr);
+        if(hr == S_OK) process_msgs();
+
+        IShellFolder_Release(psf);
+    }
+
+    /* Browse to the current directory by passing a ShellItem */
+    hr = pSHCreateShellItem(NULL, NULL, pidl_current, &psi);
+    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    if(SUCCEEDED(hr))
+    {
+        hr = IExplorerBrowser_BrowseToObject(peb, (IUnknown*)psi, SBSP_DEFBROWSER);
+        ok(hr == S_OK, "got (0x%08x)\n", hr);
+        process_msgs();
+
+        IShellItem_Release(psi);
+    }
+
+    IExplorerBrowser_Destroy(peb);
+    lres = IExplorerBrowser_Release(peb);
+    ok(lres == 0, "Got lres %d\n", lres);
+
     /* Cleanup */
     RemoveDirectoryW(child_path);
     ILFree(pidl_current);
-- 
1.7.2




More information about the wine-patches mailing list