Juan Lang : wintrust: Return error directly from SOFTPUB_GetSIP.

Alexandre Julliard julliard at winehq.org
Thu Jan 28 11:15:34 CST 2010


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Wed Jan 27 10:31:26 2010 -0800

wintrust: Return error directly from SOFTPUB_GetSIP.

---

 dlls/wintrust/softpub.c |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/dlls/wintrust/softpub.c b/dlls/wintrust/softpub.c
index 356d8fe..a6edfe2 100644
--- a/dlls/wintrust/softpub.c
+++ b/dlls/wintrust/softpub.c
@@ -127,20 +127,20 @@ static DWORD SOFTPUB_GetFileSubject(CRYPT_PROVIDER_DATA *data)
 /* Assumes data->u.pPDSip exists, and its gSubject member set.
  * Allocates data->u.pPDSip->pSip and loads it, if possible.
  */
-static BOOL SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data)
+static DWORD SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data)
 {
-    BOOL ret;
+    DWORD err = ERROR_SUCCESS;
 
     data->u.pPDSip->pSip = data->psPfns->pfnAlloc(sizeof(SIP_DISPATCH_INFO));
     if (data->u.pPDSip->pSip)
-        ret = CryptSIPLoad(&data->u.pPDSip->gSubject, 0, data->u.pPDSip->pSip);
-    else
     {
-        SetLastError(ERROR_OUTOFMEMORY);
-        ret = FALSE;
+        if (!CryptSIPLoad(&data->u.pPDSip->gSubject, 0, data->u.pPDSip->pSip))
+            err = GetLastError();
     }
-    TRACE("returning %d\n", ret);
-    return ret;
+    else
+        err = ERROR_OUTOFMEMORY;
+    TRACE("returning %d\n", err);
+    return err;
 }
 
 /* Assumes data->u.pPDSip has been loaded, and data->u.pPDSip->pSip allocated.
@@ -336,11 +336,9 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
     err = SOFTPUB_GetFileSubject(data);
     if (err)
         goto error;
-    if (!SOFTPUB_GetSIP(data))
-    {
-        err = GetLastError();
+    err = SOFTPUB_GetSIP(data);
+    if (err)
         goto error;
-    }
     if (!SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile,
      data->pWintrustData->u.pFile->pcwszFilePath))
     {
@@ -380,11 +378,9 @@ static DWORD SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data)
         err = GetLastError();
         goto error;
     }
-    if (!SOFTPUB_GetSIP(data))
-    {
-        err = GetLastError();
+    err = SOFTPUB_GetSIP(data);
+    if (err)
         goto error;
-    }
     if (!SOFTPUB_GetMessageFromFile(data, catalog,
      data->pWintrustData->u.pCatalog->pcwszCatalogFilePath))
     {




More information about the wine-cvs mailing list