user32: Fix error handling in {Begin,End,}DeferWindowPos() to match Windows behavior (resend)

Rodrigo Rivas rodrigorivascosta at
Tue Aug 25 08:08:43 CDT 2015

I sent this on July 15th, but it went through the cracks. Maybe the
mail text was not detailed enough, so I will try and explain it better
this time.

The error behaviour of functions BeginDeferWindowPos(),
DeferWindowPos() and EndDeferWindowPos() in Wine is different than in

In Windows, when DeferWindowPos() is used with an invalid HWND, this
function fails, but the eventual EndDeferWindowPos() will succeed and
move all the other windows in the set.
In Wine, however, DeferWindowPos() does not check the HWND, so it
never fails. But then, it fails in EndDeferWindowPos(), moving only
the windows passed before the invalid HWND and leaving the windows
after the invalid HWND unmoved.

The Windows behaviour is consistent in every version I tested (XP and 7).

The attached patch makes the Wine error behaviour the same as the Windows one.
It also considers the case where the HWND is valid when calling
DeferWindowPos() but is destroyed before calling EndDeferWindowPos():
The error is simply ignored.

It fixes bug #23187.

 dlls/user32/tests/ |   1 +
 dlls/user32/tests/defer.c     | 168 ++++++++++++++++++++++++++++++++++++++++++
 dlls/user32/winpos.c          |  14 ++--
 3 files changed, 178 insertions(+), 5 deletions(-)
 create mode 100644 dlls/user32/tests/defer.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-user32-Fix-error-handling-in-Begin-End-DeferWindowPos-.txt
Type: text/x-patch
Size: 7563 bytes
Desc: not available
URL: <>

More information about the wine-patches mailing list