From 66ed9adcda59f3d87e2f97ab0678f4464455b58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 11 Jan 2023 22:14:47 +0800 Subject: [PATCH] TerminalShell: support ConEmu version detection --- src/detection/terminalshell/terminalshell.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 818e7d640..6965ae0a3 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -205,6 +205,16 @@ static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version) return getFileVersion(exe->chars, version); } +static bool getTerminalVersionConEmu(FFstrbuf* exe, FFstrbuf* version) +{ + ffStrbufSetS(version, getenv("ConEmuBuild")); + + if(version->length) + return true; + + return getFileVersion(exe->chars, version); +} + #endif bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe, FFstrbuf* version) @@ -237,6 +247,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufIgnCaseEqualS(processName, "WindowsTerminal.exe")) return getTerminalVersionWindowsTerminal(exe, version); + if(ffStrbufStartsWithIgnCaseS(processName, "ConEmuC")) + return getTerminalVersionConEmu(exe, version); + #endif #ifndef _WIN32