From 631fb583d753caeac27a5aade469115f92e06bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Wed, 29 Apr 2020 18:15:50 +0200 Subject: [PATCH] SEBWIN-392: Forgot to actually use the arguments of a whitelisted application. --- .../ExternalApplication.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SafeExamBrowser.Applications/ExternalApplication.cs b/SafeExamBrowser.Applications/ExternalApplication.cs index a54a43a2..3f44da7b 100644 --- a/SafeExamBrowser.Applications/ExternalApplication.cs +++ b/SafeExamBrowser.Applications/ExternalApplication.cs @@ -80,7 +80,7 @@ namespace SafeExamBrowser.Applications try { logger.Info("Starting application..."); - InitializeInstance(processFactory.StartNew(executablePath)); + InitializeInstance(processFactory.StartNew(executablePath, BuildArguments())); logger.Info("Successfully started application."); } catch (Exception e) @@ -89,6 +89,18 @@ namespace SafeExamBrowser.Applications } } + private string[] BuildArguments() + { + var arguments = new List(); + + foreach (var argument in settings.Arguments) + { + arguments.Add(Environment.ExpandEnvironmentVariables(argument)); + } + + return arguments.ToArray(); + } + public void Terminate() { applicationMonitor.InstanceStarted -= ApplicationMonitor_InstanceStarted;