Commit 1facdbbd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

ntdll: Temporarily allow KeUserModeCallback calls from client stack.

parent a34e8c2b
......@@ -700,6 +700,14 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
{
struct user_callback_frame callback_frame = { { 0 }, ret_ptr, ret_len };
/* if we have no syscall frame, call the callback directly */
if ((char *)&callback_frame < (char *)ntdll_get_thread_data()->kernel_stack ||
(char *)&callback_frame > (char *)arm_thread_data()->syscall_frame)
{
NTSTATUS (WINAPI *func)(const void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
return func( args, len );
}
if ((char *)ntdll_get_thread_data()->kernel_stack + min_kernel_stack > (char *)&callback_frame)
return STATUS_STACK_OVERFLOW;
......
......@@ -738,6 +738,14 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
{
struct user_callback_frame callback_frame = { {{ 0 }}, ret_ptr, ret_len };
/* if we have no syscall frame, call the callback directly */
if ((char *)&callback_frame < (char *)ntdll_get_thread_data()->kernel_stack ||
(char *)&callback_frame > (char *)arm64_thread_data()->syscall_frame)
{
NTSTATUS (WINAPI *func)(const void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
return func( args, len );
}
if ((char *)ntdll_get_thread_data()->kernel_stack + min_kernel_stack > (char *)&callback_frame)
return STATUS_STACK_OVERFLOW;
......
......@@ -1569,6 +1569,14 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
{
struct user_callback_frame callback_frame = { { 0 }, ret_ptr, ret_len };
/* if we have no syscall frame, call the callback directly */
if ((char *)&callback_frame < (char *)ntdll_get_thread_data()->kernel_stack ||
(char *)&callback_frame > (char *)x86_thread_data()->syscall_frame)
{
NTSTATUS (WINAPI *func)(const void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
return func( args, len );
}
if ((char *)ntdll_get_thread_data()->kernel_stack + min_kernel_stack > (char *)&callback_frame)
return STATUS_STACK_OVERFLOW;
......
......@@ -2293,6 +2293,14 @@ NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void
{
struct user_callback_frame callback_frame = { { 0 }, ret_ptr, ret_len };
/* if we have no syscall frame, call the callback directly */
if ((char *)&callback_frame < (char *)ntdll_get_thread_data()->kernel_stack ||
(char *)&callback_frame > (char *)amd64_thread_data()->syscall_frame)
{
NTSTATUS (WINAPI *func)(const void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
return func( args, len );
}
if ((char *)ntdll_get_thread_data()->kernel_stack + min_kernel_stack > (char *)&callback_frame)
return STATUS_STACK_OVERFLOW;
......
......@@ -80,6 +80,8 @@ extern void ntdll_set_exception_jmp_buf( __wine_jmp_buf *jmp );
} \
} while (0);
NTSTATUS WINAPI KeUserModeCallback( ULONG id, const void *args, ULONG len, void **ret_ptr, ULONG *ret_len );
/* wide char string functions */
static inline size_t ntdll_wcslen( const WCHAR *str )
......
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