NtSuspendThread.

This commit is contained in:
Ben Vanik
2014-01-06 23:23:27 -08:00
parent 8033c73f41
commit 469ea9451d
4 changed files with 55 additions and 0 deletions

View File

@@ -230,6 +230,46 @@ SHIM_CALL KeResumeThread_shim(
}
X_STATUS xeNtSuspendThread(uint32_t handle, uint32_t* out_suspend_count) {
KernelState* state = shared_kernel_state_;
XEASSERTNOTNULL(state);
X_STATUS result = X_STATUS_SUCCESS;
XThread* thread = NULL;
result = state->object_table()->GetObject(
handle, (XObject**)&thread);
if (XSUCCEEDED(result)) {
result = thread->Suspend(out_suspend_count);
thread->Release();
}
return result;
}
SHIM_CALL NtSuspendThread_shim(
PPCContext* ppc_state, KernelState* state) {
uint32_t handle = SHIM_GET_ARG_32(0);
uint32_t suspend_count_ptr = SHIM_GET_ARG_32(1);
XELOGD(
"NtSuspendThread(%.8X, %.8X)",
handle,
suspend_count_ptr);
uint32_t suspend_count;
X_STATUS result = xeNtSuspendThread(handle, &suspend_count);
if (XSUCCEEDED(result)) {
if (suspend_count_ptr) {
SHIM_SET_MEM_32(suspend_count_ptr, suspend_count);
}
}
SHIM_SET_RETURN(result);
}
uint32_t xeKeSetAffinityThread(void* thread_ptr, uint32_t affinity) {
KernelState* state = shared_kernel_state_;
XEASSERTNOTNULL(state);
@@ -987,6 +1027,7 @@ void xe::kernel::xboxkrnl::RegisterThreadingExports(
SHIM_SET_MAPPING("xboxkrnl.exe", ExTerminateThread, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtResumeThread, state);
SHIM_SET_MAPPING("xboxkrnl.exe", KeResumeThread, state);
SHIM_SET_MAPPING("xboxkrnl.exe", NtSuspendThread, state);
SHIM_SET_MAPPING("xboxkrnl.exe", KeSetAffinityThread, state);
SHIM_SET_MAPPING("xboxkrnl.exe", KeSetBasePriorityThread, state);