Brent Roman wrote:
Originally submitted on 6/14/09. Resubmitted after comments on this bug:
http://bugs.winehq.org/show_bug.cgi?id=19134
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:
- Download and install the Quadravox AQ430 development tools from: http://www.quadravox.com/AQ430.htm
http://appdb.winehq.org/objectManager.php?sClass=application&iId=9939
- Attempt to compile any 'C' source file.
Before applying the patch, all such attempts will quickly fail with an invalid read from address 0x4.
You rewrote the entire function, there is no need to do this.
Please use the same formatting as the rest of the code.
Add new variables to the bottom of the list, you imbedded one or more.
Since the rest of the function uses four spaces, use them. Avoid the use of tabs, some editors spread them to four spaces, some two and yet others eight. Makes the code look sloppy and is very hard to read.
Can you provide test cases, other than 'use this program to prove it works'? The idea is to replicate Windows API functionality and some programs rely on certain functionality working in a very specific manner. If you build to the program, you might break others.
Also, if you have left out some function, please insert c style notes stating this. Makes it easier to find where certain code pieces go at a later time.
James McKenzie