diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index 47ed835e543..972ba0ac1c3 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -546,7 +546,13 @@ DWORD __wine_exception_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION if (record->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND | EH_NESTED_CALL)) return ExceptionContinueSearch; - if (wine_frame->u.filter) + + if (wine_frame->u.filter == (void *)1) /* special hack for page faults */ + { + if (record->ExceptionCode != EXCEPTION_ACCESS_VIOLATION) + return ExceptionContinueSearch; + } + else if (wine_frame->u.filter) { EXCEPTION_POINTERS ptrs; ptrs.ExceptionRecord = record; diff --git a/include/wine/exception.h b/include/wine/exception.h index cc03fdb69c6..9586503ba35 100644 --- a/include/wine/exception.h +++ b/include/wine/exception.h @@ -71,6 +71,7 @@ #define __EXCEPT(func) __except((func)(GetExceptionInformation())) #define __FINALLY(func) __finally { (func)(!AbnormalTermination()); } #define __ENDTRY /*nothing*/ +#define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) #else /* USE_COMPILER_EXCEPTIONS */ @@ -122,6 +123,9 @@ typedef DWORD (CALLBACK *__WINE_FILTER)(PEXCEPTION_POINTERS); typedef void (CALLBACK *__WINE_FINALLY)(BOOL); +/* convenience handler for page fault exceptions */ +#define __EXCEPT_PAGE_FAULT __EXCEPT( (__WINE_FILTER)1 ) + #define WINE_EXCEPTION_FILTER(func) DWORD WINAPI func( EXCEPTION_POINTERS *__eptr ) #define WINE_FINALLY_FUNC(func) void WINAPI func( BOOL __normal )