Christopher Thielen cthielen at gmail.com
Sun Nov 15 21:40:41 CST 2015

I figured out this behavior. It seems if one calls SetCapture() twice it 
will cause Windows to send a WM_CAPTURECHANGED message to the same 
window given as the parameter of SetCapture(). Wine does not currently 
follow this behavior.

The following patch fixes the behavior, though I'm not sure if it's the 
right way to fix the issue as I don't know why the original author(s) 
made the removed check in the first place. Does anyone have any ideas?

(Generated against wine.git on 11/15/15 at 19:28 PST):

diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 40e35a9..63fae67 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -108,7 +108,7 @@ BOOL set_capture_window( HWND hwnd, UINT gui_flags, 
HWND *prev_ret )
          USER_Driver->pSetCapture( hwnd, gui_flags );

-        if (previous && previous != hwnd)
+        if (previous)
              SendMessageW( previous, WM_CAPTURECHANGED, 0, (LPARAM)hwnd );

          if (prev_ret) *prev_ret = previous;

On 11/07/2015 11:30 AM, Christopher Thielen wrote:
> Hi wine-devel,
> My investigation of https://bugs.winehq.org/show_bug.cgi?id=13683 has
> determined a missing WM_CAPTURECHANGED message is to blame.
> At some point in early execution, a WM_CAPTURECHANGED message is sent by
> Windows (but not Wine) which apparently sets off a course of calls that
> prevents this bug.
> I wrote some simple WM_CAPTURECHANGED tests but I have not found any
> meaningful differences in execution between Windows and Wine. Put
> another way, I've been unable to trigger u9.exe's specific behavior.
> Does anyone have recommendations for debugging Win32 messaging,
> specifically in the case of messages "missing" in Wine? Since I can see
> the missing message being sent by Windows with Spy++, presumably I can
> look back through API calls made before that point and try to replicate
> a test case, but that debugging method sounds fairly lengthy. Is there a
> good tool to capture and replicate all Win32 API calls perhaps?
> Any advice would be appreciated, thanks!
> - Christopher Thielen

More information about the wine-devel mailing list