wintrust: Return error directly from SOFTPUB_OpenFile.

This commit is contained in:
Juan Lang 2010-01-27 10:27:49 -08:00 committed by Alexandre Julliard
parent 528876c402
commit fc1fbf6107
1 changed files with 8 additions and 10 deletions

View File

@ -75,9 +75,9 @@ HRESULT WINAPI DriverFinalPolicy(CRYPT_PROVIDER_DATA *data)
/* Assumes data->pWintrustData->u.pFile exists. Makes sure a file handle is /* Assumes data->pWintrustData->u.pFile exists. Makes sure a file handle is
* open for the file. * open for the file.
*/ */
static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data) static DWORD SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data)
{ {
BOOL ret = TRUE; DWORD err = ERROR_SUCCESS;
/* PSDK implies that all values should be initialized to NULL, so callers /* PSDK implies that all values should be initialized to NULL, so callers
* typically have hFile as NULL rather than INVALID_HANDLE_VALUE. Check * typically have hFile as NULL rather than INVALID_HANDLE_VALUE. Check
@ -92,13 +92,13 @@ static BOOL SOFTPUB_OpenFile(CRYPT_PROVIDER_DATA *data)
if (data->pWintrustData->u.pFile->hFile != INVALID_HANDLE_VALUE) if (data->pWintrustData->u.pFile->hFile != INVALID_HANDLE_VALUE)
data->fOpenedFile = TRUE; data->fOpenedFile = TRUE;
else else
ret = FALSE; err = GetLastError();
} }
if (ret) if (!err)
GetFileTime(data->pWintrustData->u.pFile->hFile, &data->sftSystemTime, GetFileTime(data->pWintrustData->u.pFile->hFile, &data->sftSystemTime,
NULL, NULL); NULL, NULL);
TRACE("returning %d\n", ret); TRACE("returning %d\n", err);
return ret; return err;
} }
/* Assumes data->pWintrustData->u.pFile exists. Sets data->pPDSip->gSubject to /* Assumes data->pWintrustData->u.pFile exists. Sets data->pPDSip->gSubject to
@ -332,11 +332,9 @@ static DWORD SOFTPUB_LoadFileMessage(CRYPT_PROVIDER_DATA *data)
err = ERROR_INVALID_PARAMETER; err = ERROR_INVALID_PARAMETER;
goto error; goto error;
} }
if (!SOFTPUB_OpenFile(data)) err = SOFTPUB_OpenFile(data);
{ if (err)
err = GetLastError();
goto error; goto error;
}
if (!SOFTPUB_GetFileSubject(data)) if (!SOFTPUB_GetFileSubject(data))
{ {
err = GetLastError(); err = GetLastError();