Commit b56a4b3e authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Implement KiUserCallbackDispatcher().

parent daa1886a
......@@ -3767,7 +3767,7 @@ static void init_wow64( CONTEXT *context )
SET_INIT_BLOCK( LdrInitializeThunk );
SET_INIT_BLOCK( LdrSystemDllInitBlock );
SET_INIT_BLOCK( RtlUserThreadStart );
/* SET_INIT_BLOCK( KiUserCallbackDispatcher ); */
SET_INIT_BLOCK( KiUserCallbackDispatcher );
/* SET_INIT_BLOCK( RtlpQueryProcessDebugInformationRemote ); */
/* SET_INIT_BLOCK( RtlpFreezeTimeBias ); */
/* LdrSystemDllInitBlock.ntdll_handle */
......
......@@ -68,7 +68,7 @@
# @ stub KiIntSystemCall
@ stdcall -norelay KiRaiseUserExceptionDispatcher()
@ stdcall -norelay KiUserApcDispatcher(ptr long long long ptr)
@ stub KiUserCallbackDispatcher
@ stdcall -norelay KiUserCallbackDispatcher(long ptr long)
@ stdcall -norelay KiUserExceptionDispatcher(ptr ptr)
# @ stub LdrAccessOutOfProcessResource
@ stdcall LdrAccessResource(long ptr ptr ptr)
......
......@@ -51,6 +51,7 @@ extern LONG WINAPI call_unhandled_exception_filter( PEXCEPTION_POINTERS eptr ) D
extern void WINAPI LdrInitializeThunk(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI KiUserExceptionDispatcher(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
extern void WINAPI KiUserApcDispatcher(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) DECLSPEC_HIDDEN;
extern void WINAPI KiUserCallbackDispatcher(ULONG,void*,ULONG) DECLSPEC_HIDDEN;
#if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__)
extern RUNTIME_FUNCTION *lookup_function_info( ULONG_PTR pc, ULONG_PTR *base, LDR_DATA_TABLE_ENTRY **module ) DECLSPEC_HIDDEN;
......
......@@ -206,6 +206,17 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1
}
/*******************************************************************
* KiUserCallbackDispatcher (NTDLL.@)
*/
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len )));
}
/***********************************************************************
* RtlUnwind (NTDLL.@)
*/
......
......@@ -565,6 +565,17 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR arg1, ULONG_PTR arg
}
/*******************************************************************
* KiUserCallbackDispatcher (NTDLL.@)
*/
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len )));
}
/***********************************************************************
* Definitions for Win32 unwind tables
*/
......
......@@ -247,6 +247,17 @@ void WINAPI KiUserApcDispatcher( CONTEXT *context, ULONG_PTR ctx, ULONG_PTR arg1
}
/*******************************************************************
* KiUserCallbackDispatcher (NTDLL.@)
*/
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len )));
}
/***********************************************************************
* save_fpu
*
......
......@@ -625,6 +625,19 @@ __ASM_GLOBAL_FUNC( KiUserApcDispatcher,
"int3")
/*******************************************************************
* KiUserCallbackDispatcher (NTDLL.@)
*
* FIXME: not binary compatible
*/
void WINAPI KiUserCallbackDispatcher( ULONG id, void *args, ULONG len )
{
NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
RtlRaiseStatus( NtCallbackReturn( NULL, 0, func( args, len )));
}
static ULONG64 get_int_reg( CONTEXT *context, int reg )
{
return *(&context->Rax + reg);
......
......@@ -1043,7 +1043,7 @@ static void test_init_block(void)
CHECK_FUNC( block64[3], "LdrInitializeThunk" );
CHECK_FUNC( block64[4], "KiUserExceptionDispatcher" );
CHECK_FUNC( block64[5], "KiUserApcDispatcher" );
todo_wine CHECK_FUNC( block64[6], "KiUserCallbackDispatcher" );
CHECK_FUNC( block64[6], "KiUserCallbackDispatcher" );
CHECK_FUNC( block64[7], "RtlUserThreadStart" );
CHECK_FUNC( block64[8], "RtlpQueryProcessDebugInformationRemote" );
todo_wine ok( block64[9] == (ULONG_PTR)ntdll, "got %p for ntdll %p\n",
......
......@@ -105,8 +105,9 @@ static const char so_dir[] = "";
void (WINAPI *pDbgUiRemoteBreakin)( void *arg ) = NULL;
NTSTATUS (WINAPI *pKiRaiseUserExceptionDispatcher)(void) = NULL;
void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) = NULL;
NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) = NULL;
void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) = NULL;
void (WINAPI *pKiUserCallbackDispatcher)(ULONG,void*,ULONG) = NULL;
void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) = NULL;
void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) = NULL;
void (WINAPI *p__wine_ctrl_routine)(void*);
......@@ -832,6 +833,7 @@ static void load_ntdll_functions( HMODULE module )
GET_FUNC( KiRaiseUserExceptionDispatcher );
GET_FUNC( KiUserExceptionDispatcher );
GET_FUNC( KiUserApcDispatcher );
GET_FUNC( KiUserCallbackDispatcher );
GET_FUNC( LdrInitializeThunk );
GET_FUNC( LdrSystemDllInitBlock );
GET_FUNC( RtlUserThreadStart );
......
......@@ -92,8 +92,9 @@ static const LONG teb_offset = 0x2000;
/* callbacks to PE ntdll from the Unix side */
extern void (WINAPI *pDbgUiRemoteBreakin)( void *arg ) DECLSPEC_HIDDEN;
extern NTSTATUS (WINAPI *pKiRaiseUserExceptionDispatcher)(void) DECLSPEC_HIDDEN;
extern void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) DECLSPEC_HIDDEN;
extern NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*) DECLSPEC_HIDDEN;
extern void (WINAPI *pKiUserApcDispatcher)(CONTEXT*,ULONG_PTR,ULONG_PTR,ULONG_PTR,PNTAPCFUNC) DECLSPEC_HIDDEN;
extern void (WINAPI *pKiUserCallbackDispatcher)(ULONG,void*,ULONG) DECLSPEC_HIDDEN;
extern void (WINAPI *pLdrInitializeThunk)(CONTEXT*,void**,ULONG_PTR,ULONG_PTR) DECLSPEC_HIDDEN;
extern void (WINAPI *pRtlUserThreadStart)( PRTL_THREAD_START_ROUTINE entry, void *arg ) DECLSPEC_HIDDEN;
extern void (WINAPI *p__wine_ctrl_routine)(void *) DECLSPEC_HIDDEN;
......
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