imagehlp: Improve last error handling in ImageGetCertificateData.
This commit is contained in:
parent
7c3a7d8af1
commit
1e3d65dbb8
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue