Module: wine Branch: master Commit: 1e3d65dbb8d3ecc182db3291b460830f0e99c714 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1e3d65dbb8d3ecc182db3291b4...
Author: Aric Stewart aric@codeweavers.com Date: Wed Dec 12 11:11:07 2007 +0900
imagehlp: Improve last error handling in ImageGetCertificateData.
---
dlls/imagehlp/integrity.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/imagehlp/integrity.c b/dlls/imagehlp/integrity.c index df6de0f..bbec56b 100644 --- a/dlls/imagehlp/integrity.c +++ b/dlls/imagehlp/integrity.c @@ -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; }