From f55c897d42e81600a94cc74fe7cc780648c59b05 Mon Sep 17 00:00:00 2001 From: Luna <44528100+pozm@users.noreply.github.com> Date: Sat, 27 Aug 2022 01:04:14 +0100 Subject: [PATCH] console stuff --- godot_dump/dllmain.cpp | 16 +++++++++------- godot_dump/godot_dump.vcxproj | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/godot_dump/dllmain.cpp b/godot_dump/dllmain.cpp index 900a601..598528b 100644 --- a/godot_dump/dllmain.cpp +++ b/godot_dump/dllmain.cpp @@ -47,8 +47,6 @@ char* ScanInternal(char* pattern,char * mask, char* begin, intptr_t size) return match; } - - void* find_rel_addr(char* nextins,uint32_t offset) { char* mod = (char*)GetModuleHandleA(nullptr); auto parta = (nextins - mod) + offset; @@ -64,8 +62,9 @@ void* find_rel_addr_lea(char* nextins, char* offset) { void main_thread() { AllocConsole(); - freopen_s((FILE**)stdout,"CONOUT$", "w", (FILE*)stdout); - freopen_s((FILE**)stdin,"CONIN$", "w", (FILE*)stdin); + FILE* f; + freopen_s(&f,"CONOUT$", "w", (FILE*)stdout); + freopen_s(&f,"CONIN$", "r", (FILE*)stdin); auto pog1 = GetModuleHandleA(nullptr); @@ -115,8 +114,10 @@ void main_thread() { std::cout << std::hex << (int) secretKey[i]; } std::cout << std::dec << ";" << std::endl; - std::cin.get(); + std::cout << "ok you can close me without killing main process now"; + fclose(f); + FreeConsole(); } BOOL APIENTRY DllMain( HMODULE hModule, @@ -127,8 +128,9 @@ BOOL APIENTRY DllMain( HMODULE hModule, switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: { - std::thread pog(main_thread); - pog.detach(); + std::thread mt(main_thread); + //main_thread(); + mt.detach(); } case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: diff --git a/godot_dump/godot_dump.vcxproj b/godot_dump/godot_dump.vcxproj index 8cd42a8..e332a1a 100644 --- a/godot_dump/godot_dump.vcxproj +++ b/godot_dump/godot_dump.vcxproj @@ -112,7 +112,7 @@ true Use pch.h - stdcpp20 + stdcpp17 Windows