http://bugs.winehq.org/show_bug.cgi?id=28610
Bug #: 28610 Summary: Drawing of Text using Message LOGFONT obtained via SystemParametersInfo can cause a crash in drawing of text (difference in behaviour) Product: Wine Version: 1.3.29 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: gdi32 AssignedTo: wine-bugs@winehq.org ReportedBy: damian.dixon@gmail.com Classification: Unclassified
I have narrowed an issue down to a difference in behaviour between Windows and Wine.
The problem boils down to the following code:
NONCLIENTMETRICS ncm; memset(&ncm, 0, sizeof(NONCLIENTMETRICS)); ncm.cbSize = sizeof(NONCLIENTMETRICS);
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
I used the font's returned from this call for drawing text and this caused the crash.
The problem is that I upgraded to VS2010 and changed the target to WINVER=0x600.
This means that I needed to change my code to the following.
NONCLIENTMETRICS ncm; memset(&ncm, 0, sizeof(NONCLIENTMETRICS)); ncm.cbSize = sizeof(NONCLIENTMETRICS);
#if(WINVER >= 0x0600) OSVERSIONINFO osvi; memset(&osvi,0,sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionEx(&osvi); if (osvi.dwMajorVersion < 6) ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); #endif VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
Note: On windows my application does not actually crash or stop working with my original code and the text is displayed at a size I would kind of expect it to be.
http://bugs.winehq.org/show_bug.cgi?id=28610
--- Comment #1 from Damian Dixon damian.dixon@gmail.com 2011-10-07 15:57:26 CDT --- Observation: On Windows XP x64, the font drawing is twice as big as on Windows 7.
http://bugs.winehq.org/show_bug.cgi?id=28610
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|gdi32 |user32
http://bugs.winehq.org/show_bug.cgi?id=28610
--- Comment #2 from Dmitry Timoshkov dmitry@baikal.ru 2011-10-08 01:43:21 CDT --- (In reply to comment #0)
I have narrowed an issue down to a difference in behaviour between Windows and Wine.
The problem boils down to the following code:
NONCLIENTMETRICS ncm; memset(&ncm, 0, sizeof(NONCLIENTMETRICS)); ncm.cbSize = sizeof(NONCLIENTMETRICS);
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0));
I used the font's returned from this call for drawing text and this caused the crash.
Most likely the SystemParametersInfo() call above fails, but your code ignores it.
http://bugs.winehq.org/show_bug.cgi?id=28610
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Drawing of Text using |SystemParametersInfo(SPI_GE |Message LOGFONT obtained |TNONCLIENTMETRICS) should |via SystemParametersInfo |tolerate larger ncm.cbSize |can cause a crash in |values |drawing of text (difference | |in behaviour) |
http://bugs.winehq.org/show_bug.cgi?id=28610
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #3 from Dmitry Timoshkov dmitry@baikal.ru 2011-10-08 03:16:37 CDT --- http://www.winehq.org/pipermail/wine-patches/2011-October/107593.html should improve things.
http://bugs.winehq.org/show_bug.cgi?id=28610
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #4 from Dmitry Timoshkov dmitry@baikal.ru 2011-10-08 23:38:51 CDT --- http://source.winehq.org/git/wine.git/?a=commit;h=70caadbf34807e96ed8543abd7... should fix the problem.
http://bugs.winehq.org/show_bug.cgi?id=28610
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |70caadbf34807e96ed8543abd7e | |fddc302b7798c
http://bugs.winehq.org/show_bug.cgi?id=28610
--- Comment #5 from Damian Dixon damian.dixon@gmail.com 2011-10-09 05:35:40 CDT --- Patch fixes this for me. It displays better than Windows XP. Thanks.
http://bugs.winehq.org/show_bug.cgi?id=28610
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #6 from Alexandre Julliard julliard@winehq.org 2011-10-10 13:12:12 CDT --- Closing bugs fixed in 1.3.30.