diff --git a/src/windows-emulator/syscalls.cpp b/src/windows-emulator/syscalls.cpp index 0c4ca618..b4e030e5 100644 --- a/src/windows-emulator/syscalls.cpp +++ b/src/windows-emulator/syscalls.cpp @@ -1347,9 +1347,13 @@ namespace const uint32_t thread_information_length, const emulator_object return_length) { - if (thread_handle != CURRENT_THREAD) + const auto* thread = thread_handle == CURRENT_THREAD + ? c.proc.active_thread + : c.proc.threads.get(thread_handle); + + if (!thread) { - return STATUS_NOT_SUPPORTED; + return STATUS_INVALID_HANDLE; } if (info_class == ThreadBasicInformation) @@ -1367,8 +1371,8 @@ namespace const emulator_object info{c.emu, thread_information}; info.access([&](THREAD_BASIC_INFORMATION& i) { - i.TebBaseAddress = c.win_emu.current_thread().teb->ptr(); - i.ClientId = c.win_emu.current_thread().teb->read().ClientId; + i.TebBaseAddress = thread->teb->ptr(); + i.ClientId = thread->teb->read().ClientId; }); return STATUS_SUCCESS; @@ -1392,6 +1396,24 @@ namespace return STATUS_SUCCESS; } + if (info_class == ThreadQuerySetWin32StartAddress) + { + if (return_length) + { + return_length.write(sizeof(ULONG_PTR)); + } + + if (thread_information_length != sizeof(ULONG_PTR)) + { + return STATUS_BUFFER_OVERFLOW; + } + + const emulator_object info{c.emu, thread_information}; + info.write(thread->start_address); + + return STATUS_SUCCESS; + } + printf("Unsupported thread query info class: %X\n", info_class); c.emu.stop();