From aa763c8392f3b943efc1afdeda617ba85ed7d474 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 1 Jun 2025 14:02:36 +0200 Subject: [PATCH] Prepare more timer syscalls --- src/windows-emulator/emulator_thread.cpp | 4 ++++ src/windows-emulator/syscalls.cpp | 3 +++ src/windows-emulator/syscalls/object.cpp | 1 + src/windows-emulator/syscalls/timer.cpp | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/src/windows-emulator/emulator_thread.cpp b/src/windows-emulator/emulator_thread.cpp index e3628706..8f1b3fd6 100644 --- a/src/windows-emulator/emulator_thread.cpp +++ b/src/windows-emulator/emulator_thread.cpp @@ -58,6 +58,10 @@ namespace return !e || e->try_lock(current_thread_id); } + case handle_types::timer: { + return true; // TODO + } + case handle_types::semaphore: { auto* s = c.semaphores.get(h); if (s) diff --git a/src/windows-emulator/syscalls.cpp b/src/windows-emulator/syscalls.cpp index b8e5ec76..971fc5b0 100644 --- a/src/windows-emulator/syscalls.cpp +++ b/src/windows-emulator/syscalls.cpp @@ -361,6 +361,8 @@ namespace syscalls NTSTATUS handle_NtCreateTimer2(const syscall_context& c, emulator_object timer_handle, uint64_t reserved, emulator_object>> object_attributes, ULONG attributes, ACCESS_MASK desired_access); + NTSTATUS handle_NtSetTimerEx(const syscall_context& c, handle timer_handle, uint32_t timer_set_info_class, + uint64_t timer_set_information, ULONG timer_set_information_length); // syscalls/token.cpp: NTSTATUS @@ -1104,6 +1106,7 @@ void syscall_dispatcher::add_handlers(std::map& ha add_handler(NtUserSetCursor); add_handler(NtOpenMutant); add_handler(NtCreateTimer2); + add_handler(NtSetTimerEx); #undef add_handler } diff --git a/src/windows-emulator/syscalls/object.cpp b/src/windows-emulator/syscalls/object.cpp index ae7c134c..db66de02 100644 --- a/src/windows-emulator/syscalls/object.cpp +++ b/src/windows-emulator/syscalls/object.cpp @@ -119,6 +119,7 @@ namespace syscalls return h.value.type == handle_types::thread // || h.value.type == handle_types::mutant // || h.value.type == handle_types::semaphore // + || h.value.type == handle_types::timer // || h.value.type == handle_types::event; } diff --git a/src/windows-emulator/syscalls/timer.cpp b/src/windows-emulator/syscalls/timer.cpp index 329a3ab2..2f683bed 100644 --- a/src/windows-emulator/syscalls/timer.cpp +++ b/src/windows-emulator/syscalls/timer.cpp @@ -69,4 +69,10 @@ namespace syscalls return STATUS_SUCCESS; } + NTSTATUS handle_NtSetTimerEx(const syscall_context& /*c*/, handle /*timer_handle*/, + uint32_t /*timer_set_info_class*/, uint64_t /*timer_set_information*/, + ULONG /*timer_set_information_length*/) + { + return STATUS_NOT_SUPPORTED; + } }