shell32: Fix ExplorerBrowser::SetRect to work properly when passed a NULL-valued hdwp.
David Hedberg
david.hedberg at gmail.com
Sun Dec 19 15:07:12 CST 2010
---
dlls/shell32/ebrowser.c | 4 +++-
dlls/shell32/tests/ebrowser.c | 19 +++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c
index 87ff578..e6d1165 100644
--- a/dlls/shell32/ebrowser.c
+++ b/dlls/shell32/ebrowser.c
@@ -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
{
diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c
index faaf6c7..99368d0 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -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);
}
--
1.7.3.3
More information about the wine-patches
mailing list