Module: wine Branch: master Commit: 8608e895ebb3241ada19b4745aa61f2a14928416 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8608e895ebb3241ada19b4745a...
Author: Rob Shearman rob@codeweavers.com Date: Fri Feb 15 15:43:24 2008 +0000
Add a new convenience macro for an exception handler that handles all exceptions.
When using native compiler exceptions, the previous method of doing this, __EXCEPT(NULL), would expand to __except( (NULL)(GetExceptionInformation())) which doesn't compile as NULL isn't a function.
So add a new macro, __EXCEPT_ALL, which works correctly both when using native compiler exceptions and without and which makes the meaning of code in which it is used clearer.
---
dlls/ntdll/loader.c | 4 ++-- dlls/oleaut32/tmarshal.c | 2 +- dlls/rpcrt4/ndr_stubless.c | 2 +- dlls/rpcrt4/rpc_server.c | 2 +- include/wine/exception.h | 3 +++ 5 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index a9b8a5e..8ce5a62 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -858,7 +858,7 @@ static void call_tls_callbacks( HMODULE module, UINT reason ) { (*callback)( module, reason, NULL ); } - __EXCEPT(NULL) + __EXCEPT_ALL { if (TRACE_ON(relay)) DPRINTF("%04x:exception in TLS callback (proc=%p,module=%p,reason=%s,reserved=0)\n", @@ -908,7 +908,7 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved if (!retv) status = STATUS_DLL_INIT_FAILED; } - __EXCEPT(NULL) + __EXCEPT_ALL { if (TRACE_ON(relay)) DPRINTF("%04x:exception in PE entry point (proc=%p,module=%p,reason=%s,res=%p)\n", diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c index 52c8e8a..2e5ae14 100644 --- a/dlls/oleaut32/tmarshal.c +++ b/dlls/oleaut32/tmarshal.c @@ -2068,7 +2068,7 @@ TMStubImpl_Invoke( args ); } - __EXCEPT(NULL) + __EXCEPT_ALL { DWORD dwExceptionCode = GetExceptionCode(); ERR("invoke call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode); diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c index 1f6cd57..85c63d2 100644 --- a/dlls/rpcrt4/ndr_stubless.c +++ b/dlls/rpcrt4/ndr_stubless.c @@ -718,7 +718,7 @@ LONG_PTR WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pForma } } } - __EXCEPT(NULL) + __EXCEPT_ALL { RetVal = NdrProxyErrorHandler(GetExceptionCode()); } diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c index 5404259..7849e4e 100644 --- a/dlls/rpcrt4/rpc_server.c +++ b/dlls/rpcrt4/rpc_server.c @@ -286,7 +286,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr * RPCRT4_SetThreadCurrentCallHandle(msg->Handle); __TRY { if (func) func(msg); - } __EXCEPT(NULL) { + } __EXCEPT_ALL { WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode()); exception = TRUE; if (GetExceptionCode() == STATUS_ACCESS_VIOLATION) diff --git a/include/wine/exception.h b/include/wine/exception.h index 10b6c90..3a14a18 100644 --- a/include/wine/exception.h +++ b/include/wine/exception.h @@ -72,6 +72,7 @@ #define __FINALLY(func) __finally { (func)(!AbnormalTermination()); } #define __ENDTRY /*nothing*/ #define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) +#define __EXCEPT_ALL __except(EXCEPTION_EXECUTE_HANDLER)
#else /* USE_COMPILER_EXCEPTIONS */
@@ -125,6 +126,8 @@ typedef void (CALLBACK *__WINE_FINALLY)(BOOL);
/* convenience handler for page fault exceptions */ #define __EXCEPT_PAGE_FAULT __EXCEPT( (__WINE_FILTER)1 ) +/* convenience handler for all exception */ +#define __EXCEPT_ALL __EXCEPT( NULL )
#define GetExceptionInformation() (__eptr) #define GetExceptionCode() (__eptr->ExceptionRecord->ExceptionCode)