From fad1721cbacc8900c2b288d83d30dc80028335ee Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 9 Sep 2024 18:54:17 +0200 Subject: [PATCH] Better image information --- src/windows_emulator/syscalls.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/windows_emulator/syscalls.cpp b/src/windows_emulator/syscalls.cpp index fe744e7..7f2bbd2 100644 --- a/src/windows_emulator/syscalls.cpp +++ b/src/windows_emulator/syscalls.cpp @@ -490,19 +490,19 @@ namespace return STATUS_BUFFER_OVERFLOW; } - if (!is_within_start_and_length(base_address, c.proc.ntdll->image_base, c.proc.ntdll->size_of_image)) + const auto mod = c.proc.module_manager.find_by_address(base_address); + if(!mod) { - puts("Bad image request"); - c.emu.stop(); - return STATUS_NOT_SUPPORTED; + printf("Bad address for memory image request: %llX\n", base_address); + return STATUS_INVALID_ADDRESS; } const emulator_object info{c.emu, memory_information}; info.access([&](MEMORY_IMAGE_INFORMATION& image_info) { - image_info.ImageBase = reinterpret_cast(c.proc.ntdll->image_base); - image_info.SizeOfImage = c.proc.ntdll->size_of_image; + image_info.ImageBase = reinterpret_cast(mod->image_base); + image_info.SizeOfImage = mod->size_of_image; }); return STATUS_SUCCESS;