Commit f6dad197 authored by David Hedberg's avatar David Hedberg Committed by Alexandre Julliard

shell32: Fix ExplorerBrowser::SetRect to work properly when passed a NULL-valued hdwp.

parent 08fe24de
...@@ -908,11 +908,13 @@ static HRESULT WINAPI IExplorerBrowser_fnSetRect(IExplorerBrowser *iface, ...@@ -908,11 +908,13 @@ static HRESULT WINAPI IExplorerBrowser_fnSetRect(IExplorerBrowser *iface,
ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface; ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
TRACE("%p (%p, %s)\n", This, phdwp, wine_dbgstr_rect(&rcBrowser)); TRACE("%p (%p, %s)\n", This, phdwp, wine_dbgstr_rect(&rcBrowser));
if(phdwp) if(phdwp && *phdwp)
{ {
*phdwp = DeferWindowPos(*phdwp, This->hwnd_main, NULL, rcBrowser.left, rcBrowser.top, *phdwp = DeferWindowPos(*phdwp, This->hwnd_main, NULL, rcBrowser.left, rcBrowser.top,
rcBrowser.right - rcBrowser.left, rcBrowser.bottom - rcBrowser.top, rcBrowser.right - rcBrowser.left, rcBrowser.bottom - rcBrowser.top,
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
if(!*phdwp)
return E_FAIL;
} }
else else
{ {
......
...@@ -1076,6 +1076,7 @@ static void test_basics(void) ...@@ -1076,6 +1076,7 @@ static void test_basics(void)
HWND eb_hwnd; HWND eb_hwnd;
RECT eb_rc; RECT eb_rc;
static const RECT exp_rc = {11, 21, 49, 49}; static const RECT exp_rc = {11, 21, 49, 49};
static const RECT exp_rc2 = {11, 21, 49, 24};
hr = IShellBrowser_GetWindow(psb, &eb_hwnd); hr = IShellBrowser_GetWindow(psb, &eb_hwnd);
ok(hr == S_OK, "Got 0x%08x\n", hr); ok(hr == S_OK, "Got 0x%08x\n", hr);
...@@ -1085,6 +1086,24 @@ static void test_basics(void) ...@@ -1085,6 +1086,24 @@ static void test_basics(void)
ok(EqualRect(&eb_rc, &exp_rc), "Got rect (%d, %d) - (%d, %d)\n", ok(EqualRect(&eb_rc, &exp_rc), "Got rect (%d, %d) - (%d, %d)\n",
eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom); eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
/* Try resizing with invalid hdwp */
rc.bottom = 25;
hdwp = (HDWP)0xdeadbeef;
hr = IExplorerBrowser_SetRect(peb, &hdwp, rc);
ok(hr == E_FAIL, "Got 0x%08x\n", hr);
GetClientRect(eb_hwnd, &eb_rc);
MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2);
ok(EqualRect(&eb_rc, &exp_rc), "Got rect (%d, %d) - (%d, %d)\n",
eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
hdwp = NULL;
hr = IExplorerBrowser_SetRect(peb, &hdwp, rc);
ok(hr == S_OK, "Got 0x%08x\n", hr);
GetClientRect(eb_hwnd, &eb_rc);
MapWindowPoints(eb_hwnd, hwnd, (POINT*)&eb_rc, 2);
ok(EqualRect(&eb_rc, &exp_rc2), "Got rect (%d, %d) - (%d, %d)\n",
eb_rc.left, eb_rc.top, eb_rc.right, eb_rc.bottom);
IShellBrowser_Release(psb); IShellBrowser_Release(psb);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment