Juan Lang : wininet: Use CertNameToStr for INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 16 05:34:21 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 89529f8a8ebcdf63fb176e853a59158cbdf39da4
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=89529f8a8ebcdf63fb176e853a59158cbdf39da4

Author: Juan Lang <juan_lang at yahoo.com>
Date:   Thu Feb 16 12:19:00 2006 +0100

wininet: Use CertNameToStr for INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT
and update comment.

---

 dlls/wininet/internet.c |   51 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index abb0825..f52103d 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -2259,15 +2259,56 @@ static BOOL INET_QueryOptionHelper(BOOL 
                 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




More information about the wine-cvs mailing list