ntdll: Suppress callback exceptions in KiUserCallbackDispatcher.

This commit is contained in:
Jacek Caban 2022-07-19 19:42:26 +02:00 committed by Alexandre Julliard
parent c1c57bd750
commit 079179fec7
8 changed files with 68 additions and 8 deletions

View file

@ -533,9 +533,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1
*/
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
NTSTATUS status;
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len )));
__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( status );
}

View file

@ -576,9 +576,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR arg1, ULONG_PTR arg
*/
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
NTSTATUS status;
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len )));
__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( status );
}

View file

@ -257,9 +257,21 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1
*/
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
NTSTATUS status;
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len )));
__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( status );
}

View file

@ -661,9 +661,21 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
*/
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
NTSTATUS status;
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len )));
__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( status );
}

View file

@ -721,6 +721,7 @@ struct user_callback_frame
ULONG *ret_len;
__wine_jmp_buf jmpbuf;
NTSTATUS status;
void *teb_frame;
};
/***********************************************************************
@ -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.syscall_table = frame->syscall_table;
callback_frame.frame.prev_frame = frame;
callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList;
arm_thread_data()->syscall_frame = &callback_frame.frame;
__wine_syscall_dispatcher_return( &callback_frame.frame, 0 );
@ -777,6 +779,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status
*frame->ret_len = ret_len;
frame->status = status;
arm_thread_data()->syscall_frame = frame->frame.prev_frame;
NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame;
__wine_longjmp( &frame->jmpbuf, 1 );
}

View file

@ -730,6 +730,7 @@ struct user_callback_frame
ULONG *ret_len;
__wine_jmp_buf jmpbuf;
NTSTATUS status;
void *teb_frame;
};
/***********************************************************************
@ -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.syscall_table = frame->syscall_table;
callback_frame.frame.prev_frame = frame;
callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList;
arm64_thread_data()->syscall_frame = &callback_frame.frame;
__wine_syscall_dispatcher_return( &callback_frame.frame, 0 );
@ -787,6 +789,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status
*frame->ret_len = ret_len;
frame->status = status;
arm64_thread_data()->syscall_frame = frame->frame.prev_frame;
NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame;
__wine_longjmp( &frame->jmpbuf, 1 );
}

View file

@ -1575,6 +1575,7 @@ struct user_callback_frame
ULONG *ret_len;
__wine_jmp_buf jmpbuf;
NTSTATUS status;
void *teb_frame;
};
/***********************************************************************
@ -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_table = frame->syscall_table;
callback_frame.frame.prev_frame = frame;
callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList;
x86_thread_data()->syscall_frame = &callback_frame.frame;
__wine_syscall_dispatcher_return( &callback_frame.frame, 0 );
@ -1635,6 +1637,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status
*frame->ret_len = ret_len;
frame->status = status;
x86_thread_data()->syscall_frame = frame->frame.prev_frame;
NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame;
__wine_longjmp( &frame->jmpbuf, 1 );
}

View file

@ -2327,6 +2327,7 @@ struct user_callback_frame
ULONG *ret_len;
__wine_jmp_buf jmpbuf;
NTSTATUS status;
void *teb_frame;
};
/***********************************************************************
@ -2368,6 +2369,7 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
callback_frame.frame.prev_frame = frame;
callback_frame.frame.syscall_flags = frame->syscall_flags;
callback_frame.frame.syscall_table = frame->syscall_table;
callback_frame.teb_frame = NtCurrentTeb()->Tib.ExceptionList;
amd64_thread_data()->syscall_frame = &callback_frame.frame;
__wine_syscall_dispatcher_return( &callback_frame.frame, 0 );
@ -2389,6 +2391,7 @@ NTSTATUS WINAPI NtCallbackReturn( void *ret_ptr, ULONG ret_len, NTSTATUS status
*frame->ret_len = ret_len;
frame->status = status;
amd64_thread_data()->syscall_frame = frame->frame.prev_frame;
NtCurrentTeb()->Tib.ExceptionList = frame->teb_frame;
__wine_longjmp( &frame->jmpbuf, 1 );
}