From dc9b14a73559d3a697c3c12bdaefcf2e0a9e1241 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Wed, 4 Dec 2019 20:32:02 +0100 Subject: [PATCH] [Kernel/Sketchy] Implemented NtQueueApcThread Signed-off-by: Gliniak --- src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc index 4800f0455..b12325dcd 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc @@ -970,12 +970,18 @@ void KfLowerIrql(dword_t old_value) { DECLARE_XBOXKRNL_EXPORT2(KfLowerIrql, kThreading, kImplemented, kHighFrequency); void NtQueueApcThread(dword_t thread_handle, lpvoid_t apc_routine, - lpvoid_t arg1, lpvoid_t arg2, lpvoid_t arg3) { - // Alloc APC object (from somewhere) and insert. + lpvoid_t apc_routine_context, lpvoid_t arg1, + lpvoid_t arg2) { + auto thread = + kernel_state()->object_table()->LookupObject(thread_handle); - assert_always("not implemented"); + if (!thread) { + return; + } + + thread->EnqueueApc(apc_routine, apc_routine_context, arg1, arg2); } -// DECLARE_XBOXKRNL_EXPORT1(NtQueueApcThread, kThreading, kStub); +DECLARE_XBOXKRNL_EXPORT1(NtQueueApcThread, kThreading, kSketchy); void KeInitializeApc(pointer_t apc, lpvoid_t thread_ptr, lpvoid_t kernel_routine, lpvoid_t rundown_routine,