Commit 89529f8a authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

wininet: Use CertNameToStr for INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT

and update comment.
parent e9c44cc0
...@@ -2259,15 +2259,56 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d ...@@ -2259,15 +2259,56 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d
if (context) if (context)
{ {
LPINTERNET_CERTIFICATE_INFOW info = (LPINTERNET_CERTIFICATE_INFOW)lpBuffer; LPINTERNET_CERTIFICATE_INFOW info = (LPINTERNET_CERTIFICATE_INFOW)lpBuffer;
DWORD strLen;
memset(info,0,sizeof(INTERNET_CERTIFICATE_INFOW)); memset(info,0,sizeof(INTERNET_CERTIFICATE_INFOW));
info->ftExpiry = context->pCertInfo->NotAfter; info->ftExpiry = context->pCertInfo->NotAfter;
info->ftStart = context->pCertInfo->NotBefore; info->ftStart = context->pCertInfo->NotBefore;
if (bIsUnicode)
{
strLen = CertNameToStrW(context->dwCertEncodingType,
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
NULL, 0);
info->lpszSubjectInfo = LocalAlloc(0,
strLen * sizeof(WCHAR));
if (info->lpszSubjectInfo)
CertNameToStrW(context->dwCertEncodingType,
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
info->lpszSubjectInfo, strLen);
strLen = CertNameToStrW(context->dwCertEncodingType,
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
NULL, 0);
info->lpszIssuerInfo = LocalAlloc(0,
strLen * sizeof(WCHAR));
if (info->lpszIssuerInfo)
CertNameToStrW(context->dwCertEncodingType,
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
info->lpszIssuerInfo, strLen);
}
else
{
LPINTERNET_CERTIFICATE_INFOA infoA =
(LPINTERNET_CERTIFICATE_INFOA)info;
strLen = CertNameToStrA(context->dwCertEncodingType,
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
NULL, 0);
infoA->lpszSubjectInfo = LocalAlloc(0, strLen);
if (infoA->lpszSubjectInfo)
CertNameToStrA(context->dwCertEncodingType,
&context->pCertInfo->Subject, CERT_SIMPLE_NAME_STR,
infoA->lpszSubjectInfo, strLen);
strLen = CertNameToStrA(context->dwCertEncodingType,
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
NULL, 0);
infoA->lpszIssuerInfo = LocalAlloc(0, strLen);
if (infoA->lpszIssuerInfo)
CertNameToStrA(context->dwCertEncodingType,
&context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR,
infoA->lpszIssuerInfo, strLen);
}
/* /*
* CertNameToStr implement requred for * Contrary to MSDN, these do not appear to be set.
* lpszSubjectInfo
* lpszIssuerInfo
*
* also need to set:
* lpszProtocolName * lpszProtocolName
* lpszSignatureAlgName * lpszSignatureAlgName
* lpszEncryptionAlgName * lpszEncryptionAlgName
......
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