[PATCH 3/5] explorer: Implement IShellWindows::OnNavigate().

Zebediah Figura z.figura12 at gmail.com
Sun May 17 23:29:42 CDT 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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 eea505ff61d..207733afe7e 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 137544567e4..5d0ca9948ef 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
@@ -1240,10 +1241,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)
-- 
2.26.2




More information about the wine-devel mailing list