Dmitry Timoshkov : user32: Menu item with a "magic" bitmap should not have MFT_BITMAP type set.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 18 10:33:30 CST 2015


Module: wine
Branch: master
Commit: c0de7f8641f61e8e48ce8a2fa4c6e7921eb1f313
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c0de7f8641f61e8e48ce8a2fa4c6e7921eb1f313

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Nov 18 08:46:09 2015 +0800

user32: Menu item with a "magic" bitmap should not have MFT_BITMAP type set.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/menu.c       |  5 +++--
 dlls/user32/tests/menu.c | 12 ------------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c
index c07a8cb..bf4be62 100644
--- a/dlls/user32/menu.c
+++ b/dlls/user32/menu.c
@@ -4566,7 +4566,7 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
         SetLastError( ERROR_MENU_ITEM_NOT_FOUND);
         return FALSE;
     }
-    
+
     if( lpmii->fMask & MIIM_TYPE) {
         if( lpmii->fMask & ( MIIM_STRING | MIIM_FTYPE | MIIM_BITMAP)) {
             WARN("invalid combination of fMask bits used\n");
@@ -4575,7 +4575,8 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
             return FALSE;
         }
 	lpmii->fType = menu->fType & MENUITEMINFO_TYPE_MASK;
-        if( menu->hbmpItem) lpmii->fType |= MFT_BITMAP;
+        if (menu->hbmpItem && !IS_MAGIC_BITMAP(menu->hbmpItem))
+            lpmii->fType |= MFT_BITMAP;
 	lpmii->hbmpItem = menu->hbmpItem; /* not on Win9x/ME */
         if( lpmii->fType & MFT_BITMAP) {
 	    lpmii->dwTypeData = (LPWSTR) menu->hbmpItem;
diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c
index 9855d38..7599431 100644
--- a/dlls/user32/tests/menu.c
+++ b/dlls/user32/tests/menu.c
@@ -856,13 +856,11 @@ static void test_menu_bmp_and_string(void)
     mii.dwItemData = 0x81818181;
     got = GetMenuItemInfoA(hsysmenu, SC_RESTORE, FALSE, &mii);
     ok(got, "GetMenuItemInfo failed\n");
-todo_wine
     ok(mii.fType == MF_STRING, "expected MF_STRING, got %#x\n", mii.fType);
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == SC_RESTORE, "expected SC_RESTORE, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
     ok(mii.dwItemData == 0, "expected 0, got %#lx\n", mii.dwItemData);
-todo_wine
     ok(mii.dwTypeData == (LPSTR)bmfill, "expected %p, got %p\n", bmfill, mii.dwTypeData);
     ok(mii.cch != 0, "cch should not be 0\n");
     ok(mii.hbmpItem == HBMMENU_POPUP_RESTORE, "expected HBMMENU_POPUP_RESTORE, got %p\n", mii.hbmpItem);
@@ -872,13 +870,11 @@ todo_wine
     mii.hbmpItem = (HBITMAP)0x81818181;
     got = GetMenuItemInfoA(hsysmenu, SC_CLOSE, FALSE, &mii);
     ok(got, "GetMenuItemInfo failed\n");
-todo_wine
     ok(mii.fType == MF_STRING, "expected MF_STRING, got %#x\n", mii.fType);
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == SC_RESTORE, "expected SC_RESTORE, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
     ok(mii.dwItemData == 0, "expected 0, got %#lx\n", mii.dwItemData);
-todo_wine
     ok(mii.dwTypeData == (LPSTR)bmfill, "expected %p, got %p\n", bmfill, mii.dwTypeData);
     ok(mii.cch != 0, "cch should not be 0\n");
     ok(mii.hbmpItem == HBMMENU_POPUP_CLOSE, "expected HBMMENU_POPUP_CLOSE, got %p\n", mii.hbmpItem);
@@ -3917,13 +3913,11 @@ if (0) /* FIXME: uncomment once Wine is fixed */
     mii.dwItemData = 0x81818181;
     ret = GetMenuItemInfoA(hmenu, 0, TRUE, &mii);
     ok(ret, "GetMenuItemInfo failed\n");
-todo_wine
     ok(mii.fType == MF_STRING, "expected MF_STRING, got %#x\n", mii.fType);
     ok(mii.fState == 0x81818181, "expected 0x81818181, got %#x\n", mii.fState);
     ok(mii.wID == 0x81818181, "expected 0x81818181, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
     ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
-todo_wine
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -3938,16 +3932,13 @@ todo_wine
     mii.dwItemData = 0x81818181;
     ret = GetMenuItemInfoA(hmenu, 0, TRUE, &mii);
     ok(ret, "GetMenuItemInfo failed\n");
-todo_wine
     ok(mii.fType == MF_STRING, "expected MF_STRING, got %#x\n", mii.fType);
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
     ok(mii.dwItemData == 0, "expected 0, got %#lx\n", mii.dwItemData);
-todo_wine
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
-todo_wine
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
     ok(mii.hbmpItem == HBMMENU_POPUP_RESTORE, "expected HBMMENU_POPUP_RESTORE, got %p\n", mii.hbmpItem);
 
@@ -4071,16 +4062,13 @@ todo_wine
     mii.dwItemData = 0x81818181;
     ret = GetMenuItemInfoA(hmenu, 0, TRUE, &mii);
     ok(ret, "GetMenuItemInfo failed\n");
-todo_wine
     ok(mii.fType == MF_STRING, "expected MF_STRING, got %#x\n", mii.fType);
     ok(mii.fState == 0x81818181, "expected 0x81818181, got %#x\n", mii.fState);
     ok(mii.wID == 0x81818181, "expected 0x81818181, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
     ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
-todo_wine
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
-todo_wine
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
     ok(mii.hbmpItem == HBMMENU_POPUP_RESTORE, "expected HBMMENU_POPUP_RESTORE, got %p\n", mii.hbmpItem);
 




More information about the wine-cvs mailing list