[PATCH 3/3] comctl32/toolbar: fix TB_GETBUTTONTEXTA

Giuseppe Bilotta giuseppe.bilotta at gmail.com
Thu Apr 23 11:02:28 CDT 2009


When a null lParam is passed to TB_GETBUTTONTEXTA, we should not return
-1 but the string size. This is achieved by not bailing out early and
by setting the dstlen parameter to WideCharToMultiByte appropriately if
lParam is zero.
---
 dlls/comctl32/toolbar.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 3023a1d..ae76c1b 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -3436,9 +3436,6 @@ TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
     INT nIndex;
     LPWSTR lpText;
 
-    if (lParam == 0)
-	return -1;
-
     nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE);
     if (nIndex == -1)
 	return -1;
@@ -3446,7 +3443,7 @@ TOOLBAR_GetButtonTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
     lpText = TOOLBAR_GetText(infoPtr,&infoPtr->buttons[nIndex]);
 
     return WideCharToMultiByte( CP_ACP, 0, lpText, -1,
-                                (LPSTR)lParam, 0x7fffffff, NULL, NULL ) - 1;
+                                (LPSTR)lParam, lParam ? 0x7fffffff : 0, NULL, NULL ) - 1;
 }
 
 
-- 
1.6.2.254.g84bde




More information about the wine-patches mailing list