Zebediah Figura : explorer: Implement IShellWindows::OnNavigate().

Alexandre Julliard julliard at winehq.org
Mon May 18 15:00:14 CDT 2020


Module: wine
Branch: master
Commit: 54e1559a253315f4243cbe405c82647dde3ac36d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=54e1559a253315f4243cbe405c82647dde3ac36d

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun May 17 23:29:42 2020 -0500

explorer: Implement IShellWindows::OnNavigate().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/tests/shelldispatch.c |  5 ++++-
 programs/explorer/desktop.c        | 37 ++++++++++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/tests/shelldispatch.c b/dlls/shell32/tests/shelldispatch.c
index eea505ff61..207733afe7 100644
--- a/dlls/shell32/tests/shelldispatch.c
+++ b/dlls/shell32/tests/shelldispatch.c
@@ -1068,8 +1068,11 @@ static void test_ShellWindows(void)
     ok(!ret, "Got window %#x.\n", ret);
     ok(!disp, "Got IDispatch %p.\n", &disp);
 
+    hr = IShellWindows_OnNavigate(shellwindows, 0, &v);
+    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+
     hr = IShellWindows_OnNavigate(shellwindows, cookie, &v);
-    todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_EXPLORER, &ret, 0, &disp);
     todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
index 53dcd21817..264a8cb810 100644
--- a/programs/explorer/desktop.c
+++ b/programs/explorer/desktop.c
@@ -151,6 +151,7 @@ struct window
 {
     LONG cookie, hwnd;
     int class;
+    ITEMIDLIST *pidl;
 };
 
 struct shellwindows
@@ -1241,10 +1242,40 @@ static HRESULT WINAPI shellwindows_Revoke(IShellWindows *iface, LONG cookie)
     return S_FALSE;
 }
 
-static HRESULT WINAPI shellwindows_OnNavigate(IShellWindows *iface, LONG cookie, VARIANT *loc)
+static HRESULT WINAPI shellwindows_OnNavigate(IShellWindows *iface, LONG cookie, VARIANT *location)
 {
-    FIXME("0x%x %s\n", cookie, debugstr_variant(loc));
-    return E_NOTIMPL;
+    struct shellwindows *sw = impl_from_IShellWindows(iface);
+    unsigned int i;
+
+    TRACE("iface %p, cookie %u, location %s.\n", iface, cookie, debugstr_variant(location));
+
+    if (V_VT(location) != (VT_ARRAY | VT_UI1))
+    {
+        FIXME("Unexpected variant type %s.\n", debugstr_vt(V_VT(location)));
+        return E_NOTIMPL;
+    }
+
+    EnterCriticalSection(&sw->cs);
+
+    for (i = 0; i < sw->count; ++i)
+    {
+        if (sw->windows[i].cookie == cookie)
+        {
+            size_t len = V_ARRAY(location)->rgsabound[0].cElements;
+            if (!(sw->windows[i].pidl = realloc(sw->windows[i].pidl, len)))
+            {
+                LeaveCriticalSection(&sw->cs);
+                return E_OUTOFMEMORY;
+            }
+            memcpy(sw->windows[i].pidl, V_ARRAY(location)->pvData, len);
+
+            LeaveCriticalSection(&sw->cs);
+            return S_OK;
+        }
+    }
+
+    LeaveCriticalSection(&sw->cs);
+    return E_INVALIDARG;
 }
 
 static HRESULT WINAPI shellwindows_OnActivated(IShellWindows *iface, LONG cookie, VARIANT_BOOL active)




More information about the wine-cvs mailing list