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.
This commit is contained in:
Rob Shearman 2008-02-15 15:43:24 +00:00 committed by Alexandre Julliard
parent 386427e739
commit 8608e895eb
5 changed files with 8 additions and 5 deletions

View File

@ -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
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",

View File

@ -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);

View File

@ -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());
} }

View File

@ -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)

View File

@ -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);
/* 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)