From 3d6e7d5b322bb67fac4e3e2933c13fc4aa68609d Mon Sep 17 00:00:00 2001 From: WiredSpast <74211155+WiredSpast@users.noreply.github.com> Date: Sun, 10 Apr 2022 13:57:20 +0200 Subject: [PATCH] Fix for certificatePath which includes spaces --- .../connection/proxy/nitro/os/windows/NitroWindows.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/os/windows/NitroWindows.java b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/os/windows/NitroWindows.java index c5f4655..ec55105 100644 --- a/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/os/windows/NitroWindows.java +++ b/G-Earth/src/main/java/gearth/protocol/connection/proxy/nitro/os/windows/NitroWindows.java @@ -25,7 +25,7 @@ public class NitroWindows implements NitroOsFunctions { @Override public boolean isRootCertificateTrusted(File certificate) { try { - final String output = RuntimeUtil.getCommandOutput(new String[] {"cmd", "/c", " certutil.exe -f -verify " + certificate.getAbsolutePath()}); + final String output = RuntimeUtil.getCommandOutput(new String[] {"cmd", "/c", " certutil.exe -f -verify \"" + certificate.getAbsolutePath() + "\""}); return !output.contains("CERT_TRUST_IS_UNTRUSTED_ROOT") && output.contains("dwInfoStatus=10c dwErrorStatus=0"); @@ -41,7 +41,7 @@ public class NitroWindows implements NitroOsFunctions { final String certificatePath = certificate.getAbsolutePath(); // Prompt UAC elevation. - WinDef.HINSTANCE result = NitroWindowsShell32.INSTANCE.ShellExecuteA(null, "runas", "cmd.exe", "/S /C \"certutil -addstore root " + certificatePath + "\"", null, 1); + WinDef.HINSTANCE result = NitroWindowsShell32.INSTANCE.ShellExecuteA(null, "runas", "cmd.exe", "/S /C 'certutil -addstore root \"" + certificatePath + "\"'", null, 1); // Wait for exit. Kernel32.INSTANCE.WaitForSingleObject(result, WinBase.INFINITE);