Module: wine Branch: refs/heads/master Commit: 324d86a3af69598631d2d6a6c27612f41991d8a9 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=324d86a3af69598631d2d6a6...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Dec 16 16:58:47 2005 +0100
Exception handling: Added a magic __EXCEPT_PAGE_FAULT macro to make it easier to handle the common case of trapping page faults.
---
dlls/ntdll/exception.c | 8 +++++++- include/wine/exception.h | 4 ++++ 2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c index 47ed835..972ba0a 100644 --- a/dlls/ntdll/exception.c +++ b/dlls/ntdll/exception.c @@ -546,7 +546,13 @@ DWORD __wine_exception_handler( EXCEPTIO
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 cc03fdb..9586503 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 )