Bug in menu.c

Dan Timis timis at museresearch.com
Thu Jul 29 15:26:19 CDT 2004


Hi,

The MS documentation on the structure MENUITEMINFO says that the field 
fMask indicates what fields to retrieve or set.  Here is what it says 
about the value MIIM_TYPE:

> Retrieves or sets the fType and dwTypeData members. Windows 98/Me,
> Windows 2000/XP: MIIM_TYPE is replaced by MIIM_BITMAP, MIIM_FTYPE,
> and MIIM_STRING.

So if one wants to specify a text menu item in XP, one would use 
MIIM_STRING, not MIIM_TYPE.  fType would also need to be MFT_STRING.

In menu.c in GetMenuItemInfo_common():

     /* copy the text string */
     if ((lpmii->fMask & (MIIM_TYPE|MIIM_STRING)) &&
          (MENU_ITEM_TYPE(menu->fType) == MF_STRING) && menu->text)
     {
and so on...

This works fine.  It retrieves the text if either MIIM_TYPE or 
MIIM_STRING are set.  But, in GetMenuItemInfo_common():

     if (lpmii->fMask & MIIM_TYPE) {
         /* Get rid of old string. */
         if (IS_STRING_ITEM(menu->fType) && menu->text) {
             HeapFree(GetProcessHeap(), 0, menu->text);
             menu->text = NULL;
         }

         /* make only MENU_ITEM_TYPE bits in menu->fType equal 
lpmii->fType */
         menu->fType &= ~MENU_ITEM_TYPE(menu->fType);
         menu->fType |= MENU_ITEM_TYPE(lpmii->fType);

         menu->text = lpmii->dwTypeData;
and so on...

This sets the text only if MIIM_TYPE is set.  I changed the first line 
to:

     if (lpmii->fMask & (MIIM_TYPE|MIIM_STRING)) {

and menus that were drawing before as a long thin vertical line, 
started to show correctly.  I'm not sure if this is the right way to 
fix this, but it works for me.

I am using a wine version from 2004-04-08.

BTW, I reported earlier a crash in menu.c.  I did not hear anything 
back.  Should I log this into Bugzilla?

Thanks,

Dan Timis
Muse Research, Inc.




More information about the wine-devel mailing list