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

This commit is contained in:
David Hedberg 2010-12-19 22:07:12 +01:00 committed by Alexandre Julliard
parent 08fe24de06
commit f6dad19730
2 changed files with 22 additions and 1 deletions

View file

@ -908,11 +908,13 @@ static HRESULT WINAPI IExplorerBrowser_fnSetRect(IExplorerBrowser *iface,
ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface;
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,
rcBrowser.right - rcBrowser.left, rcBrowser.bottom - rcBrowser.top,
SWP_NOZORDER | SWP_NOACTIVATE);
if(!*phdwp)
return E_FAIL;
}
else
{

View file

@ -1076,6 +1076,7 @@ static void test_basics(void)
HWND eb_hwnd;
RECT eb_rc;
static const RECT exp_rc = {11, 21, 49, 49};
static const RECT exp_rc2 = {11, 21, 49, 24};
hr = IShellBrowser_GetWindow(psb, &eb_hwnd);
ok(hr == S_OK, "Got 0x%08x\n", hr);
@ -1085,6 +1086,24 @@ static void test_basics(void)
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);
/* 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);
}