From d3bc68d6a56fd9dea0e88769c41781fae6501016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Gr=C3=BCssing?= Date: Thu, 11 Jun 2026 10:05:12 +0200 Subject: [PATCH] Fix SpawnHelper: rename pipeName param to portStr, fix taskName pipeName[^8..] crashed for 5-char port strings (e.g. "54321"). Now uses port number directly as task name suffix. Co-Authored-By: Claude Sonnet 4.6 --- agent-cs/Services/RtcService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agent-cs/Services/RtcService.cs b/agent-cs/Services/RtcService.cs index d024faf..5a18ae4 100644 --- a/agent-cs/Services/RtcService.cs +++ b/agent-cs/Services/RtcService.cs @@ -160,7 +160,7 @@ public class RtcService AgentWorker.Log("RDP: Frame-Loop beendet"); } - private static bool SpawnCaptureHelper(string exePath, string pipeName) + private static bool SpawnCaptureHelper(string exePath, string portStr) { try { @@ -171,7 +171,7 @@ public class RtcService return false; } - var taskName = $"ITNexus-RDP-{pipeName[^8..]}"; + var taskName = $"ITNexus-RDP-{portStr}"; Process.Start(new ProcessStartInfo("schtasks.exe", $"/delete /tn \"{taskName}\" /f") { CreateNoWindow = true })?.WaitForExit(); @@ -181,7 +181,7 @@ public class RtcService ? "/ru \"INTERACTIVE\"" : $"/ru \"{fullUser}\""; - var args = $"/create /tn \"{taskName}\" /tr \"\\\"{exePath}\\\" --rdp-capture {pipeName}\" " + + var args = $"/create /tn \"{taskName}\" /tr \"\\\"{exePath}\\\" --rdp-capture {portStr}\" " + $"/sc ONCE /st {triggerTime} {ruArg} /it /f"; var p = Process.Start(new ProcessStartInfo("schtasks.exe", args)