Resent^2 : Zero out return string in GetMenuStr
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Tue Mar 29 09:53:10 CST 2005
Anything wrong with this patch?
Changelog:
dlls/user/menu.c: GetMenuStrA|W
Initialize return string as an empty string
Xilinx ISE7.1 _pn.exe checked the return string length even for separators
and got astray.
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/user/menu.c
===================================================================
RCS file: /home/wine/wine/dlls/user/menu.c,v
retrieving revision 1.19
diff -u -w -r1.19 menu.c
--- wine/dlls/user/menu.c 9 Mar 2005 12:39:01 -0000 1.19
+++ wine/dlls/user/menu.c 11 Mar 2005 12:31:45 -0000
@@ -3279,10 +3279,11 @@
MENUITEM *item;
TRACE("menu=%p item=%04x ptr=%p len=%d flags=%04x\n", hMenu, wItemID, str, nMaxSiz, wFlags );
+ if (str)
+ str[0] = '\0';
if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return 0;
if (!IS_STRING_ITEM(item->fType)) return 0;
if (!str || !nMaxSiz) return strlenW(item->text);
- str[0] = '\0';
if (!WideCharToMultiByte( CP_ACP, 0, item->text, -1, str, nMaxSiz, NULL, NULL ))
str[nMaxSiz-1] = 0;
TRACE("returning '%s'\n", str );
@@ -3298,11 +3299,12 @@
{
MENUITEM *item;
+ if (str)
+ str[0] = '\0';
TRACE("menu=%p item=%04x ptr=%p len=%d flags=%04x\n", hMenu, wItemID, str, nMaxSiz, wFlags );
if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return 0;
if (!IS_STRING_ITEM(item->fType)) return 0;
if (!str || !nMaxSiz) return strlenW(item->text);
- str[0] = '\0';
lstrcpynW( str, item->text, nMaxSiz );
return strlenW(str);
}
More information about the wine-patches
mailing list