explorer: Implement IShellWindows::FindWindowSW() for non-desktop windows.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Zebediah Figura 2020-05-17 23:29:43 -05:00 committed by Alexandre Julliard
parent 54e1559a25
commit 7b56edf9a4
2 changed files with 38 additions and 15 deletions

View File

@ -1064,7 +1064,7 @@ static void test_ShellWindows(void)
VariantInit(&v2);
hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_EXPLORER, &ret, 0, &disp);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(!ret, "Got window %#x.\n", ret);
ok(!disp, "Got IDispatch %p.\n", &disp);
@ -1075,15 +1075,15 @@ static void test_ShellWindows(void)
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);
todo_wine ok(ret == (LONG)(LONG_PTR)hwnd, "Expected %p, got %#x.\n", hwnd, ret);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(ret == (LONG)(LONG_PTR)hwnd, "Expected %p, got %#x.\n", hwnd, ret);
ok(!disp, "Got IDispatch %p.\n", &disp);
hr = IShellWindows_Revoke(shellwindows, cookie);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IShellWindows_FindWindowSW(shellwindows, &v, &v2, SWC_EXPLORER, &ret, 0, &disp);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ok(!ret, "Got window %#x.\n", ret);
ok(!disp, "Got IDispatch %p.\n", &disp);

View File

@ -1284,26 +1284,49 @@ static HRESULT WINAPI shellwindows_OnActivated(IShellWindows *iface, LONG cookie
return E_NOTIMPL;
}
static HRESULT WINAPI shellwindows_FindWindowSW(IShellWindows *iface, VARIANT *loc,
VARIANT *root, int class, LONG *hwnd, int options, IDispatch **disp)
static HRESULT WINAPI shellwindows_FindWindowSW(IShellWindows *iface, VARIANT *location,
VARIANT *root, int class, LONG *hwnd, int options, IDispatch **disp)
{
TRACE("%s %s 0x%x %p 0x%x %p\n", debugstr_variant(loc), debugstr_variant(root),
class, hwnd, options, disp);
struct shellwindows *sw = impl_from_IShellWindows(iface);
unsigned int i;
if (class != SWC_DESKTOP)
TRACE("iface %p, location %p, root %p, class %#x, hwnd %p, options %#x, disp %p.\n",
iface, location, root, class, hwnd, options, disp);
if (class == SWC_DESKTOP)
{
WARN("only SWC_DESKTOP class supported.\n");
*hwnd = (LONG)(LONG_PTR)GetDesktopWindow();
if (options & SWFO_NEEDDISPATCH)
{
*disp = (IDispatch *)&desktopshellbrowserwindow.IWebBrowser2_iface;
IDispatch_AddRef(*disp);
}
return S_OK;
}
if (options)
FIXME("Ignoring options %#x.\n", options);
if (V_VT(location) != (VT_ARRAY | VT_UI1))
{
FIXME("Unexpected variant type %s.\n", debugstr_vt(V_VT(location)));
return E_NOTIMPL;
}
*hwnd = HandleToLong(GetDesktopWindow());
if (options & SWFO_NEEDDISPATCH)
EnterCriticalSection(&sw->cs);
for (i = 0; i < sw->count; ++i)
{
*disp = (IDispatch*)&desktopshellbrowserwindow.IWebBrowser2_iface;
IDispatch_AddRef(*disp);
if (sw->windows[i].class == class && ILIsEqual(V_ARRAY(location)->pvData, sw->windows[i].pidl))
{
*hwnd = sw->windows[i].hwnd;
LeaveCriticalSection(&sw->cs);
return S_OK;
}
}
return S_OK;
LeaveCriticalSection(&sw->cs);
return S_FALSE;
}
static HRESULT WINAPI shellwindows_OnCreated(IShellWindows *iface, LONG cookie, IUnknown *punk)