Juan Lang : wintrust: Improve SoftpubLoadMessage for WTD_CHOICE_CERT.

Alexandre Julliard julliard at winehq.org
Mon Oct 1 07:54:57 CDT 2007


Module: wine
Branch: master
Commit: 5fa5518641755ca6e00f8ea1d5136b89b38a580b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5fa5518641755ca6e00f8ea1d5136b89b38a580b

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Sep 28 12:44:27 2007 -0700

wintrust: Improve SoftpubLoadMessage for WTD_CHOICE_CERT.

---

 dlls/wintrust/softpub.c |   36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/dlls/wintrust/softpub.c b/dlls/wintrust/softpub.c
index a9b5464..59e4966 100644
--- a/dlls/wintrust/softpub.c
+++ b/dlls/wintrust/softpub.c
@@ -268,8 +268,38 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
     switch (data->pWintrustData->dwUnionChoice)
     {
     case WTD_CHOICE_CERT:
-        /* Do nothing!?  See the tests */
-        ret = TRUE;
+        if (data->pWintrustData->u.pCert &&
+         data->pWintrustData->u.pCert->cbStruct == sizeof(WINTRUST_CERT_INFO))
+        {
+            if (data->psPfns)
+            {
+                CRYPT_PROVIDER_SGNR signer = { sizeof(signer), { 0 } };
+                DWORD i;
+
+                /* Add empty signer, so we can add a cert to it */
+                ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, 0, &signer);
+                if (!ret)
+                    goto error;
+                ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
+                 data->pWintrustData->u.pCert->psCertContext);
+                if (!ret)
+                    goto error;
+                for (i = 0; ret && i < data->pWintrustData->u.pCert->chStores;
+                 i++)
+                    ret = data->psPfns->pfnAddStore2Chain(data,
+                     data->pWintrustData->u.pCert->pahStores[i]);
+            }
+            else
+            {
+                /* Do nothing!?  See the tests */
+                ret = TRUE;
+            }
+        }
+        else
+        {
+            SetLastError(ERROR_INVALID_PARAMETER);
+            ret = FALSE;
+        }
         break;
     case WTD_CHOICE_FILE:
         if (!data->pWintrustData->u.pFile)
@@ -305,6 +335,8 @@ error:
     if (!ret)
         data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] =
          GetLastError();
+    TRACE("returning %d (%08x)\n", ret ? S_OK : S_FALSE,
+     data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV]);
     return ret ? S_OK : S_FALSE;
 }
 




More information about the wine-cvs mailing list