mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-10 16:16:16 +00:00
object syscalls: implement NtWaitForMultipleObjects32
This commit is contained in:
@@ -304,6 +304,44 @@ namespace syscalls
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS handle_NtWaitForMultipleObjects32(const syscall_context& c, const ULONG count, const emulator_object<uint32_t> handles,
|
||||||
|
const WAIT_TYPE wait_type, const BOOLEAN alertable,
|
||||||
|
const emulator_object<LARGE_INTEGER> timeout)
|
||||||
|
{
|
||||||
|
if (wait_type != WaitAny && wait_type != WaitAll)
|
||||||
|
{
|
||||||
|
c.win_emu.log.error("Wait type not supported!\n");
|
||||||
|
c.emu.stop();
|
||||||
|
return STATUS_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& t = c.win_emu.current_thread();
|
||||||
|
t.await_objects.clear();
|
||||||
|
t.await_any = wait_type == WaitAny;
|
||||||
|
|
||||||
|
for (ULONG i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
const auto raw_handle = handles.read(i);
|
||||||
|
const auto h = make_handle(static_cast<uint64_t>(raw_handle));
|
||||||
|
|
||||||
|
if (!is_awaitable_object_type(h))
|
||||||
|
{
|
||||||
|
c.win_emu.log.warn("Unsupported handle type for NtWaitForMultipleObjects32: %d!\n", h.value.type);
|
||||||
|
return STATUS_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
t.await_objects.push_back(h);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timeout.value() && !t.await_time.has_value())
|
||||||
|
{
|
||||||
|
t.await_time = utils::convert_delay_interval_to_time_point(c.win_emu.clock(), timeout.read());
|
||||||
|
}
|
||||||
|
|
||||||
|
c.win_emu.yield_thread(alertable);
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS handle_NtWaitForSingleObject(const syscall_context& c, const handle h, const BOOLEAN alertable,
|
NTSTATUS handle_NtWaitForSingleObject(const syscall_context& c, const handle h, const BOOLEAN alertable,
|
||||||
const emulator_object<LARGE_INTEGER> timeout)
|
const emulator_object<LARGE_INTEGER> timeout)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user