diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-12-03 11:45:01 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-03 11:45:01 -0500 |
| commit | da6be80f18014a3972eedf05099cd0066e9eae04 (patch) | |
| tree | 687cb3853e1794b9478ee2a7b0503590f00f4669 /source/core/windows | |
| parent | f4b86ff23c825f5e776a401f89302bfcd358aae8 (diff) | |
Split out ExecutableLocation (#2041)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Split out ExecutableLocation.
* Fixes for changes to ExecutableLocation.
* Fix issues around Process on windows.
* Improve comments. Kick CI.
Diffstat (limited to 'source/core/windows')
| -rw-r--r-- | source/core/windows/slang-win-process.cpp | 18 |
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( |
