Commit 1e3d65db authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

imagehlp: Improve last error handling in ImageGetCertificateData.

parent 7c3a7d8a
......@@ -226,19 +226,25 @@ 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 )
if( *RequiredLength < size )
{
*RequiredLength = size;
return TRUE;
SetLastError( ERROR_INSUFFICIENT_BUFFER );
return FALSE;
}
if( *RequiredLength < size )
if( !Certificate )
{
*RequiredLength = size;
SetLastError( ERROR_INSUFFICIENT_BUFFER );
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
......@@ -255,6 +261,7 @@ BOOL WINAPI ImageGetCertificateData(
return FALSE;
TRACE("OK\n");
SetLastError( NO_ERROR );
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment