From ddcef7c94974583a0d2984470e9e16c2748e3a49 Mon Sep 17 00:00:00 2001 From: Calle Svensson Date: Sun, 9 Jan 2022 21:44:45 +0100 Subject: [PATCH 1/2] Add missing include --- sc_hook.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sc_hook.cpp b/sc_hook.cpp index c33cc66..09cbbbf 100644 --- a/sc_hook.cpp +++ b/sc_hook.cpp @@ -1,4 +1,5 @@ #include +#include #include "codegen.h" #include "x86dec.h" From 168d11ceba7d1e05d1eacaaf5c490af5b98fbd18 Mon Sep 17 00:00:00 2001 From: Calle Svensson Date: Sun, 9 Jan 2022 23:27:03 +0100 Subject: [PATCH 2/2] Fix console attach --- main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index a4913fb..56cbca0 100644 --- a/main.cpp +++ b/main.cpp @@ -1028,11 +1028,12 @@ int main(int argc, const char** argv) { try { - output_handle = GetStdHandle(STD_OUTPUT_HANDLE); - if (is_injected) { - AttachConsole(ATTACH_PARENT_PROCESS); + if(!AttachConsole(ATTACH_PARENT_PROCESS)) { + fatal_error("failed to attach to parent"); + } + output_handle = GetStdHandle(STD_OUTPUT_HANDLE); log("attached\n"); @@ -1066,6 +1067,7 @@ int main(int argc, const char** argv) { ExitThread(0); } else { + output_handle = GetStdHandle(STD_OUTPUT_HANDLE); int r = parse_args(argc, argv); if (r) return r;