Ensure that GetSystemMenu returns valid HMENU unless bRevert specified

Brent Roman brent at mbari.org
Wed Jul 1 01:01:05 CDT 2009

Originally submitted on 6/14/09.
Resubmitted after comments on this bug:


The attached patch against the master branch (as of today) fixes 
what appears to be a long standing bug in Wine's
GetSystemMenu function in User32.dll.so.

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 an 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.

To reproduce the bug:

1.  Download and install the Quadravox AQ430 development tools from:

2.  Attempt to compile any 'C' source file.

Before applying the patch, all such attempts will quickly fail 
with an invalid read from address 0x4.

After applying the patch, compilations complete without 
(internal) errors.  It is allow possible to download binaries to
the microcontroller via the TI Flash Emulator Tool under linux
as this hardware appears to the linux kernel 2.6.30 as a serial
port.  (Yea!)

I've been using the app heavily for a couple days now without 
problems.  In fact, it runs faster and uses much less memory 
under Wine than Win4Lin or VMplayer!  Very nice.

I do not subscribe to this list, so please email me directly if 
you have any questions or concerns.

- brent

  mailto:brent at mbari.org  http://www.mbari.org/~brent

More information about the wine-patches mailing list