From 5c88b7ebe4fbd5cf0acbb7cfdc424f0c61b87b6c Mon Sep 17 00:00:00 2001 From: icex2 Date: Sun, 19 Feb 2023 15:40:12 +0100 Subject: [PATCH 1/4] Add .DS_Store to .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 02dfb39..2d0dbd0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ build/ .idea .vscode .vs -version \ No newline at end of file +version +.DS_Store -- 2.54.0 From 7f0c7dfffa2fb5a1515d780f8695866ee3a986be Mon Sep 17 00:00:00 2001 From: icex2 Date: Sun, 19 Feb 2023 15:40:36 +0100 Subject: [PATCH 2/4] Bugfix util/proc: Forward exit code to TerminateProcess --- src/main/util/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/util/proc.c b/src/main/util/proc.c index eb2100e..8a3d518 100644 --- a/src/main/util/proc.c +++ b/src/main/util/proc.c @@ -11,5 +11,5 @@ void proc_terminate_current_process(uint32_t exit_code) TRUE, GetCurrentProcessId()); - TerminateProcess(hnd, 0); + TerminateProcess(hnd, exit_code); } \ No newline at end of file -- 2.54.0 From 9d6f9ad049f71207f5d759f180a845cc0f3acf9b Mon Sep 17 00:00:00 2001 From: icex2 Date: Sun, 19 Feb 2023 15:40:58 +0100 Subject: [PATCH 3/4] Bugfix inject: Handle process exit event correctly When the process requests to exit, the debugger thread attached from inject swallowed that event simply without taking action of actually terminating the process. Handle this accordingly when the debugger loop is running and terminate the process --- src/main/inject/debugger.c | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/main/inject/debugger.c b/src/main/inject/debugger.c index f42f774..536728d 100644 --- a/src/main/inject/debugger.c +++ b/src/main/inject/debugger.c @@ -13,6 +13,7 @@ #include "util/log.h" #include "util/mem.h" +#include "util/proc.h" #include "util/signal.h" #include "util/str.h" @@ -246,7 +247,7 @@ static bool debugger_create_process( return true; } -static bool debugger_loop() +static uint32_t debugger_loop() { DEBUG_EVENT de; DWORD continue_status; @@ -259,7 +260,7 @@ static bool debugger_loop() log_warning( "ERROR: WaitForDebugEvent failed: %08x", (unsigned int) GetLastError()); - return false; + return 1; } // Changed if applicable, e.g. on exceptions @@ -326,7 +327,7 @@ static bool debugger_loop() "EXIT_PROCESS_DEBUG_EVENT(pid %ld, tid %ld)", de.dwProcessId, de.dwThreadId); - return true; + return 0; case LOAD_DLL_DEBUG_EVENT: if (!debugger_get_file_name_from_handle( @@ -377,13 +378,15 @@ static bool debugger_loop() log_warning( "ERROR: ContinueDebugEvent failed: %08x", (unsigned int) GetLastError()); - return false; + return 1; } } } static DWORD WINAPI debugger_proc(LPVOID param) { + uint32_t debugger_loop_exit_code; + struct debugger_thread_params *params; params = (struct debugger_thread_params *) param; @@ -401,14 +404,24 @@ static DWORD WINAPI debugger_proc(LPVOID param) // Don't run our local debugger loop if the user wants to attach a remote // debugger or debugger is disabled if (params->local_debugger) { - debugger_loop(); + debugger_loop_exit_code = debugger_loop(); + + free(params); + + log_misc("Debugger loop quit"); + log_info("Terminating process, exit code: %d", debugger_loop_exit_code); + + proc_terminate_current_process(debugger_loop_exit_code); + + // Never reached + return 0; + } else { + free(params); + + log_misc("Debugger thread end"); + + return 0; } - - free(params); - - log_misc("Debugger thread end"); - - return 0; } bool debugger_init(bool local_debugger, const char *app_name, char *cmd_line) -- 2.54.0 From 520c0ff213b58dde6b235bb33b43317d47c01027 Mon Sep 17 00:00:00 2001 From: icex2 Date: Sun, 19 Feb 2023 23:26:50 +0100 Subject: [PATCH 4/4] dist/iidx27: Align disabled cam connection with 28 and 29 The default should be targeting emulation on a "normal desktop pc". The default confits for 28 and 29 refeclt that already, but it seems that 27 was missed out here. --- dist/iidx/iidxhook-27.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/iidx/iidxhook-27.conf b/dist/iidx/iidxhook-27.conf index 42f0709..b977db9 100644 --- a/dist/iidx/iidxhook-27.conf +++ b/dist/iidx/iidxhook-27.conf @@ -11,7 +11,7 @@ io.disable_poll_limiter=false io.lightning_mode=false # Disable camera connection -io.disable_cams=false +io.disable_cams=true # Disables the built in file hooks, requiring manual file creation io.disable_file_hooks=false -- 2.54.0