PATCH: SetMenuItemInfo
Marcus Meissner
Marcus.Meissner at caldera.de
Sat Jul 7 13:19:21 CDT 2001
Hi,
While debugging QuickTimePlayer 5 at LinuxTag we came across invalid
SetMenuItemInfo calls. By implementing some of the consistency checks
Windows does, it now skips those and does not corrupt the menu item.
Ciao, Marcus
Changelog:
add some argument validation to SetMenuItemInfoA, so QT5
does not corrupt its menus.
Index: menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.121
diff -u -r1.121 menu.c
--- menu.c 2001/07/02 19:59:40 1.121
+++ menu.c 2001/07/07 18:00:51
@@ -4479,6 +4479,16 @@
BOOL WINAPI SetMenuItemInfoA(HMENU hmenu, UINT item, BOOL bypos,
const MENUITEMINFOA *lpmii)
{
+ if ((lpmii->fType & (MF_HILITE|MF_POPUP)) || (lpmii->fState)) {
+ /* QuickTime does pass invalid data into SetMenuItemInfo.
+ * do some of the checks Windows does.
+ */
+ ERR("Bad masks for type (0x%08x) or state (0x%08x)\n",
+ lpmii->fType,lpmii->fState
+ );
+ return FALSE;
+ }
+
return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0),
(const MENUITEMINFOW *)lpmii, FALSE);
}
More information about the wine-patches
mailing list