mirror of
https://github.com/qilingframework/qiling.git
synced 2026-10-12 02:21:40 +00:00
Reset emu state after a failing DllMain
call_dll_entrypoint() caught the DllMain UcError and restored registers but left ql._state at STARTED, since emu_start() only clears it on success. The 'emu_state is not STARTED' gate then silently skipped DllMain for every DLL loaded afterward. Reset the state to STOPPED on the exception path.
This commit is contained in:
@@ -462,6 +462,10 @@ class Process:
|
||||
self.ql.log.error(f'Error encountered while running {dll_name} DllMain, bailing')
|
||||
|
||||
self.ql.arch.regs.restore(regs_state)
|
||||
|
||||
# emu_start leaves the state at STARTED when it raises; reset it so a single
|
||||
# failing DllMain does not gate every subsequently loaded DLL's entry point.
|
||||
self.ql._state = QL_STATE.STOPPED
|
||||
else:
|
||||
fcall.cc.unwind(len(args))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user