Check for null string passed to Win32Thread::set_name

Move impl of XamAlloc into XamAllocImpl
Implement XamAllocEx
Implement XamIsCurrentTitleDash
Implement XamGetLocaleDateFormat
Implement "stub" of XFileFsDeviceInformation, XFileSectorInformation (log warnings when they're executed so this doesnt get mistaken for an actual implementation)
Added xboxkrnl_memory file
Moved meat of MmAllocatePhysicalMemoryEx into xeMmAllocatePhysicalMemoryEx, exposed its definition via xboxkrnl_memory.

Moved impl of RtlImageHeaderNt into a helper function
Implement RtlImageDirectoryEntryToData
Implement KeSuspendThread
Check for bad handles passed in XOVERLAPPED, fixes crash in 415608D8
This commit is contained in:
chss95cs@gmail.com
2023-04-30 13:22:49 -04:00
parent 37051afcaf
commit b270c59d0c
10 changed files with 241 additions and 30 deletions

View File

@@ -185,7 +185,7 @@ dword_result_t NtResumeThread_entry(dword_t handle,
}
DECLARE_XBOXKRNL_EXPORT1(NtResumeThread, kThreading, kImplemented);
dword_result_t KeResumeThread_entry(lpvoid_t thread_ptr) {
dword_result_t KeResumeThread_entry(pointer_t<X_KTHREAD> thread_ptr) {
X_STATUS result = X_STATUS_SUCCESS;
auto thread = XObject::GetNativeObject<XThread>(kernel_state(), thread_ptr);
if (thread) {
@@ -230,11 +230,27 @@ dword_result_t NtSuspendThread_entry(dword_t handle,
}
DECLARE_XBOXKRNL_EXPORT1(NtSuspendThread, kThreading, kImplemented);
dword_result_t KeSuspendThread_entry(pointer_t<X_KTHREAD> kthread,
const ppc_context_t& context) {
auto thread = XObject::GetNativeObject<XThread>(context->kernel_state, kthread);
uint32_t suspend_count_out = 0;
if (thread) {
suspend_count_out = thread->suspend_count();
uint32_t discarded_new_suspend_count = 0;
thread->Suspend(&discarded_new_suspend_count);
}
return suspend_count_out;
}
DECLARE_XBOXKRNL_EXPORT1(KeSuspendThread, kThreading, kImplemented);
void KeSetCurrentStackPointers_entry(lpvoid_t stack_ptr,
pointer_t<X_KTHREAD> thread,
lpvoid_t stack_alloc_base,
lpvoid_t stack_base,
lpvoid_t stack_limit, const ppc_context_t& context) {
lpvoid_t stack_base, lpvoid_t stack_limit,
const ppc_context_t& context) {
auto current_thread = XThread::GetCurrentThread();
auto pcr = context->TranslateVirtualGPR<X_KPCR*>(context->r[13]);