[2/2] oleacc: implemented GetRoleText[A/W] with some tests

Alexandre Julliard julliard at winehq.org
Thu Sep 25 04:28:40 CDT 2008


Nikolay Sivov <bunglehead at 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 at winehq.org



More information about the wine-devel mailing list