Add check to SetMenuItemInfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch stops IE from crashing but doesn't regress QuickTime either.
It is against the last Wine snapshot (hopefully will get CVS back at
work soon)

License: LGPL/X11
ChangeLog:
	controls/menu.c
	Fail SetMenuItemInfo if both MFT_BITMAP and MFT_SEPARATOR are
	specified (an api violation).

-- 
Mike Hearn <m.hearn@signal.qinetiq.com>
QinetiQ - Malvern Technology Center
diff -urN wine-20021219/controls/menu.c wine-local/controls/menu.c
--- wine-20021219/controls/menu.c	2002-12-17 04:16:31.000000000 +0000
+++ wine-local/controls/menu.c	2003-01-14 11:02:23.000000000 +0000
@@ -4253,14 +4253,19 @@
                                  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.
-	 */
-        WARN("Bad masks for type (0x%08x) or state (0x%08x)\n",
-             lpmii->fType,lpmii->fState );
-	return FALSE;
+       /* QuickTime does pass invalid data into SetMenuItemInfo.
+        * do some of the checks Windows does.
+        */
+        WARN("Bad masks (0x%08x) for type (0x%08x) or state (0x%08x)\n",
+             lpmii->fMask, lpmii->fType,lpmii->fState );
     }
 
+    /* is the app setting both MFT_BITMAP and MFT_SEPARATOR (which is wrong)? */
+    if (lpmii->fType & (MFT_BITMAP | MFT_SEPARATOR)) {
+      WARN("fType contains MFT_BITMAP and MFT_SEPARATOR, API violation\n");
+      return FALSE;
+    }
+    
     return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0),
 				    (const MENUITEMINFOW *)lpmii, FALSE);
 }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux