From c873aa4c4ee122170103984f1fd1172d694fcfed Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 13 Sep 2025 21:35:39 -0400 Subject: [PATCH] [idd] helper: use separate log for child process --- idd/LGIddHelper/main.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/idd/LGIddHelper/main.cpp b/idd/LGIddHelper/main.cpp index 3c06d338..0ef50d5f 100644 --- a/idd/LGIddHelper/main.cpp +++ b/idd/LGIddHelper/main.cpp @@ -34,9 +34,6 @@ static void Launch(); int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd) { - g_debug.Init("looking-glass-iddhelper"); - DEBUG_INFO("Looking Glass IDD Helper (" LG_VERSION_STR ")"); - wchar_t buffer[MAX_PATH]; DWORD result = GetModuleFileName(NULL, buffer, MAX_PATH); if (result == 0) @@ -56,18 +53,19 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ if (argc == 1) { + g_debug.Init("looking-glass-idd-service"); + DEBUG_INFO("Looking Glass IDD Helper Service (" LG_VERSION_STR ")"); if (!HandleService()) return EXIT_FAILURE; return EXIT_SUCCESS; } - // child process if (argc != 2) - { - // the one and only value we should see is the exit event name - DEBUG_ERROR("Invalid invocation"); return EXIT_FAILURE; - } + + // child process + g_debug.Init("looking-glass-idd-helper"); + DEBUG_INFO("Looking Glass IDD Helper Process (" LG_VERSION_STR ")"); l_exitEvent.Attach(OpenEvent(SYNCHRONIZE, FALSE, args[1].c_str())); if (!l_exitEvent.IsValid()) @@ -117,8 +115,9 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ case WAIT_FAILED: DEBUG_ERROR_HR(GetLastError(), "MsgWaitForMultipleObjects Failed"); - goto exit; - } + g_pipe.DeInit(); + return EXIT_FAILURE; + } } exit: