summaryrefslogtreecommitdiffstats
path: root/source/core/windows/slang-win-process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/windows/slang-win-process.cpp')
-rw-r--r--source/core/windows/slang-win-process.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/source/core/windows/slang-win-process.cpp b/source/core/windows/slang-win-process.cpp
index e0e38f2d4..215904938 100644
--- a/source/core/windows/slang-win-process.cpp
+++ b/source/core/windows/slang-win-process.cpp
@@ -453,12 +453,12 @@ void WinProcess::kill(int32_t returnCode)
OSString pathBuffer;
LPCWSTR path = nullptr;
- if (commandLine.m_executableType == CommandLine::ExecutableType::Path)
+ const auto& exe = commandLine.m_executableLocation;
+ if (exe.m_type == ExecutableLocation::Type::Path)
{
- StringBuilder cmd;
- StringEscapeUtil::appendMaybeQuoted(getEscapeHandler(), commandLine.m_executable.getUnownedSlice(), cmd);
-
- pathBuffer = cmd.toWString();
+ // If it 'Path' specified we pass in as the lpApplicationName to limit
+ // searching.
+ pathBuffer = exe.m_pathOrName.toWString();
path = pathBuffer.begin();
}
@@ -479,6 +479,14 @@ void WinProcess::kill(int32_t returnCode)
createFlags |= CREATE_SUSPENDED;
}
+ // From docs:
+ // If both lpApplicationName and lpCommandLine are non-NULL, the null-terminated string pointed to by lpApplicationName
+ // specifies the module to execute, and the null-terminated string pointed to by lpCommandLine specifies the command line.
+
+ // JS:
+ // Somewhat confusingly this means that even if lpApplicationName is specified, it muse *ALSO* be included as the first
+ // whitespace delimited arg must *also* be the (possibly) quoted executable
+
// https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-createprocessa
// `CreateProcess` requires write access to this, for some reason...
BOOL success = CreateProcessW(