https://bugs.winehq.org/show_bug.cgi?id=39730
Bug ID: 39730 Summary: FillRect() confuses 16bit brush handles with color constants Product: Wine Version: 1.8-rc2 Hardware: x86 OS: Linux Status: NEW Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: bunglehead@gmail.com Distribution: ---
Background window filling breaks because FillRect() gives special treatment for predefined color constants, that could be used instead of brush handles.
If background brush is set with GetStockObject(WHITE_BRUSH) (or any brush created early enough really), it's possible that this window background will be filled using wrong color. What happens is that handle truncation leads to small enough 16bit handle values that trigger special color path in FillRect().
https://bugs.winehq.org/show_bug.cgi?id=39730
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |win16
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #1 from Dmitry Timoshkov dmitry@baikal.ru --- One of the ways to fix this could be to make 16-bit FillRect() to create a 32-bit brush and call 32-bit FillRect() with it.
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #2 from Nikolay Sivov bunglehead@gmail.com --- 16-bit FillRect() is not involved at all.
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #3 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Nikolay Sivov from comment #2)
16-bit FillRect() is not involved at all.
Hmm, I assumed by the "win16" keyword. Was it added by a mistake?
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- No, it wasn't. It happens for win16 applications, but window background is still filled by 32-bit FillRect(), within user32.
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #5 from Dmitry Timoshkov dmitry@baikal.ru --- It would be helpful to provide more details then: what application is that, how user32 receives a 16-bit brush handle, and any other information you have that might be useful.
https://bugs.winehq.org/show_bug.cgi?id=39730
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download URL| |ftp://ftp.openwatcom.org/pu | |b/open-watcom-c-win32-1.9.e | |xe
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Dmitry Timoshkov from comment #5)
It would be helpful to provide more details then: what application is that,
Any application that uses stock brush for a background when registering window class. For example alarm.exe from samples provided with OpenWatcom C 1.9.
how user32 receives a 16-bit brush handle,
I'm not sure what you mean, take a look at what RegisterClassEx16() does.
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #7 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Nikolay Sivov from comment #6)
I'm not sure what you mean, take a look at what RegisterClassEx16() does.
Thanks. Probably it would be a good idea to mention this in the first comment, otherwise it's not clear at all what is going on.
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #8 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Dmitry Timoshkov from comment #1)
One of the ways to fix this could be to make 16-bit FillRect() to create a 32-bit brush and call 32-bit FillRect() with it.
This comment still applies to RegisterClass16().
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #9 from Nikolay Sivov bunglehead@gmail.com --- Maybe it will occasionally work, but it's not a solution, because GetClassInfo() returns original brush handle. And manually created 32bit brush handle truncated to 16bit, and then passed again through FillRect16 -> FillRect will break in same way, when LOWORD is low enough.
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #10 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Nikolay Sivov from comment #9)
Maybe it will occasionally work, but it's not a solution, because GetClassInfo() returns original brush handle.
Does the application depend on this?
And manually created 32bit brush handle truncated to 16bit, and then passed again through FillRect16 -> FillRect will break in same way, when LOWORD is low enough.
You said that FillRect16 is not involved at all? If it actually is, then a possible solution was already suggested.
https://bugs.winehq.org/show_bug.cgi?id=39730
--- Comment #11 from Nikolay Sivov bunglehead@gmail.com --- (In reply to Dmitry Timoshkov from comment #10)
(In reply to Nikolay Sivov from comment #9)
Maybe it will occasionally work, but it's not a solution, because GetClassInfo() returns original brush handle.
Does the application depend on this?
This one probably not, but it's obviously a wrong way for the reasons I named.
And manually created 32bit brush handle truncated to 16bit, and then passed again through FillRect16 -> FillRect will break in same way, when LOWORD is low enough.
You said that FillRect16 is not involved at all? If it actually is, then a possible solution was already suggested.
Like I said it's irrelevant to this particular application as FillRect16 is not used. This sample comes with sources if you're interested.
https://bugs.winehq.org/show_bug.cgi?id=39730
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Fixed by SHA1| |4161f5120b59d916e1818748f0d | |0ced7c7a76303 Status|NEW |RESOLVED
--- Comment #12 from Nikolay Sivov bunglehead@gmail.com --- Fixed with http://source.winehq.org/git/wine.git/?a=commit;h=4161f5120b59d916e1818748f0....
https://bugs.winehq.org/show_bug.cgi?id=39730
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |gdi32
https://bugs.winehq.org/show_bug.cgi?id=39730
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #13 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 1.9.8.
https://bugs.winehq.org/show_bug.cgi?id=39730
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |1.8.x CC| |mstefani@redhat.com
https://bugs.winehq.org/show_bug.cgi?id=39730
Michael Stefaniuc mstefani@redhat.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|1.8.x |---
--- Comment #14 from Michael Stefaniuc mstefani@redhat.com --- Removing 1.8.x milestone from bugs included in 1.8.3.