Re: [2/2] oleacc: implemented GetRoleText[A/W] with some tests
Nikolay Sivov <bunglehead(a)gmail.com> writes:
+UINT WINAPI GetRoleTextA(DWORD role, LPSTR lpRole, UINT rolemax) +{ + UINT length; + WCHAR *roletext; + INT ret; + + TRACE("%u %p %u\n", role, lpRole, rolemax); + + length = GetRoleTextW(role, NULL, 0); + + if(!length || !lpRole) + return length;
You can't return the W length from the A function.
+ roletext = HeapAlloc(GetProcessHeap(), 0, (length + 1)*sizeof(WCHAR)); + if(!roletext) + return 0; + + GetRoleTextW(role, roletext, length + 1); + + ret = WideCharToMultiByte( CP_ACP, 0, roletext, -1, lpRole, rolemax, NULL, NULL );
This won't return the correct length. Also you need to test how overflow should be handled. -- Alexandre Julliard julliard(a)winehq.org
participants (1)
-
Alexandre Julliard