some refactoring with optional_function

- wrapped std::function into utils::optional_function
-- cleaned the code accordingly in windows_emulator
- using the 'emulator'/'windows_emulator' dependency implies the emulator_common as well.
This commit is contained in:
Elias Bachaalany
2025-01-21 19:25:51 -08:00
parent eb613b2214
commit 5bf325c77f
7 changed files with 66 additions and 47 deletions

View File

@@ -1141,30 +1141,3 @@ void windows_emulator::restore_snapshot()
this->process_.deserialize(deserializer);
// this->process_ = *this->process_snapshot_;
}
void windows_emulator::on_stdout(const std::string_view data) const
{
if (this->callbacks_.stdout_callback)
{
this->callbacks_.stdout_callback(data);
}
}
void windows_emulator::on_inline_syscall(uint32_t syscall_id, const x64_emulator::pointer_type address,
const std::string_view mod_name, const std::string_view name)
{
if (this->callbacks_.inline_syscall)
{
this->callbacks_.inline_syscall(syscall_id, address, mod_name, name);
}
}
void windows_emulator::on_outofline_syscall(uint32_t syscall_id, x64_emulator::pointer_type address,
std::string_view mod_name, std::string_view syscall_name,
x64_emulator::pointer_type prev_address, std::string_view prev_mod_name)
{
if (this->callbacks_.outofline_syscall)
{
this->callbacks_.outofline_syscall(syscall_id, address, mod_name, syscall_name, prev_address, prev_mod_name);
}
}