explorer: Implement IShellWindows::OnNavigate().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-05-17 23:29:42 -05:00 committed by Alexandre Julliard
parent aeff6f189f
commit 54e1559a25
2 changed files with 38 additions and 4 deletions

View File

@ -1068,8 +1068,11 @@ static void test_ShellWindows(void)
ok(!ret, "Got window %#x.\n", ret); ok(!ret, "Got window %#x.\n", ret);
ok(!disp, "Got IDispatch %p.\n", &disp); 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); 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); hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_EXPLORER, &ret, 0, &disp);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);

View File

@ -151,6 +151,7 @@ struct window
{ {
LONG cookie, hwnd; LONG cookie, hwnd;
int class; int class;
ITEMIDLIST *pidl;
}; };
struct shellwindows struct shellwindows
@ -1241,10 +1242,40 @@ static HRESULT WINAPI shellwindows_Revoke(IShellWindows *iface, LONG cookie)
return S_FALSE; 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)); struct shellwindows *sw = impl_from_IShellWindows(iface);
return E_NOTIMPL; 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) static HRESULT WINAPI shellwindows_OnActivated(IShellWindows *iface, LONG cookie, VARIANT_BOOL active)