From ca4b1f55928330912e35201b92d538c54c0c7e91 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 11 Aug 2020 17:42:00 +1000 Subject: [PATCH] [host] Windows: don't open the log file, instead show it's location Now that it's recommended to run LG as the `SYSTEM` user, launching an application to read the log file is dangerous as it will be launched with the same access rights (`SYSTEM`). Instead so as Microsoft recommends and only present a message box with the information. --- host/platform/Windows/src/platform.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/host/platform/Windows/src/platform.c b/host/platform/Windows/src/platform.c index 77d57510..cc9c6b06 100644 --- a/host/platform/Windows/src/platform.c +++ b/host/platform/Windows/src/platform.c @@ -119,7 +119,13 @@ LRESULT CALLBACK DummyWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (strcmp(logFile, "stderr") == 0) DEBUG_INFO("Ignoring request to open the logFile, logging to stderr"); else - ShellExecute(NULL, NULL, logFile, NULL, NULL, SW_SHOWNORMAL); + { + /* If LG is running as SYSTEM, ShellExecute would launch a process + * as the SYSTEM user also, for security we will just show the file + * location instead */ + //ShellExecute(NULL, NULL, logFile, NULL, NULL, SW_SHOWNORMAL); + MessageBoxA(hwnd, logFile, "Log File Location", MB_OK | MB_ICONINFORMATION); + } } } break;