On 9/19/2011 17:32, Francois Gouget wrote:
---
Don't return from inside the block this time.
dlls/comctl32/imagelist.c | 13 ++++++++++++- dlls/comctl32/tests/imagelist.c | 17 +++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index ec62370..83b8b44 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -54,6 +54,7 @@ #include "commoncontrols.h" #include "imagelist.h" #include "wine/debug.h" +#include "wine/exception.h"
WINE_DEFAULT_DEBUG_CHANNEL(imagelist);
@@ -3587,7 +3588,17 @@ static const IImageListVtbl ImageListImpl_Vtbl = {
static inline BOOL is_valid(HIMAGELIST himl) { - return himl&& himl->lpVtbl ==&ImageListImpl_Vtbl; + BOOL valid; + __TRY + { + valid = himl&& himl->lpVtbl ==&ImageListImpl_Vtbl; + } + __EXCEPT_PAGE_FAULT + { + valid = FALSE; + } + __ENDTRY + return valid; } Maybe use IsBadReadPtr() with sizeof(void*) is better? You need only vtable pointer to be accessible.