-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error 0x800700c1 when launching pwsh.exe #11717
Comments
I fixed this on my machine by killing the bad c:\users\Kevin file, so I'm not facing this issue right now. |
Could you clarify- the commandline
did you set that as the commandline in your profile, or are you using one of the dynamically generated
I suspect that implies that the Terminal did know that the exe was at that full path, but CreateProcess still decided to use |
The command line was dynamically generated by Terminal |
@kkostrzewa-coupa did you install PS7 manually? When adding PS7 from Microsoft Store this is what's being automatically inserted in
Tested on Win10 & WT Preview 1.12.2931.0 |
Interestingly, this is the same as what happens when you have a file called |
@elsaco I believe I installed from the Microsoft store. Regardless, I think the core issue (weirdness around space in path) is still a problem. |
CreateProcess, when given a string that doesn't contain quotes indicating the executable, is documented to probe and guess where the executable really is: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa Applications are supposed to use quotes so CreateProcess doesn't guess, partly because if it does guess it's possibly a vulnerability. It'd actually be nice to be able to globally disable this guessing behavior to preemptively flush out this class of bug. |
@malxau from my read of that doc, the guessing occurs when lpApplicationName is NULL. Can lpApplicationName be set to the string in the Terminal Command Line? |
I'd suspect no, since people could have a commandline like Presumably though, there's a way we could construct the commandline for the powershell profiles such that they'd be resistant to that. Maybe just wrapping them up in another layer of quotes? |
Ensures the PowerShell Core profile's commandline is quoted. This allows the profile to work correctly if there are files in place on the machine (e.g. one called `C:\Program`) that prevent `CreateProcess()` from invoking the un-quoted commandline. ## Validation Steps Performed Created a file called `C:\Program` and opened the PowerShell profile in terminal. Closes #11717
Ensures the PowerShell Core profile's commandline is quoted. This allows the profile to work correctly if there are files in place on the machine (e.g. one called `C:\Program`) that prevent `CreateProcess()` from invoking the un-quoted commandline. ## Validation Steps Performed Created a file called `C:\Program` and opened the PowerShell profile in terminal. Closes #11717 (cherry picked from commit 4930508)
🎉This issue was addressed in #12086, which has now been successfully released as Handy links: |
Windows Terminal version (or Windows build number)
1.11.2921.0
Other Software
pwsh.exe 7.2.0
Steps to reproduce
my terminal has C:\Users\Kevin Kostrzewa\AppData\Local\Microsoft\WindowsApps\Microsoft.PowerShell_8wekyb3d8bbwe\pwsh.exe in the Powershell profile (note the space between Kevin and *Kostrzewa()
Installing Visual Studio 2022 created a file called c:\users\Kevin to be created, containing some installation logs.
Terminal failed to launch pwsh.exe after, presumably because of the space in the terminal profile around powershell. I think this is related to #7195
Expected Behavior
pwsh.exe to launch
NOTE: I think Terminal could be more resilient around pathing and launching the .exe so a file can't be injected ahead of it with clever space filled pathing. This may be a security issue, if c:\users\Kevin was attempted to be CreateProcess'ed.
Actual Behavior
[error 0x800700c1 when launching `C:\Users\Kevin Kostrzewa\AppData\Local\Microsoft\WindowsApps\Microsoft.PowerShell_8wekyb3d8bbwe\pwsh.exe']
The text was updated successfully, but these errors were encountered: