diff --git a/src/analyzer/main.cpp b/src/analyzer/main.cpp index ec1e2a00..1ecdf4d2 100644 --- a/src/analyzer/main.cpp +++ b/src/analyzer/main.cpp @@ -12,6 +12,7 @@ namespace bool use_gdb{false}; bool concise_logging{false}; bool verbose_logging{false}; + bool silent{false}; std::string registry_path{"./registry"}; std::string emulation_root{}; }; @@ -113,6 +114,7 @@ namespace .emulation_root = options.emulation_root, .arguments = parse_arguments(args), .verbose_calls = options.verbose_logging, + .disable_logging = options.silent, .silent_until_main = options.concise_logging, }; @@ -122,6 +124,14 @@ namespace watch_system_objects(win_emu, options.concise_logging); win_emu.buffer_stdout = true; + if (options.silent) + { + win_emu.buffer_stdout = false; + win_emu.callbacks().stdout_callback = [](const std::string_view data) { + (void)fwrite(data.data(), 1, data.size(), stdout); + }; + } + const auto& exe = *win_emu.process().executable; const auto concise_logging = options.concise_logging; @@ -204,6 +214,10 @@ namespace { options.use_gdb = true; } + else if (arg == "-s") + { + options.silent = true; + } else if (arg == "-v") { options.verbose_logging = true; diff --git a/src/common/utils/function.hpp b/src/common/utils/function.hpp index f7905232..242e9e08 100644 --- a/src/common/utils/function.hpp +++ b/src/common/utils/function.hpp @@ -33,6 +33,13 @@ namespace utils return *this; } + template + requires(!std::is_same_v, std::function>) + optional_function& operator=(T&& t) + { + return this->operator=(std::function(std::forward(t))); + } + Ret operator()(Args... args) const { if (func)