Nikolay Sivov bunglehead@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.