From f6dad197304b2771d56470a6e3d39063c487a557 Mon Sep 17 00:00:00 2001 From: David Hedberg Date: Sun, 19 Dec 2010 22:07:12 +0100 Subject: [PATCH] shell32: Fix ExplorerBrowser::SetRect to work properly when passed a NULL-valued hdwp. --- dlls/shell32/ebrowser.c | 4 +++- dlls/shell32/tests/ebrowser.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c index 87ff5785ecb..e6d11653be3 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 faaf6c77d03..99368d03ccc 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); } -- 2.11.4.GIT