Open leftspace89 opened 19 hours ago
uh, yeah, looks like i fucked up 😂 feel free to open up a PR :D
you got this :) also out ouf topic but is it possible to run dllmain with reserved arg. I'm more interested with emulating dll not just an executable.
i don't see any code related which runs dllmain with correct args.
const auto main_thread_id = context.create_thread(emu, context.executable->entry_point, 0, 0); switch_to_thread(*this, main_thread_id);
you got this :) also out ouf topic but is it possible to run dllmain with reserved arg. I'm more interested with emulating dll not just an executable.
i don't see any code related which runs dllmain with correct args.
const auto main_thread_id = context.create_thread(emu, context.executable->entry_point, 0, 0); switch_to_thread(*this, main_thread_id);
DllMain is never called explicitly from the emulator, because ntdll runs DllMain. There is a lot more involved than just calling it, e.g. you need to setup TLS.
This emulator only supports emulating entire processes. If you want to emulate a Dll, I recommend integrating it somewhere. You can e.g. use rundll32.exe, or build your own host application that just calls LoadLibrary and emulate that, which will eventually emulate your Dll
https://github.com/momo5502/emulator/blob/main/src/windows-emulator/memory_utils.hpp#L38
I'm not sure if this was intended or bug but i had to change to this.
case PAGE_EXECUTE_READWRITE: return memory_permission::all;