Commit 0868ca15 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

user32: Reimplement GetMenuStringW on top of NtUserThunkedMenuItemInfo.

parent 992d69b9
...@@ -498,39 +498,20 @@ INT WINAPI GetMenuStringA( HMENU menu, UINT item, char *str, INT count, UINT fla ...@@ -498,39 +498,20 @@ INT WINAPI GetMenuStringA( HMENU menu, UINT item, char *str, INT count, UINT fla
/******************************************************************* /*******************************************************************
* GetMenuStringW (USER32.@) * GetMenuStringW (USER32.@)
*/ */
INT WINAPI GetMenuStringW( HMENU hMenu, UINT wItemID, INT WINAPI GetMenuStringW( HMENU menu, UINT item, WCHAR *str, INT count, UINT flags )
LPWSTR str, INT nMaxSiz, UINT wFlags )
{ {
POPUPMENU *menu; MENUITEMINFOW info;
MENUITEM *item; int ret;
UINT pos;
INT ret;
TRACE("menu=%p item=%04x ptr=%p len=%d flags=%04x\n", hMenu, wItemID, str, nMaxSiz, wFlags );
if (str && nMaxSiz) str[0] = '\0';
if (!(menu = find_menu_item(hMenu, wItemID, wFlags, &pos)))
{
SetLastError( ERROR_MENU_ITEM_NOT_FOUND);
return 0;
}
item = &menu->items[pos];
if (!str || !nMaxSiz) TRACE( "menu=%p item=%04x ptr=%p len=%d flags=%04x\n", menu, item, str, count, flags );
ret = item->text ? lstrlenW(item->text) : 0;
else if (!item->text)
{
str[0] = 0;
ret = 0;
}
else
{
lstrcpynW( str, item->text, nMaxSiz );
ret = lstrlenW(str);
}
release_menu_ptr(menu);
TRACE("returning %s\n", debugstr_w(str)); info.cbSize = sizeof(info);
info.fMask = MIIM_STRING;
info.dwTypeData = str;
info.cch = count;
ret = NtUserThunkedMenuItemInfo( menu, item, flags, NtUserGetMenuItemInfoW, &info, NULL );
if (ret) ret = info.cch;
TRACE( "returning %s %d\n", debugstr_w( str ), ret );
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment