Ensure that GetSystemMenu returns valid HMENU unless bRevert specified

Brent Roman brent at mbari.org
Mon Jun 15 00:32:56 CDT 2009

The attached patch against v1.0.1 fixes what appears to be
a long standing bug in Wine's
GetSystemMenu function in User32.dll.so.  The bug is also present in
the current HEAD.  This patch merely replaces GetSystemMenu() and
can/should be applied at HEAD.

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.

This was causing some apps to crash with invalid read from address 0x4.

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