Commit 8608e895 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

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.
parent 386427e7
...@@ -858,7 +858,7 @@ static void call_tls_callbacks( HMODULE module, UINT reason ) ...@@ -858,7 +858,7 @@ static void call_tls_callbacks( HMODULE module, UINT reason )
{ {
(*callback)( module, reason, NULL ); (*callback)( module, reason, NULL );
} }
__EXCEPT(NULL) __EXCEPT_ALL
{ {
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF("%04x:exception in TLS callback (proc=%p,module=%p,reason=%s,reserved=0)\n", 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 ...@@ -908,7 +908,7 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved
if (!retv) if (!retv)
status = STATUS_DLL_INIT_FAILED; status = STATUS_DLL_INIT_FAILED;
} }
__EXCEPT(NULL) __EXCEPT_ALL
{ {
if (TRACE_ON(relay)) if (TRACE_ON(relay))
DPRINTF("%04x:exception in PE entry point (proc=%p,module=%p,reason=%s,res=%p)\n", DPRINTF("%04x:exception in PE entry point (proc=%p,module=%p,reason=%s,res=%p)\n",
......
...@@ -2068,7 +2068,7 @@ TMStubImpl_Invoke( ...@@ -2068,7 +2068,7 @@ TMStubImpl_Invoke(
args args
); );
} }
__EXCEPT(NULL) __EXCEPT_ALL
{ {
DWORD dwExceptionCode = GetExceptionCode(); DWORD dwExceptionCode = GetExceptionCode();
ERR("invoke call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode); ERR("invoke call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode);
......
...@@ -718,7 +718,7 @@ LONG_PTR WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pForma ...@@ -718,7 +718,7 @@ LONG_PTR WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pForma
} }
} }
} }
__EXCEPT(NULL) __EXCEPT_ALL
{ {
RetVal = NdrProxyErrorHandler(GetExceptionCode()); RetVal = NdrProxyErrorHandler(GetExceptionCode());
} }
......
...@@ -286,7 +286,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr * ...@@ -286,7 +286,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *
RPCRT4_SetThreadCurrentCallHandle(msg->Handle); RPCRT4_SetThreadCurrentCallHandle(msg->Handle);
__TRY { __TRY {
if (func) func(msg); if (func) func(msg);
} __EXCEPT(NULL) { } __EXCEPT_ALL {
WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode()); WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode());
exception = TRUE; exception = TRUE;
if (GetExceptionCode() == STATUS_ACCESS_VIOLATION) if (GetExceptionCode() == STATUS_ACCESS_VIOLATION)
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
#define __FINALLY(func) __finally { (func)(!AbnormalTermination()); } #define __FINALLY(func) __finally { (func)(!AbnormalTermination()); }
#define __ENDTRY /*nothing*/ #define __ENDTRY /*nothing*/
#define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) #define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
#define __EXCEPT_ALL __except(EXCEPTION_EXECUTE_HANDLER)
#else /* USE_COMPILER_EXCEPTIONS */ #else /* USE_COMPILER_EXCEPTIONS */
...@@ -125,6 +126,8 @@ typedef void (CALLBACK *__WINE_FINALLY)(BOOL); ...@@ -125,6 +126,8 @@ typedef void (CALLBACK *__WINE_FINALLY)(BOOL);
/* convenience handler for page fault exceptions */ /* convenience handler for page fault exceptions */
#define __EXCEPT_PAGE_FAULT __EXCEPT( (__WINE_FILTER)1 ) #define __EXCEPT_PAGE_FAULT __EXCEPT( (__WINE_FILTER)1 )
/* convenience handler for all exception */
#define __EXCEPT_ALL __EXCEPT( NULL )
#define GetExceptionInformation() (__eptr) #define GetExceptionInformation() (__eptr)
#define GetExceptionCode() (__eptr->ExceptionRecord->ExceptionCode) #define GetExceptionCode() (__eptr->ExceptionRecord->ExceptionCode)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment