Commit 7f5c9769 authored by Lei Zhang's avatar Lei Zhang Committed by Alexandre Julliard

comctl32: Fix TB_GETSTRING return values.

parent 375f60b0
......@@ -1109,14 +1109,14 @@ static void test_getstring(void)
r = SendMessage(hToolbar, TB_ADDSTRING, 0, (LPARAM)answer);
expect(0, r);
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(0, 0), (LPARAM)NULL);
todo_wine expect(strlen(answer), r);
expect(strlen(answer), r);
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(0, 0), (LPARAM)NULL);
todo_wine expect(strlen(answer), r);
expect(strlen(answer), r);
r = SendMessage(hToolbar, TB_GETSTRING, MAKEWPARAM(sizeof(str), 0), (LPARAM)str);
todo_wine expect(strlen(answer), r);
expect(strlen(answer), r);
expect(0, lstrcmp(answer, str));
r = SendMessage(hToolbar, TB_GETSTRINGW, MAKEWPARAM(sizeof(strW), 0), (LPARAM)strW);
todo_wine expect(strlen(answer), r);
expect(strlen(answer), r);
expect(0, lstrcmpW(answerW, strW));
DestroyWindow(hToolbar);
......
......@@ -5186,6 +5186,7 @@ TOOLBAR_GetStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (iString < infoPtr->nNumStrings)
{
ret = WideCharToMultiByte(CP_ACP, 0, infoPtr->strings[iString], -1, str, buffersize, NULL, NULL);
ret--;
TRACE("returning %s\n", debugstr_a(str));
}
......@@ -5216,11 +5217,12 @@ TOOLBAR_GetStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
memcpy(str, infoPtr->strings[iString], ret);
str[len] = '\0';
}
ret = len;
TRACE("returning %s\n", debugstr_w(str));
}
else
ERR("String index %d out of range (largest is %d)\n", iString, infoPtr->nNumStrings - 1);
WARN("String index %d out of range (largest is %d)\n", iString, infoPtr->nNumStrings - 1);
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