mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-18 19:23:56 +00:00
Log message box strings
This commit is contained in:
@@ -308,6 +308,27 @@ class emulator_allocator
|
||||
uint64_t active_address_{0};
|
||||
};
|
||||
|
||||
template <typename Element>
|
||||
std::basic_string<Element> read_string(memory_manager& mem, const uint64_t address)
|
||||
{
|
||||
std::basic_string<Element> result{};
|
||||
|
||||
for (size_t i = 0;; ++i)
|
||||
{
|
||||
Element element{};
|
||||
mem.read_memory(address + (i * sizeof(element)), &element, sizeof(element));
|
||||
|
||||
if (!element)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
result.push_back(element);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline std::u16string read_unicode_string(const emulator& emu, const UNICODE_STRING<EmulatorTraits<Emu64>> ucs)
|
||||
{
|
||||
static_assert(offsetof(UNICODE_STRING<EmulatorTraits<Emu64>>, Length) == 0);
|
||||
|
||||
@@ -394,6 +394,16 @@ void windows_emulator::on_instruction_execution(const uint64_t address)
|
||||
log.print(is_interesting_call ? color::yellow : color::dark_gray,
|
||||
"Executing function: %s - %s (0x%" PRIx64 ") via (0x%" PRIx64 ") %s\n", binary->name.c_str(),
|
||||
export_entry->second.c_str(), address, return_address, mod_name);
|
||||
|
||||
if (export_entry->second == "MessageBoxW")
|
||||
{
|
||||
log.log("--> %s\n",
|
||||
u16_to_u8(read_string<char16_t>(this->memory, this->emu().reg(x64_register::rdx))).c_str());
|
||||
}
|
||||
else if (export_entry->second == "MessageBoxA")
|
||||
{
|
||||
log.log("--> %s\n", read_string<char>(this->memory, this->emu().reg(x64_register::rdx)).c_str());
|
||||
}
|
||||
}
|
||||
else if (address == binary->entry_point)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user