Commit 568b0025 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

wintrust: Return error directly from SOFTPUB_GetMessageFromFile.

parent 2c12de4b
...@@ -146,9 +146,10 @@ static DWORD SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data) ...@@ -146,9 +146,10 @@ static DWORD SOFTPUB_GetSIP(CRYPT_PROVIDER_DATA *data)
/* Assumes data->u.pPDSip has been loaded, and data->u.pPDSip->pSip allocated. /* Assumes data->u.pPDSip has been loaded, and data->u.pPDSip->pSip allocated.
* Calls data->u.pPDSip->pSip->pfGet to construct data->hMsg. * Calls data->u.pPDSip->pSip->pfGet to construct data->hMsg.
*/ */
static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file, static DWORD SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
LPCWSTR filePath) LPCWSTR filePath)
{ {
DWORD err = ERROR_SUCCESS;
BOOL ret; BOOL ret;
LPBYTE buf = NULL; LPBYTE buf = NULL;
DWORD size = 0; DWORD size = 0;
...@@ -156,10 +157,7 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file, ...@@ -156,10 +157,7 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
data->u.pPDSip->psSipSubjectInfo = data->u.pPDSip->psSipSubjectInfo =
data->psPfns->pfnAlloc(sizeof(SIP_SUBJECTINFO)); data->psPfns->pfnAlloc(sizeof(SIP_SUBJECTINFO));
if (!data->u.pPDSip->psSipSubjectInfo) if (!data->u.pPDSip->psSipSubjectInfo)
{ return ERROR_OUTOFMEMORY;
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
data->u.pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO); data->u.pPDSip->psSipSubjectInfo->cbSize = sizeof(SIP_SUBJECTINFO);
data->u.pPDSip->psSipSubjectInfo->pgSubjectType = &data->u.pPDSip->gSubject; data->u.pPDSip->psSipSubjectInfo->pgSubjectType = &data->u.pPDSip->gSubject;
...@@ -169,17 +167,11 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file, ...@@ -169,17 +167,11 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo, ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo,
&data->dwEncoding, 0, &size, 0); &data->dwEncoding, 0, &size, 0);
if (!ret) if (!ret)
{ return TRUST_E_NOSIGNATURE;
SetLastError(TRUST_E_NOSIGNATURE);
return FALSE;
}
buf = data->psPfns->pfnAlloc(size); buf = data->psPfns->pfnAlloc(size);
if (!buf) if (!buf)
{ return ERROR_OUTOFMEMORY;
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo, ret = data->u.pPDSip->pSip->pfGet(data->u.pPDSip->psSipSubjectInfo,
&data->dwEncoding, 0, &size, buf); &data->dwEncoding, 0, &size, buf);
...@@ -188,12 +180,18 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file, ...@@ -188,12 +180,18 @@ static BOOL SOFTPUB_GetMessageFromFile(CRYPT_PROVIDER_DATA *data, HANDLE file,
data->hMsg = CryptMsgOpenToDecode(data->dwEncoding, 0, 0, data->hProv, data->hMsg = CryptMsgOpenToDecode(data->dwEncoding, 0, 0, data->hProv,
NULL, NULL); NULL, NULL);
if (data->hMsg) if (data->hMsg)
{
ret = CryptMsgUpdate(data->hMsg, buf, size, TRUE); ret = CryptMsgUpdate(data->hMsg, buf, size, TRUE);
if (!ret)
err = GetLastError();
} }
}
else
err = GetLastError();
data->psPfns->pfnFree(buf); data->psPfns->pfnFree(buf);
TRACE("returning %d\n", ret); TRACE("returning %d\n", err);
return ret; return err;
} }
static BOOL SOFTPUB_CreateStoreFromMessage(CRYPT_PROVIDER_DATA *data) static BOOL SOFTPUB_CreateStoreFromMessage(CRYPT_PROVIDER_DATA *data)
...@@ -339,12 +337,10 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data) ...@@ -339,12 +337,10 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
err = SOFTPUB_GetSIP(data); err = SOFTPUB_GetSIP(data);
if (err) if (err)
goto error; goto error;
if (!SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile, err = SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile,
data->pWintrustData->u.pFile->pcwszFilePath)) data->pWintrustData->u.pFile->pcwszFilePath);
{ if (err)
err = GetLastError();
goto error; goto error;
}
if (!SOFTPUB_CreateStoreFromMessage(data)) if (!SOFTPUB_CreateStoreFromMessage(data))
{ {
err = GetLastError(); err = GetLastError();
...@@ -381,12 +377,10 @@ static DWORD SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data) ...@@ -381,12 +377,10 @@ static DWORD SOFTPUB_LoadCatalogMessage(CRYPT_PROVIDER_DATA *data)
err = SOFTPUB_GetSIP(data); err = SOFTPUB_GetSIP(data);
if (err) if (err)
goto error; goto error;
if (!SOFTPUB_GetMessageFromFile(data, catalog, err = SOFTPUB_GetMessageFromFile(data, data->pWintrustData->u.pFile->hFile,
data->pWintrustData->u.pCatalog->pcwszCatalogFilePath)) data->pWintrustData->u.pFile->pcwszFilePath);
{ if (err)
err = GetLastError();
goto error; goto error;
}
if (!SOFTPUB_CreateStoreFromMessage(data)) if (!SOFTPUB_CreateStoreFromMessage(data))
{ {
err = GetLastError(); err = GetLastError();
......
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