diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index abb08251631..f52103d494d 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -2259,15 +2259,56 @@ static BOOL INET_QueryOptionHelper(BOOL bIsUnicode, HINTERNET hInternet, DWORD d if (context) { LPINTERNET_CERTIFICATE_INFOW info = (LPINTERNET_CERTIFICATE_INFOW)lpBuffer; + DWORD strLen; + memset(info,0,sizeof(INTERNET_CERTIFICATE_INFOW)); info->ftExpiry = context->pCertInfo->NotAfter; 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 - * lpszSubjectInfo - * lpszIssuerInfo - * - * also need to set: + * Contrary to MSDN, these do not appear to be set. * lpszProtocolName * lpszSignatureAlgName * lpszEncryptionAlgName