Commit 079179fe authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Suppress callback exceptions in KiUserCallbackDispatcher.

parent c1c57bd7
...@@ -533,9 +533,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1 ...@@ -533,9 +533,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1
*/ */
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len ) void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{ {
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; NTSTATUS status;
__TRY
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
status = NtCallbackReturn( NULL, 0, func( args, len ));
}
__EXCEPT_ALL
{
ERR_(seh)( "ignoring exception\n" );
status = NtCallbackReturn( 0, 0, 0 );
}
__ENDTRY
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len ))); RtlRaiseStatus( status );
} }
......
...@@ -576,9 +576,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR arg1, ULONG_PTR arg ...@@ -576,9 +576,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR arg1, ULONG_PTR arg
*/ */
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len ) void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{ {
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; NTSTATUS status;
__TRY
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
status = NtCallbackReturn( NULL, 0, func( args, len ));
}
__EXCEPT_ALL
{
ERR_(seh)( "ignoring exception\n" );
status = NtCallbackReturn( 0, 0, 0 );
}
__ENDTRY
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len ))); RtlRaiseStatus( status );
} }
......
...@@ -257,9 +257,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1 ...@@ -257,9 +257,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1
*/ */
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len ) void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{ {
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; NTSTATUS status;
__TRY
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
status = NtCallbackReturn( NULL, 0, func( args, len ));
}
__EXCEPT_ALL
{
ERR_(seh)( "ignoring exception\n" );
status = NtCallbackReturn( 0, 0, 0 );
}
__ENDTRY
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len ))); RtlRaiseStatus( status );
} }
......
...@@ -661,9 +661,21 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher, ...@@ -661,9 +661,21 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
*/ */
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len ) void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{ {
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id]; NTSTATUS status;
__TRY
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
status = NtCallbackReturn( NULL, 0, func( args, len ));
}
__EXCEPT_ALL
{
ERR_(seh)( "ignoring exception\n" );
status = NtCallbackReturn( 0, 0, 0 );
}
__ENDTRY
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len ))); RtlRaiseStatus( status );
} }
......
...@@ -721,6 +721,7 @@ struct user_callback_frame ...@@ -721,6 +721,7 @@ struct user_callback_frame
ULONG *ret_len; ULONG *ret_len;
__wine_jmp_buf jmpbuf; __wine_jmp_buf jmpbuf;
NTSTATUS status; NTSTATUS status;
void *teb_frame;
}; };
/*********************************************************************** /***********************************************************************
...@@ -756,6 +757,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void ...@@ -756,6 +757,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
callback_frame.frame.restore_flags = CONTEXT_INTEGER; callback_frame.frame.restore_flags = CONTEXT_INTEGER;
callback_frame.frame.syscall_table = frame->syscall_table; callback_frame.frame.syscall_table = frame->syscall_table;
callback_frame.frame.prev_frame = frame; callback_frame.frame.prev_frame = frame;
callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList;
arm_thread_data()->syscall_frame = &callback_frame.frame; arm_thread_data()->syscall_frame = &callback_frame.frame;
__wine_syscall_dispatcher_return( &callback_frame.frame, 0 ); __wine_syscall_dispatcher_return( &callback_frame.frame, 0 );
...@@ -777,6 +779,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status ...@@ -777,6 +779,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status
*frame->ret_len = ret_len; *frame->ret_len = ret_len;
frame->status = status; frame->status = status;
arm_thread_data()->syscall_frame = frame->frame.prev_frame; arm_thread_data()->syscall_frame = frame->frame.prev_frame;
NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame;
__wine_longjmp( &frame->jmpbuf, 1 ); __wine_longjmp( &frame->jmpbuf, 1 );
} }
......
...@@ -730,6 +730,7 @@ struct user_callback_frame ...@@ -730,6 +730,7 @@ struct user_callback_frame
ULONG *ret_len; ULONG *ret_len;
__wine_jmp_buf jmpbuf; __wine_jmp_buf jmpbuf;
NTSTATUS status; NTSTATUS status;
void *teb_frame;
}; };
/*********************************************************************** /***********************************************************************
...@@ -766,6 +767,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void ...@@ -766,6 +767,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
callback_frame.frame.restore_flags = CONTEXT_INTEGER; callback_frame.frame.restore_flags = CONTEXT_INTEGER;
callback_frame.frame.syscall_table = frame->syscall_table; callback_frame.frame.syscall_table = frame->syscall_table;
callback_frame.frame.prev_frame = frame; callback_frame.frame.prev_frame = frame;
callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList;
arm64_thread_data()->syscall_frame = &callback_frame.frame; arm64_thread_data()->syscall_frame = &callback_frame.frame;
__wine_syscall_dispatcher_return( &callback_frame.frame, 0 ); __wine_syscall_dispatcher_return( &callback_frame.frame, 0 );
...@@ -787,6 +789,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status ...@@ -787,6 +789,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status
*frame->ret_len = ret_len; *frame->ret_len = ret_len;
frame->status = status; frame->status = status;
arm64_thread_data()->syscall_frame = frame->frame.prev_frame; arm64_thread_data()->syscall_frame = frame->frame.prev_frame;
NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame;
__wine_longjmp( &frame->jmpbuf, 1 ); __wine_longjmp( &frame->jmpbuf, 1 );
} }
......
...@@ -1575,6 +1575,7 @@ struct user_callback_frame ...@@ -1575,6 +1575,7 @@ struct user_callback_frame
ULONG *ret_len; ULONG *ret_len;
__wine_jmp_buf jmpbuf; __wine_jmp_buf jmpbuf;
NTSTATUS status; NTSTATUS status;
void *teb_frame;
}; };
/*********************************************************************** /***********************************************************************
...@@ -1614,6 +1615,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void ...@@ -1614,6 +1615,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
callback_frame.frame.syscall_flags = frame->syscall_flags; callback_frame.frame.syscall_flags = frame->syscall_flags;
callback_frame.frame.syscall_table = frame->syscall_table; callback_frame.frame.syscall_table = frame->syscall_table;
callback_frame.frame.prev_frame = frame; callback_frame.frame.prev_frame = frame;
callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList;
x86_thread_data()->syscall_frame = &callback_frame.frame; x86_thread_data()->syscall_frame = &callback_frame.frame;
__wine_syscall_dispatcher_return( &callback_frame.frame, 0 ); __wine_syscall_dispatcher_return( &callback_frame.frame, 0 );
...@@ -1635,6 +1637,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status ...@@ -1635,6 +1637,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status
*frame->ret_len = ret_len; *frame->ret_len = ret_len;
frame->status = status; frame->status = status;
x86_thread_data()->syscall_frame = frame->frame.prev_frame; x86_thread_data()->syscall_frame = frame->frame.prev_frame;
NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame;
__wine_longjmp( &frame->jmpbuf, 1 ); __wine_longjmp( &frame->jmpbuf, 1 );
} }
......
...@@ -2327,6 +2327,7 @@ struct user_callback_frame ...@@ -2327,6 +2327,7 @@ struct user_callback_frame
ULONG *ret_len; ULONG *ret_len;
__wine_jmp_buf jmpbuf; __wine_jmp_buf jmpbuf;
NTSTATUS status; NTSTATUS status;
void *teb_frame;
}; };
/*********************************************************************** /***********************************************************************
...@@ -2368,6 +2369,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void ...@@ -2368,6 +2369,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
callback_frame.frame.prev_frame = frame; callback_frame.frame.prev_frame = frame;
callback_frame.frame.syscall_flags = frame->syscall_flags; callback_frame.frame.syscall_flags = frame->syscall_flags;
callback_frame.frame.syscall_table = frame->syscall_table; callback_frame.frame.syscall_table = frame->syscall_table;
callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList;
amd64_thread_data()->syscall_frame = &callback_frame.frame; amd64_thread_data()->syscall_frame = &callback_frame.frame;
__wine_syscall_dispatcher_return( &callback_frame.frame, 0 ); __wine_syscall_dispatcher_return( &callback_frame.frame, 0 );
...@@ -2389,6 +2391,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status ...@@ -2389,6 +2391,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status
*frame->ret_len = ret_len; *frame->ret_len = ret_len;
frame->status = status; frame->status = status;
amd64_thread_data()->syscall_frame = frame->frame.prev_frame; amd64_thread_data()->syscall_frame = frame->frame.prev_frame;
NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame;
__wine_longjmp( &frame->jmpbuf, 1 ); __wine_longjmp( &frame->jmpbuf, 1 );
} }
......
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