Fix registry unicode and enhance syscall exception logging (#644)

This commit is contained in:
Maurice Heumann
2025-12-30 17:58:12 +01:00
committed by GitHub
2 changed files with 9 additions and 4 deletions

View File

@@ -5,6 +5,7 @@
#include <algorithm>
#include <utils/container.hpp>
#include <platform/unicode.hpp>
struct hive_value
{
@@ -111,7 +112,7 @@ class hive_parser
return nullptr;
}
current_key = current_key->get_sub_key(this->file_, key_part.string());
current_key = current_key->get_sub_key(this->file_, u16_to_u8(key_part.u16string()));
}
return current_key;

View File

@@ -68,6 +68,9 @@ void syscall_dispatcher::dispatch(windows_emulator& win_emu)
const auto raw_syscall_id = emu.reg<uint32_t>(x86_register::eax);
const auto syscall_id = raw_syscall_id & 0xFFFF; // Only take low bits for WOW64 compatibility
const auto entry = this->handlers_.find(syscall_id);
const auto* syscall_name = (entry != this->handlers_.end()) ? entry->second.name.c_str() : "<unknown>";
const syscall_context c{
.win_emu = win_emu,
.emu = emu,
@@ -77,7 +80,6 @@ void syscall_dispatcher::dispatch(windows_emulator& win_emu)
try
{
const auto entry = this->handlers_.find(syscall_id);
if (entry == this->handlers_.end())
{
win_emu.log.error("Unknown syscall: 0x%X (raw: 0x%X)\n", syscall_id, raw_syscall_id);
@@ -106,13 +108,15 @@ void syscall_dispatcher::dispatch(windows_emulator& win_emu)
}
catch (std::exception& e)
{
win_emu.log.error("Syscall threw an exception: %X (raw: %X) (0x%" PRIx64 ") - %s\n", syscall_id, raw_syscall_id, address, e.what());
win_emu.log.error("Syscall %s threw an exception: 0x%X (raw: 0x%X) (0x%" PRIx64 ") - %s\n", syscall_name, syscall_id,
raw_syscall_id, address, e.what());
emu.reg<uint64_t>(x86_register::rax, STATUS_UNSUCCESSFUL);
emu.stop();
}
catch (...)
{
win_emu.log.error("Syscall threw an unknown exception: %X (raw: %X) (0x%" PRIx64 ")\n", syscall_id, raw_syscall_id, address);
win_emu.log.error("Syscall %s threw an unknown exception: 0x%X (raw: 0x%X) (0x%" PRIx64 ")\n", syscall_name, syscall_id,
raw_syscall_id, address);
emu.reg<uint64_t>(x86_register::rax, STATUS_UNSUCCESSFUL);
emu.stop();
}