imagehlp: Improve last error handling in ImageGetCertificateData.

This commit is contained in:
Aric Stewart 2007-12-12 11:11:07 +09:00 committed by Alexandre Julliard
parent 7c3a7d8af1
commit 1e3d65dbb8
1 changed files with 13 additions and 6 deletions

View File

@ -226,15 +226,15 @@ BOOL WINAPI ImageGetCertificateData(
TRACE("%p %d %p %p\n", handle, Index, Certificate, RequiredLength);
if( !RequiredLength)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
if( !IMAGEHLP_GetCertificateOffset( handle, Index, &ofs, &size ) )
return FALSE;
if( !Certificate )
{
*RequiredLength = size;
return TRUE;
}
if( *RequiredLength < size )
{
*RequiredLength = size;
@ -242,6 +242,12 @@ BOOL WINAPI ImageGetCertificateData(
return FALSE;
}
if( !Certificate )
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
*RequiredLength = size;
offset = SetFilePointer( handle, ofs, NULL, FILE_BEGIN );
@ -255,6 +261,7 @@ BOOL WINAPI ImageGetCertificateData(
return FALSE;
TRACE("OK\n");
SetLastError( NO_ERROR );
return TRUE;
}