Set the correct value for the cch element of MENUITEMINFO in
GetMenuItemInfo.
This commit is contained in:
parent
70e16ad0e1
commit
2d6eabacc3
|
@ -4294,14 +4294,19 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
|
|||
lpmii->fType = menu->fType;
|
||||
switch (MENU_ITEM_TYPE(menu->fType)) {
|
||||
case MF_STRING:
|
||||
if (menu->text && lpmii->dwTypeData && lpmii->cch) {
|
||||
if (unicode) {
|
||||
lstrcpynAtoW((LPWSTR) lpmii->dwTypeData, menu->text, lpmii->cch);
|
||||
lpmii->cch = lstrlenW((LPWSTR)menu->text);
|
||||
} else {
|
||||
if (menu->text) {
|
||||
int len = lstrlenA(menu->text);
|
||||
if(lpmii->dwTypeData && lpmii->cch) {
|
||||
if (unicode)
|
||||
lstrcpynAtoW((LPWSTR) lpmii->dwTypeData, menu->text,
|
||||
lpmii->cch);
|
||||
else
|
||||
lstrcpynA(lpmii->dwTypeData, menu->text, lpmii->cch);
|
||||
lpmii->cch = lstrlenA(menu->text);
|
||||
}
|
||||
/* if we've copied a substring we return its length */
|
||||
if(lpmii->cch <= len)
|
||||
lpmii->cch--;
|
||||
} else /* return length of string */
|
||||
lpmii->cch = len;
|
||||
}
|
||||
break;
|
||||
case MF_OWNERDRAW:
|
||||
|
@ -4314,13 +4319,14 @@ static BOOL GetMenuItemInfo_common ( HMENU hmenu, UINT item, BOOL bypos,
|
|||
}
|
||||
|
||||
if (lpmii->fMask & MIIM_STRING) {
|
||||
if (unicode) {
|
||||
lstrcpynAtoW((LPWSTR) lpmii->dwTypeData, menu->text, lpmii->cch);
|
||||
lpmii->cch = lstrlenW((LPWSTR)menu->text);
|
||||
} else {
|
||||
if(lpmii->dwTypeData && lpmii->cch) {
|
||||
if (unicode)
|
||||
lstrcpynAtoW((LPWSTR) lpmii->dwTypeData, menu->text,
|
||||
lpmii->cch);
|
||||
else
|
||||
lstrcpynA(lpmii->dwTypeData, menu->text, lpmii->cch);
|
||||
lpmii->cch = lstrlenA(menu->text);
|
||||
}
|
||||
lpmii->cch = lstrlenA(menu->text);
|
||||
}
|
||||
|
||||
if (lpmii->fMask & MIIM_FTYPE)
|
||||
|
|
Loading…
Reference in New Issue