[Bug 19134] New: Wine GetSystemMenu returns nil window handle at inappropriate times

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Jun 30 01:35:56 CDT 2009


           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 at winehq.org
        ReportedBy: brent at 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:


The version I use is, 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...

Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the wine-bugs mailing list