ucrtbase: Add __processing_throw implementation.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Piotr Caban 2018-03-20 15:36:48 +01:00 committed by Alexandre Julliard
parent f82af4d2bb
commit 9999c59c48
7 changed files with 21 additions and 5 deletions

View File

@ -40,7 +40,7 @@
@ stub __intrinsic_abnormal_termination
@ cdecl -arch=i386,x86_64,arm,arm64 -norelay __intrinsic_setjmp(ptr) ucrtbase.__intrinsic_setjmp
@ cdecl -arch=x86_64,arm64 -norelay __intrinsic_setjmpex(ptr ptr) ucrtbase.__intrinsic_setjmpex
@ stub __processing_throw
@ cdecl __processing_throw() ucrtbase.__processing_throw
@ stub __report_gsfailure
@ cdecl __std_exception_copy(ptr ptr) ucrtbase.__std_exception_copy
@ cdecl __std_exception_destroy(ptr) ucrtbase.__std_exception_destroy

View File

@ -528,4 +528,13 @@ void** CDECL __current_exception_context(void)
return (void**)&msvcrt_get_thread_data()->ctx_record;
}
/*********************************************************************
* __processing_throw (UCRTBASE.@)
*/
int* CDECL __processing_throw(void)
{
TRACE("()\n");
return &msvcrt_get_thread_data()->processing_throw;
}
#endif /* _MSVCR_VER>=140 */

View File

@ -412,8 +412,9 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
struct catch_func_nested_frame nested_frame;
int trylevel = frame->trylevel;
DWORD save_esp = ((DWORD*)frame)[-1];
thread_data_t *data;
thread_data_t *data = msvcrt_get_thread_data();
data->processing_throw++;
for (i = 0; i < descr->tryblock_count; i++)
{
const tryblock_info *tryblock = &descr->tryblock[i];
@ -456,11 +457,11 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
cxx_local_unwind( frame, descr, tryblock->start_level );
frame->trylevel = tryblock->end_level + 1;
data = msvcrt_get_thread_data();
nested_frame.frame_info.rec = data->exc_record;
nested_frame.frame_info.context = data->ctx_record;
data->exc_record = rec;
data->ctx_record = context;
data->processing_throw--;
/* call the catch block */
TRACE( "calling catch block %p addr %p ebp %p\n",
@ -483,6 +484,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
continue_after_catch( frame, addr );
}
}
data->processing_throw--;
}
/*********************************************************************

View File

@ -363,6 +363,7 @@ static void* WINAPI call_catch_block(EXCEPTION_RECORD *rec)
ctx.rethrow = FALSE;
__CxxRegisterExceptionObject(&ep, &ctx.frame_info);
msvcrt_get_thread_data()->processing_throw--;
__TRY
{
__TRY
@ -410,12 +411,14 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, CONTEXT *context,
ULONG64 exc_base = (rec->NumberParameters == 4 ? rec->ExceptionInformation[3] : 0);
int trylevel = ip_to_state(rva_to_ptr(descr->ipmap, dispatch->ImageBase),
descr->ipmap_count, dispatch->ControlPc-dispatch->ImageBase);
thread_data_t *data = msvcrt_get_thread_data();
const tryblock_info *in_catch;
EXCEPTION_RECORD catch_record;
CONTEXT ctx;
UINT i, j;
INT *unwind_help;
data->processing_throw++;
for (i=descr->tryblock_count; i>0; i--)
{
in_catch = rva_to_ptr(descr->tryblock, dispatch->ImageBase);
@ -494,6 +497,7 @@ static inline void find_catch_block(EXCEPTION_RECORD *rec, CONTEXT *context,
}
TRACE("no matching catch block found\n");
data->processing_throw--;
}
static LONG CALLBACK se_translation_filter(EXCEPTION_POINTERS *ep, void *c)

View File

@ -260,6 +260,7 @@ struct __thread_data {
int unk7;
EXCEPTION_RECORD *exc_record;
CONTEXT *ctx_record;
int processing_throw;
frame_info *frame_info_head;
void *unk8[6];
LCID cached_lcid;

View File

@ -135,7 +135,7 @@
@ cdecl __p__wenviron() MSVCRT___p__wenviron
@ cdecl __p__wpgmptr() MSVCRT___p__wpgmptr
@ cdecl __pctype_func() MSVCRT___pctype_func
@ stub __processing_throw
@ cdecl __processing_throw()
@ stub __pwctype_func
@ cdecl __pxcptinfoptrs() MSVCRT___pxcptinfoptrs
@ stub __report_gsfailure

View File

@ -34,7 +34,7 @@
@ cdecl __current_exception_context() ucrtbase.__current_exception_context
@ cdecl -arch=i386,x86_64,arm,arm64 -norelay __intrinsic_setjmp(ptr) ucrtbase.__intrinsic_setjmp
@ cdecl -arch=x86_64,arm64 -norelay __intrinsic_setjmpex(ptr ptr) ucrtbase.__intrinsic_setjmpex
@ stub __processing_throw
@ cdecl __processing_throw() ucrtbase.__processing_throw
@ stub __report_gsfailure
@ cdecl __std_exception_copy(ptr ptr) ucrtbase.__std_exception_copy
@ cdecl __std_exception_destroy(ptr) ucrtbase.__std_exception_destroy