http://bugs.winehq.org/show_bug.cgi?id=19870
Summary: crash on EnumDisplayMonitors() callback return Product: Wine Version: 1.1.28 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown AssignedTo: wine-bugs@winehq.org ReportedBy: vladimir.strakh@gmail.com
Created an attachment (id=23301) --> (http://bugs.winehq.org/attachment.cgi?id=23301) App to crash after EnumDisplayMonitors callback. Winedebug logs for `-g -O0` and `-O2`
Wine crashes on returning from EnumDisplayMonitors()'s callback. Callback called ok, params passed ok, but after callback returns, wine crashes.
Logs attached for wine compiled with `-O2` flags, and with `-g -O0` Simple application that reproduce crash attached.
http://bugs.winehq.org/show_bug.cgi?id=19870
--- Comment #1 from Vladimir vladimir.strakh@gmail.com 2009-08-28 08:34:52 --- Running Gentoo with kernel 2.6.30-gentoo-r5 wine-1.1.28 gcc version 4.4.1 (Gentoo 4.4.1 p1.0)
http://bugs.winehq.org/show_bug.cgi?id=19870
Juan Lang juan_lang@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID
--- Comment #2 from Juan Lang juan_lang@yahoo.com 2009-08-28 08:41:47 --- Your callback has the wrong calling convention, so of course it crashes:
BOOL EnumMonitor(HMONITOR hMon, HDC hdcMonitor, LPRECT rect, LPARAM parm)
That needs to be: BOOL WINAPI EnumMonitor(HMONITOR hMon, HDC hdcMonitor, LPRECT rect, LPARAM parm)
See the definition of MONITORENUMPROC in winuser.h.
http://bugs.winehq.org/show_bug.cgi?id=19870
--- Comment #3 from Vladimir vladimir.strakh@gmail.com 2009-08-28 08:47:16 --- Right... My fault. I was reading MSDN, no WINAPI mentioned there. Didn't thought about calling conventions. No crashes after fixing my app.
http://bugs.winehq.org/show_bug.cgi?id=19870
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #4 from Vitaliy Margolen vitaliy@kievinfo.com 2009-08-28 09:11:36 --- Closing invalid
http://bugs.winehq.org/show_bug.cgi?id=19870
--- Comment #5 from Dmitry Timoshkov dmitry@codeweavers.com 2009-08-28 09:37:53 --- Just pay slightly more attention to the compiler warnings.
http://bugs.winehq.org/show_bug.cgi?id=19870
--- Comment #6 from Vladimir vladimir.strakh@gmail.com 2009-08-28 09:57:09 --- It was: error: invalid conversion from 'BOOL (*)(HMONITOR__*, HDC__*, tagRECT*, LPARAM)' to 'BOOL (*)(HMONITOR__*, HDC__*, tagRECT*, LPARAM)'
Not obvious that issue was in calling conventions. And type casting was hiding it.
I thought it's wine bug because same cross-compiled app was ok on win, and crashed on wine. No different compilers, no different includes.
http://bugs.winehq.org/show_bug.cgi?id=19870
--- Comment #7 from Dmitry Timoshkov dmitry@codeweavers.com 2009-08-29 00:56:51 --- (In reply to comment #6)
It was: error: invalid conversion from 'BOOL (*)(HMONITOR__*, HDC__*, tagRECT*, LPARAM)' to 'BOOL (*)(HMONITOR__*, HDC__*, tagRECT*, LPARAM)' Not obvious that issue was in calling conventions.
Report that to gcc/mingw developers.
And type casting was hiding it.
If you need to use type casts that's a good sign that something is wrong. Besides the calling convention '&' is redundant as well.
I thought it's wine bug because same cross-compiled app was ok on win, and crashed on wine. No different compilers, no different includes.
Perhaps a slightly different stack layout.