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

This commit is contained in:
Juan Lang 2008-10-23 13:42:08 -07:00 committed by Alexandre Julliard
parent 6455674c97
commit 1bfb602993
1 changed files with 31 additions and 23 deletions

View File

@ -298,6 +298,36 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
return ret; return ret;
} }
static BOOL SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
if (!data->pWintrustData->u.pFile)
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
goto error;
}
ret = SOFTPUB_OpenFile(data);
if (!ret)
goto error;
ret = SOFTPUB_GetFileSubject(data);
if (!ret)
goto error;
ret = SOFTPUB_GetSIP(data);
if (!ret)
goto error;
ret = SOFTPUB_GetMessageFromFile(data);
if (!ret)
goto error;
ret = SOFTPUB_CreateStoreFromMessage(data);
if (!ret)
goto error;
ret = SOFTPUB_DecodeInnerContent(data);
error:
return ret;
}
HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data) HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
{ {
BOOL ret; BOOL ret;
@ -313,28 +343,7 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
ret = SOFTPUB_LoadCertMessage(data); ret = SOFTPUB_LoadCertMessage(data);
break; break;
case WTD_CHOICE_FILE: case WTD_CHOICE_FILE:
if (!data->pWintrustData->u.pFile) ret = SOFTPUB_LoadFileMessage(data);
{
SetLastError(ERROR_INVALID_PARAMETER);
ret = FALSE;
goto error;
}
ret = SOFTPUB_OpenFile(data);
if (!ret)
goto error;
ret = SOFTPUB_GetFileSubject(data);
if (!ret)
goto error;
ret = SOFTPUB_GetSIP(data);
if (!ret)
goto error;
ret = SOFTPUB_GetMessageFromFile(data);
if (!ret)
goto error;
ret = SOFTPUB_CreateStoreFromMessage(data);
if (!ret)
goto error;
ret = SOFTPUB_DecodeInnerContent(data);
break; break;
default: default:
FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice); FIXME("unimplemented for %d\n", data->pWintrustData->dwUnionChoice);
@ -342,7 +351,6 @@ HRESULT WINAPI SoftpubLoadMessage(CRYPT_PROVIDER_DATA *data)
ret = FALSE; ret = FALSE;
} }
error:
if (!ret) if (!ret)
data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] = data->padwTrustStepErrors[TRUSTERROR_STEP_FINAL_OBJPROV] =
GetLastError(); GetLastError();