mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-11 08:36:16 +00:00
Fix registry unicode and enhance syscall exception logging (#644)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user