crypt32: Implement CertRDNValueToStr for UTF-8 strings.

This commit is contained in:
Juan Lang 2007-08-07 09:18:44 -07:00 committed by Alexandre Julliard
parent 59b2365c7d
commit 05d2ab176a
1 changed files with 29 additions and 0 deletions

View File

@ -59,6 +59,17 @@ DWORD WINAPI CertRDNValueToStrA(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue,
}
}
break;
case CERT_RDN_UTF8_STRING:
if (!psz || !csz)
ret = WideCharToMultiByte(CP_UTF8, 0, (LPWSTR)pValue->pbData,
pValue->cbData / sizeof(WCHAR) + 1, NULL, 0, NULL, NULL);
else
{
ret = WideCharToMultiByte(CP_UTF8, 0, (LPWSTR)pValue->pbData,
pValue->cbData / sizeof(WCHAR) + 1, psz, csz - 1, NULL, NULL);
csz -= ret;
}
break;
default:
FIXME("string type %d unimplemented\n", dwValueType);
}
@ -110,6 +121,24 @@ DWORD WINAPI CertRDNValueToStrW(DWORD dwValueType, PCERT_RDN_VALUE_BLOB pValue,
}
}
break;
case CERT_RDN_UTF8_STRING:
if (!psz || !csz)
ret = pValue->cbData / sizeof(WCHAR);
else
{
DWORD chars = min(pValue->cbData / sizeof(WCHAR), csz - 1);
if (chars)
{
DWORD i;
for (i = 0; i < chars; i++)
psz[i] = *((LPWSTR)pValue->pbData + i);
ret += chars;
csz -= chars;
}
}
break;
default:
FIXME("string type %d unimplemented\n", dwValueType);
}