http://bugs.winehq.org/show_bug.cgi?id=19134
Summary: Wine GetSystemMenu returns nil window handle at inappropriate times Product: Wine Version: 1.0.1 Platform: All OS/Version: All Status: UNCONFIRMED Severity: normal Priority: P2 Component: user32 AssignedTo: wine-bugs@winehq.org ReportedBy: brent@mbari.org
Created an attachment (id=22098) --> (http://bugs.winehq.org/attachment.cgi?id=22098) Patch against Wine version 1.0.1 to fix this bug
GetSystemMenu() is always supposed to return a valid HMENU handle, but the logic in Wine's version would return nil in some cases where windows would return a valid HMENU. Specifically, when the relevant windows dwStyle mask did not include WS_SYSMENU, wine would return nil, but windows would still return a valid HMENU.
I've been trying to run this app in Wine for many years:
http://www.quadravox.com/AQ430.htm
The version I use is 2.0.6.9, but I strongly suspect the problem will show up in their current versions as well. You may download a 30-day trial version to verify the bug. However, I think the logic bug in GetSystemMenu is pretty obvious.
After a few hours of poking around with assembly code in the Wine debugger, it became clear that the Quadravox app was getting a nil HMENU from GetSystemMenu even though its bRevert parameter was false. Windows on-line docs state that GetSystemMenu() should return a nil HMENU only when reverting to the standard system menu. Real Windows apparently does not check whether the current window's dwStyle bits are set appropriately, where the wine version requires this. That's the easiest explanation for the behavior I observed...
To replicate: create a project in the Quadravox IDE try to build it.
Aborts with invalid read from address 0x4 after GetSystemMenu() returns the bogus nil handle.
The attached patch fixes the problem for me. Others should confirm this...
http://bugs.winehq.org/show_bug.cgi?id=19134
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Wine GetSystemMenu returns |Quadravox IDE crashes on |nil window handle at |GetSystemMenu() bug |inappropriate times |
--- Comment #1 from Nikolay Sivov bunglehead@gmail.com 2009-06-30 06:40:59 --- Hi, Brent.
Add test case for this please, it isn't so hard since you've got so far to fix this issue.
Also rebase your patch to current git and feel free to send it (with test) to wine-patches@winehq.org for review.
I've also changed summary to make application name visible for anyone interested.
http://bugs.winehq.org/show_bug.cgi?id=19134
Vitaliy Margolen vitaliy@kievinfo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch Platform|All |Other OS/Version|All |other
--- Comment #2 from Vitaliy Margolen vitaliy@kievinfo.com 2009-06-30 20:49:40 --- If you send it to wine-patches, makes sure to keep the same formating and stile as the original function.
http://bugs.winehq.org/show_bug.cgi?id=19134
--- Comment #3 from Brent Roman brent@mbari.org 2009-07-01 00:51:24 --- (In reply to comment #1)
I've rebased the patch against the current HEAD and resubmitted it even though I noted in my original submission on 6/14 that the patch against v1.0.1 was also applicable to the HEAD as GetSystemMenu() has remained unchanged.
The "test case", as noted before, is to simply try to compile any 'C' code in the IDE. It fails with an invalid read from 0x4 before this patch is applied.
http://bugs.winehq.org/show_bug.cgi?id=19134
joaopa jeremielapuree@yahoo.fr changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jeremielapuree@yahoo.fr
--- Comment #4 from joaopa jeremielapuree@yahoo.fr 2009-07-01 01:47:20 --- A test case is a small self contained code that shows that your patch behaves correctly. Saying "Application XXX behaved uncorrectly before my patch, now everything is OK" is not a test case.
Your test case should be commited in the folder dll/user32/test.
http://bugs.winehq.org/show_bug.cgi?id=19134
--- Comment #5 from Austin English austinenglish@gmail.com 2010-06-04 15:44:02 --- This is your friendly reminder that there has been no bug activity for 11 months. Is this still an issue in current (1.2-rc2 or newer) wine?
http://bugs.winehq.org/show_bug.cgi?id=19134
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |ABANDONED
--- Comment #6 from Austin English austinenglish@gmail.com 2012-03-19 14:56:29 CDT --- No response in 650 days => abandoned. If this still an issue in current (1.4 or newer) Wine, and you can provide the needed information, feel free to reopen.
http://bugs.winehq.org/show_bug.cgi?id=19134
Frédéric Delanoy frederic.delanoy@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Frédéric Delanoy frederic.delanoy@gmail.com 2012-03-20 05:01:12 CDT --- Closing ABANDONED bugs