[try 2] user32: GetMenuStringA now returns correct buffer length for multibyte menu text. (with test)

Huang, Zhangrong hzhrong at gmail.com
Wed Jul 2 10:54:20 CDT 2008


Hi,
Pls see GetMenuStringA in dlls/user32/menu.c:

INT WINAPI GetMenuStringA(
	HMENU hMenu,	/* [in] menuhandle */
	UINT wItemID,	/* [in] menu item (dep. on wFlags) */
	LPSTR str,	/* [out] outbuffer. If NULL, func returns entry length*/
	INT nMaxSiz,	/* [in] length of buffer. if 0, func returns entry len*/
	UINT wFlags	/* [in] MF_ flags */
) {
..............................
    if (!str || !nMaxSiz) return strlenW(item->text);
.....................................
}

If outbuffer is NULL or nMaxSiz is 0, GetMenuStringA should return
entry length of menu text.
If menu text is multibyte, for example, two multibyte chars need 4
bytes, but strlenW only returns 2 bytes. We need call
WideCharToMultiByte to get correct buffer length.


ChangeLog:
    user32: GetMenuStringA now returns correct buffer length for
multibyte menu text.


-- 
$ apt-get moo
 (__)
 (oo)
 /------\/
 / | ||
 * /\---/\
 ~~ ~~
...."Have you mooed today?"...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-user32-GetMenuStringA-now-returns-correct-buffer-le.patch
Type: application/mbox
Size: 4154 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080702/5067375d/attachment.bin 


More information about the wine-patches mailing list