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 53dcd218178..264a8cb810c 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)