wintrust: Separate loading a message from a WINTRUST_CERT_INFO into a helper function.

This commit is contained in:
Juan Lang 2008-10-23 13:40:34 -07:00 committed by Alexandre Julliard
parent 92e88c3a9e
commit 6455674c97
1 changed files with 50 additions and 43 deletions

View File

@ -249,18 +249,10 @@ error:
return ret;
}
HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
TRACE("(%p)\n", data);
if (!data->padwTrustStepErrors)
return S_FALSE;
switch (data->pWintrustData->dwUnionChoice)
{
case WTD_CHOICE_CERT:
if (data->pWintrustData->u.pCert &&
data->pWintrustData->u.pCert->cbStruct == sizeof(WINTRUST_CERT_INFO))
{
@ -282,17 +274,16 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
SystemTimeToFileTime(&sysTime, &signer.sftVerifyAsOf);
}
ret = data->psPfns->pfnAddSgnr2Chain(data, FALSE, 0, &signer);
if (!ret)
goto error;
if (ret)
{
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 */
@ -304,6 +295,22 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
}
return ret;
}
HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
TRACE("(%p)\n", data);
if (!data->padwTrustStepErrors)
return S_FALSE;
switch (data->pWintrustData->dwUnionChoice)
{
case WTD_CHOICE_CERT:
ret = SOFTPUB_LoadCertMessage(data);
break;
case WTD_CHOICE_FILE:
if (!data->pWintrustData->u.pFile)