From 4da28c63f2b82f9aa0b8b69523a5ad27b9ef4a82 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Fri, 14 Aug 2020 12:29:41 -0700 Subject: [PATCH 1/8] initial defterm spec entry. --- doc/specs/#492 - Default Terminal/spec.md | 58 +++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 doc/specs/#492 - Default Terminal/spec.md diff --git a/doc/specs/#492 - Default Terminal/spec.md b/doc/specs/#492 - Default Terminal/spec.md new file mode 100644 index 00000000000..f9954d5ec25 --- /dev/null +++ b/doc/specs/#492 - Default Terminal/spec.md @@ -0,0 +1,58 @@ +--- +author: Michael Niksa @miniksa +created on: 2020-08-14 +last updated: 2020-08-14 +issue id: #492 +--- + +# Default Terminal Choice in Windows OS + +## Abstract + +[comment]: # Outline what this spec describes + +## Inspiration + +[comment]: # What were the drivers/inspiration behind the creation of this spec. + +## Solution Design + +[comment]: # Outline the design of the solution. Feel free to include ASCII-art diagrams, etc. + +## UI/UX Design + +[comment]: # What will this fix/feature look like? How will it affect the end user? + +## Capabilities + +[comment]: # Discuss how the proposed fixes/features impact the following key considerations: + +### Accessibility + +[comment]: # How will the proposed change impact accessibility for users of screen readers, assistive input devices, etc. + +### Security + +[comment]: # How will the proposed change impact security? + +### Reliability + +[comment]: # Will the proposed change improve reliability? If not, why make the change? + +### Compatibility + +[comment]: # Will the proposed change break existing code/behaviors? If so, how, and is the breaking change "worth it"? + +### Performance, Power, and Efficiency + +## Potential Issues + +[comment]: # What are some of the things that might cause problems with the fixes/features proposed? Consider how the user might be negatively impacted. + +## Future considerations + +[comment]: # What are some of the things that the fixes/features might unlock in the future? Does the implementation of this spec enable scenarios? + +## Resources + +[comment]: # Be sure to add links to references, resources, footnotes, etc. From e85297e53b89feaa37fe8bbf02e13ef77a4155b4 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Mon, 24 Aug 2020 10:59:34 -0700 Subject: [PATCH 2/8] More drafting --- doc/specs/#492 - Default Terminal/spec.md | 87 ++++++++++++++++++++--- 1 file changed, 76 insertions(+), 11 deletions(-) diff --git a/doc/specs/#492 - Default Terminal/spec.md b/doc/specs/#492 - Default Terminal/spec.md index f9954d5ec25..e2dc6f3bdaf 100644 --- a/doc/specs/#492 - Default Terminal/spec.md +++ b/doc/specs/#492 - Default Terminal/spec.md @@ -1,7 +1,7 @@ --- author: Michael Niksa @miniksa created on: 2020-08-14 -last updated: 2020-08-14 +last updated: 2020-08-24 issue id: #492 --- @@ -9,15 +9,50 @@ issue id: #492 ## Abstract -[comment]: # Outline what this spec describes +Since the beginning, Windows has offered a single choice in default terminal hosting behavior. Specifically, the default terminal is defined as the one that the operating system will start on your behalf when a command-line application is started without a terminal attached. This specification intends to detail how we will offer customers the ultimate in choice among first and third party replacements for their default terminal experience. ## Inspiration -[comment]: # What were the drivers/inspiration behind the creation of this spec. +We've had a lot of success in the past several years on our terminal team journey. We updated the old console host user interface with long-desired features. We updated the console environment to bring Windows closer to Linux and Mac by implementing the client (receiving) end of Virtual Terminal sequences to unlock WSL, Docker, and other cross-platform command-line application compatibility. We then created the ConPTY to expose the server end of the console environment to first and third party applications to enable the hosting of any of those command-line clients within their own user interfaces by implementing the server (sending) end of Virtual Terminal sequences. And then we built Windows Terminal as our flagship implementation of the development environment on this model. + +Through all of this, the entrypoint for alternatives to the console host UX continued to be "Start your alternative terminal implementation first, then start the command-line application inside." For those familiar with Linux and Mac or for those using the broad ecosystem of alternative Windows Terminals like ConEmu, Cmder, Console2, and the like... that was natural. But Windows did it differently a long time ago allowing the starting of a command-line application directly from the shell or kernel without a terminal specified. On noticing the missing terminal, the system would just-in-time start and attach the one terminal it could count on as always present, `conhost.exe`. + +And so the inspiration of this is simple: We want to allow our customers to choose whichever terminal they want as the just-in-time terminal attached to an application without one present/specified on launch. This final move completes our journey to allow the ultimate in choice AND decouple the terminal experience from the operating system release schedule. ## Solution Design -[comment]: # Outline the design of the solution. Feel free to include ASCII-art diagrams, etc. +There are three components to the proposed design: + +1. **Inbox console**: This is the `conhost.exe` that is resident inside every Windows installation. +1. **Updated console**: This is the `openconsole.exe` that we ship with the Windows Terminal to provide a more up-to-date console server experience. +1. **Terminal UX**: This is `WindowsTerminal.exe`, the new Terminal user interface that runs on VT sequences. + +And there are a few scenarios here to consider: + +1. Replacement console API server and replacement terminal UX. + 1. This is the Windows Terminal scenario today. `OpenConsole.exe` is packed in the package to be the console API server and ConPTY environment for `WindowsTerminal.exe`. +1. Replacement console API server and legacy terminal UX. + 1. We don't explicitly distribute this today, but it's technically possible to just run `OpenConsole.exe` to accomplish this. +1. Inbox console API server and replacement terminal UX. + 1. The WSL environment does this when doing Windows interop and I believe VS Code does this too when told to use the ConPTY environment. (And since VS Code does it, anything using node-pty also does it, covering some 3rd party terminals as well). +1. Inbox console API server and inbox terminal UX. + 1. This is what we have today in `conhost.exe` running as the default application. + +The goal is to offer the ultimate in choice here where any of the components can be replaced as necessary for a 1st or 3rd party scenario. + +### Overview + +#### Inbox console + +The inbox console will be updated to support delegation of the incoming console client application connection to another console API server if one is registered and available. + +#### Updated console + +The updated replacement console will have the same console API server capabilities as the inbox console, but will be a later, updated, or customized-to-the-scenario version of the API server generally revolving around improving ConPTY support for a Terminal application. + +#### Terminal UX + +The terminal will be its own complete presentation and input solution on top of a ConPTY connection, separating the concerns between API servicing and the user experience. ## UI/UX Design @@ -25,26 +60,52 @@ issue id: #492 ## Capabilities -[comment]: # Discuss how the proposed fixes/features impact the following key considerations: - ### Accessibility -[comment]: # How will the proposed change impact accessibility for users of screen readers, assistive input devices, etc. +Accessibility applications are the most likely to resort to a method of spelunking the process tree or window handles to attempt to find content to read out. Presuming they have hardcoded rules for console-type applications, these algorithms could be surprised by the substitution of another terminal environment. + +The major players here that I am considering are NVDA, JAWS, and Narrator. As far as I am aware, all of these applications attempt to drive their interactivity through UI Automation where possible. And we have worked with all of these applications in the past in improving their support for both `conhost.exe` and the Windows Terminal product. I have relatively high confidence that we will be able to work with them again to help update these assistive products to understand the new UI delegation, if necessary. ### Security -[comment]: # How will the proposed change impact security? +Let's hit the elephant in the room. "You plan on pulling a completely different binary inside the `conhost.exe` process and just... delegating all activity to it?" Yes. + +As far as I'm concerned, the `conhost.exe` that is started to host the command-line client application is running at the same integrity level as the client binary that is partially started and waiting for its server to be ready. This is the long-standing existing protection that we have from the Windows operating system. Anything running in the same integrity level is already expected to be able to tamper with anything else at the same integrity level. The delegated binary that we would be loading into our process space will also be at the same integrity level. Nothing really stops a malicious actor from launching that binary in any other way in the same integrity level as a part of the command-line client application's startup. + +The mitigation here, if necessary, would be to use `WinVerifyTrust` to validate the certification path of the `OpenConsole.exe` binary to ensure that only one that is signed by Microsoft can be the substitute server host for the application. This doesn't stop third parties from redistributing our `OpenConsole.exe` off of GitHub if necessary with their products, but it would stop someone from introducing any random binary that met the signature interface of the delegation methods into `conhost.exe`. The only value I see this providing is stopping someone from being "tricked" into delegating their `conhost.exe` to another binary through the configuration methods we provide. It doesn't really stop someone (or an attacker) from taking ownership of the `conhost.exe` in System32 and replacing it directly. So this point might be moot. (It is expected that replacement of the System32 one is already protected, to some degree, by being owned by the SYSTEM account and requiring some measure of authority to replace.) ### Reliability -[comment]: # Will the proposed change improve reliability? If not, why make the change? +The change on its own may honestly improve reliability of the hosting system. The existing just-in-time startup of the console host application only had a single chance at initializing a user experience before it would give up and return that the command-line application could not be started. + +However, there are now several phases in the startup process that will have the opportunity to make multiple attempts at multiple versions or applications to find a suitable host for the starting application before giving up. + +One layer of this is where the `conhost.exe` baked into the operating system will be on the lookout for an `OpenConsole.exe` that will replace its server activities. The delegation binary loses a bit of reliability, theoretically, by the fact that loading another process during launch could have versioning/resolution/path/dependency issues, but it simultaneously offers us the opportunity for improved reliability by being able to service that binary quickly outside the Windows OS release cycle. Fixes can arrive in days instead of months to years. + +Another layer of this is where either `conhost.exe` or the delegated `OpenConsole.exe` server will search for a terminal user experience host, like `WindowsTerminal.exe` or another registered first or third party host, and split the responsibility of hosting the session with that binary. Again, there's a theoretical reliability loss with the additional process launch/load, but there's much to be gained by reducing the scope of what each binary must accomplish. Removing the need to handle user interaction from `conhost.exe` or `OpenConsole.exe` and delegating those activities means there is less surface area running and less chance for a UX interaction to interfere with API call servicing and vice versa. And again, having the delegation to external components means that they can be fixed on a timeline of days instead of months or years as when baked into the operating system. ### Compatibility -[comment]: # Will the proposed change break existing code/behaviors? If so, how, and is the breaking change "worth it"? +One particular scenario that this could break is an application that makes use of spelunking the process tree when a command-line application starts to identify the hosting terminal application window by HWND to inject input, extract output, or otherwise hook and bind to hosting services. As the default application UI that will launch may not have the `conhost.exe` name (for spelunking via searching processes) and the HWND located may either be the ConPTY fakeout HWND or an HWND belonging to a completely different UI, these applications might not work. + +Two considerations here: + +1. At a minimum, we must offer an opt-out of the delegation to another terminal for the default application. +1. We may also want to offer a process-name, policy, manifest, or other per client application opt-out mechanism. ### Performance, Power, and Efficiency +I expect to take some degree of performance, power, and efficiency hit by implementing this replacement default app scenario just by it's nature. We will be loading multiple processes, performing tests and branches during startup, and we will likely need to load COM/WinRT and packaging data that was not loaded prior to resolve the final state of default application load. I would expect this to accrue to some failures in the performance and power gates inside the Windows product. Additionally, the efficiency of running pretty much everything through the ConPTY is lower than just rendering it directly to `conhost.exe`'s embedded GDI-powered UI itself thanks to the multiple levels of translation and parsing that occur in this scenario. + +The mitigations to these losses are as follows: + +1. We will delay load any of the interface load and packaging data lookup libraries to only be pulled into process space should we determine that the application is non-interactive. + 1. That should save us some of the commit and power costs for the sorts of non-interactive scripts and applications that typically run early in OS startup (and leverage `conhost.exe` as their host environment). + 1. We will still likely get hit with the on-disk commit cost for the additional export libraries linked as well as additional code. That would be a by-design change. + +1. We plan to begin Profile Guided Optimization across our `OpenConsole.exe` and `WindowsTerminal.exe` binaries. This should allow us to optimize the startup paths for this scenario and bias the `OpenConsole.exe` binary that we redistribute to focus its efforts and efficiency on the ConPTY role specifically, ignoring all of the interactive Win32/GDI portions that aren't typically used. + 1. We may need to add a PGO scenario inside Windows to tune the optimization of `conhost.exe` especially if we're going to go full on Windows Terminal in the box default application. The existing PGO that occurs in the optimization branches is running on several `conhost.exe` interactive scenarios, none of which will be relevant here. We would probably want to update it to focus on the default app delegation routine AND on the non-interactive scenario for hosted applications (where delegation will not occur but Win32/GDI will still not be involved). + ## Potential Issues [comment]: # What are some of the things that might cause problems with the fixes/features proposed? Consider how the user might be negatively impacted. @@ -53,6 +114,10 @@ issue id: #492 [comment]: # What are some of the things that the fixes/features might unlock in the future? Does the implementation of this spec enable scenarios? +* We additionally would like to leave the door open to distributing updated `OpenConsole.exe`s in their own app package as a dependency that others could rely on. + * This was one of the original management requests when we were open sourcing the console product as well as the Terminal back in spring of 2019. For the sake of ongoing servicing and maintainability, it was requested that we reach a point where our dependencies could be serviced potentially independently of the product as a whole static unit. We didn't achieve that goal initially, but this design would enable us to do something like this. + * One negative to this scenario is that dependency resolution and the installation of dependent packages through APPX is currently lacking in several ways. It's difficult/impossible to do in environments where the store or the internet is unavailable. And it's a problem often enough that the Windows Terminal package embeds the VC runtimes inside itself instead of relying on the dependency resolution of the app platform. + ## Resources -[comment]: # Be sure to add links to references, resources, footnotes, etc. +(link here to default app spec) From 47c7d80105ed4ba009f0315150f9ad3895fa9064 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Wed, 26 Aug 2020 11:09:43 -0700 Subject: [PATCH 3/8] Add a bunch more to the defterm spec. --- doc/specs/#492 - Default Terminal/spec.md | 129 +++++++++++++++++++++- 1 file changed, 127 insertions(+), 2 deletions(-) diff --git a/doc/specs/#492 - Default Terminal/spec.md b/doc/specs/#492 - Default Terminal/spec.md index e2dc6f3bdaf..5714f99a313 100644 --- a/doc/specs/#492 - Default Terminal/spec.md +++ b/doc/specs/#492 - Default Terminal/spec.md @@ -1,7 +1,7 @@ --- author: Michael Niksa @miniksa created on: 2020-08-14 -last updated: 2020-08-24 +last updated: 2020-08-26 issue id: #492 --- @@ -46,17 +46,142 @@ The goal is to offer the ultimate in choice here where any of the components can The inbox console will be updated to support delegation of the incoming console client application connection to another console API server if one is registered and available. +We leave the inbox console in-place and always available on the operating system for these reasons: + +1. A last chance fall-back should any of the delegation operations fail +1. An ongoing host for applications that aren't going to need a window at all +1. Continued support of our legacy `conhostv1.dll` environment, if chosen + +The general operation is as follows: + +- A command-line client application is started (from the start menu, run box, or any other `CreateProcess` or `ShellExecute` route) without an existing console server attached +- The inbox console is launched from `C:\windows\system32\conhost.exe` as always by the initialization routines inside `kernelbase.dll`. +- The inbox console accepts the incoming initial connection and looks for the `ShowWindow` information on the connection packet, as received from the kernel's process creation routines based on the parameters given to the `CreateProcess` call. (See [CREATE_NO_WINDOW](https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags) flag for details.) +- If the session is about to create a window, check for registration of a delegated/updated console and hand-off to it if it exists. +- Otherwise, start normally. + +This workflow affords us several benefits: + +- The only inbox component we have to change is `conhost.exe`, the one we already regularly update from open source on a regular basis. There is no change to the `kernelbase.dll` console initialization routines, `conclnt.lib` communication protocol, nor the `condrv.sys` driver. +- We should be able to make this change quickly, relatively easily, and the code delta should be relatively small + - This makes it easy to squeeze in early in the development of the solution and get it into the Windows OS product as soon as possible for self-hosting, validation, and potentially shipping in the OS before the remainder of the solution has shaken out + - This also makes it potentially possible to backport this portion of the code change to popular in-market versions of Windows 10. For instance, WSL2 has just backported to 1903 and 1909. The less churn and risk, the easier it is to sell backporting. + +**To be decided:** +- If no updated console exists, potentially check for registration of a terminal UX that is willing to use the inbox ConPTY bits, start it, and transition to being a PTY instead. + +The registration would operate as follows: +- A registry key in `HKCU\Console` (format `REG_SZ`, name `DelegationConsole`) would specify the path to the replacement console that would be used to service the remainder of the connection process. + - Alternatively or additionally, this same `REG_SZ` could list a COM server ID that could be looked up in the classes root and invoked + - Packaged applications and classic applications can easily register a COM server + - **To be confirmed:** WinRT libraries should be able to be easily registered as the COM server as well (given WinRT is COM underneath) + +The delegation process would operate as follows: +- A method contract is established between the existing inbox console and any updated console (an interface). + - `HRESULT ConsoleEstablishHandoff(HANDLE server, HANDLE driverInputEvent, const PortableArguments* const args, const PortableConnectMessage* const msg)` + - `HANDLE server`: This is the server side handle to the console driver, used with `DeviceIoControl` to receive/send messages with the client command-line application + - `HANDLE driverInputEvent`: The input event is created and assigned to the driver immediately on first connection, before any messages are read from the driver, to ensure that it can track a blocking state should first message be an input request that we do not yet have data to fill. As such, the inbox console will have created this and assigned it to the driver before pulling off the connection packet and determining that it wants to delegate. Therefore, we will transfer ownership of this event to the updated console. + - `const PortableArguments* const args`: This contains the startup argument information that was passed in when the process was started including the original command line and the in/out handles. + - The `ConsoleArguments` structure could technically change between versions, so we will make a version agnostic portable structure that just carries the communication from the old one to the new one. + - `const PortableConnectMessage* const msg`: + - The `CONSOLE_API_MSG` structure contains both the actual packet data from the driver as well as some overhead/administration data related to the packet state, ordering, completion, errors, and buffers. It's a broad scope structure for every type of message we process and it can change over time as we improve the way the `conserver.lib` handles packets. + - This represents a version agnostic variant for ONLY the connect message that can pass along the initial connect information structure, the packet sequencing information, and other relevant payload only to that one message type. It will purposefully discard references to things like a specific set of API servicing routines because the point of handing off is to get updated routines, if necessary. + + - *Return* `HRESULT`: This is one of the older style methods in the initialization. We moved them from mostly `NTSTATUS` to mostly `HRESULT` a while ago to take advantage of `wil`. This one will continue to follow the pattern and not move to exceptions. A return of `S_OK` will symbolize that the handoff worked and the inbox console can clean itself up and stop handling the session. +- When the connection packet is parsed for visibility information (see `srvinit.cpp`), we will attempt to resolve the registered handoff and call it. + - In the initial revision here, I have this as a `LoadLibrary`/`GetProcAddress` to the above exported contract method from the updated console. This maintains the server session in the same process space and avoids: + 1. The issue of passing the server, event, and other handles into another process space. We're not entirely sure if the console driver will happily accept these things moving to a different process. It probably should, but unconfirmed. + 1. Some command-line client applications rely on spelunking the process tree to figure out who is their servicing application. Maintaining the delegated/updated console inside the same process space maintains some level of continuity for these sorts of applications. + - **Alternative:** We may make this just be a COM server/client contract. An in-proc COM server should operate in much the same fashion here (loading the DLL into the process and running particular method) while being significantly more formal and customizable (version revisions, moving to out-of-proc, not really needing to know the binary path because the catalog knows). + - **Not considering:** WinRT. `conhost.exe` has no WinRT. Adding WinRT to it would significantly increase the complexity of compilation in the inbox and out of box code base. It would also significantly increase the compilation time, binary size, library link list, etc... unless we use just the ABI to access it. But I don't see an advantage to that over just using classic COM at that point. This is only one handoff method and a rather simplistic one at that. Every benefit WinRT provides is outweighed by the extra effort that would be required over just a classic COM server in this case. +- After delegation is complete, the inbox console will have to clean up any threads, handles, and state related to the session. We do a fairly good job with this normally, but some portions of the `conhost.exe` codebase are reliant on the process exiting for final cleanup. There may be a bit of extra effort to do some explicit cleanup here. + #### Updated console The updated replacement console will have the same console API server capabilities as the inbox console, but will be a later, updated, or customized-to-the-scenario version of the API server generally revolving around improving ConPTY support for a Terminal application. +On receiving the handoff from the method signature listed above, the updated console will: +- Establish its own set of IO threading, device communication infrastructure, and API messaging routines while storing the handles given +- Re-parse the command line arguments, if necessary, and store them for guiding the remainder of launch +- Dispatch the attach message as if it were received normally +- Continue execution from there + +There will then either be a registration for a Terminal UX to take over the session by using ConPTY, or the updated console will choose to launch its potentially updated version of the `conhost` UX. + +For registration, we repeat the dance above with another key: +- A registry key in `HKCU\Console` (format `REG_SZ`, name `DelegationTerminal`) would specify the path to the replacement console that would be used to service the remainder of the connection process. + - Alternatively or additionally, this same `REG_SZ` could list a COM server ID that could be looked up in the classes root and invoked + - Packaged applications and classic applications can easily register a COM server + - **To be confirmed:** WinRT libraries should be able to be easily registered as the COM server as well (given WinRT is COM underneath) + +The delegation repeats the same dance as above as well: +- A contract (interface) is established between the updated console and the terminal + - **METHOD SIGNATURE NOT DETERMINED** + - `HANDLE hSignal`: The signal handle for the ConPTY for out-of-band communication between PTY server and Terminal application + - `HANDLE hOut`: The handle to write user input from the Terminal to the ConPTY + - `HANDLE hIn`: The handle to read client application output from the ConPTY and display on the Terminal + - **To be confirmed:** `COORD size`: The initial window size from the starting application, as it can be a preference in the connection structure. (A resize message may get sent back downward almost immediately from the Terminal as its dimensions could be different.) + - **Alternative:** This should likely just be a COM server/client contract as well. This would be consistent with the above and wouldn't require argument parsing or wink/nudge understanding of standard handle passing. It also conveys the same COM flexibility as described in the inbox console section. +- The contract is called and on success, responsibility of the UX is given over to the Terminal. The console sits in PTY mode. + - On failure, the console launches interactive. + #### Terminal UX The terminal will be its own complete presentation and input solution on top of a ConPTY connection, separating the concerns between API servicing and the user experience. +Today the Terminal knows how to start and then launches a ConPTY under it. The Terminal will need to be updated to accept a pre-existing ConPTY connection on launch (or when the multi-process model arrives, as an inbound connection), and connect that to a new tab/pane instead of using the `winconpty.lib` libraries to make its own. + +For now, I'm considering only the fresh-start scenario. +- The Terminal will have to detect the inbound connection through its argument parsing (or through a new entrypoint in the COM alternative) and store the PTY in/out/signal handles for that connection in the startup arguments information +- When the control is instantiated on a new tab, that initial creation where normally the "default profile" is launched will instead have to place the PTY in/out/signal handles already received into the `ConPtyConnection` object and use that as if it was already created. +- The Terminal can then let things run normally and the connection will come through and be hosted inside the session. + +There are several issues/concerns: +- Which profile/settings get loaded? We don't really know anything about the client that is coming in already-established. That makes it difficult to know what user preferences to apply to the inbound tab. We could: + - Use only the defaults for the incoming connection. Do not apply any profile-specific settings. + - Use the profile information from the default profile to some degree. This could cause some weird scenarios/mismatches if that profile has a particular icon or a color scheme that makes it recognizable to the user. + - Create some sort of "inbound profile" profile that is used for incoming connections + - Add a heuristic that attempts to match the name/path of the connecting client binary to a profile that exists and use those settings, falling back if one is not found. + - **Proposal:** Do the first one immediately for bootstrapping, then investigate the others as a revision going forward. +- The handles that are coming in are "raw" and "unpacked", not in the nice opaque `HPCON` structure that is usually provided to the `ConPtyConnection` object by the `winconpty.lib`. + - Add methods to `winconpty.lib` that allow for the packing of incoming raw handles into the `HPCON` structure so the rest of the lifetime can be treated the same + - Put the entrypoint for the COM server (or delegate the entrypoint for an argument) directly into this library so it can pack them up right away and hand of a ready-made `HPCON`. + ## UI/UX Design -[comment]: # What will this fix/feature look like? How will it affect the end user? +The user experience for this feature overall should be: + +1. The user launches a command-line client application through the Start Menu, Win+X menu, the Windows Explorer, the Run Dialog box (WinKey+R), or through another existing Windows application. +1. Using the established settings, the console system transparently starts, delegates itself to the updated console, switches itself into ConPTY mode, and a copy of Windows Terminal launches with the first tab open to host the command-line client application. + - **NOTE:** I'm not precluding 3rd party registrations of either the delegation updated console nor the delegation terminal. It is our intention to allow either or both of these pieces to be replaced to the user's desires. The example is for brevity of our golden path and motivation for this scenario. +1. The user is able to interact with the command-line client application as they would with the original console host. + - The user receives the additional benefit that short-running executions of a command-line application may not "blink in and disappear" as they do today when a user runs something like `ipconfig` from the runbox. The Terminal's default states tend to leave the tab open and say that the client has exited. This would allow a Run Dialog `ipconfig` user an improved experience over the default console host state of disappearing quickly. +1. If any portion of the delegation fails, we will progressively degrade back to a `conhost` style Win32+GDI UX and nothing will be different from before. + +The settings experience includes: +- Configuration of the delegation operations: + - Locations: + - With the registry + - This is what's going to be available first and will remain available. We will progress to some or all of the below after. + - We will need to potentially add specifications to this to both the default profile (for new installations of Windows) or to upgrade/migration profiles (for users coming from previous editions of Windows) to enable the delegation process, especially if we put a copy of Windows Terminal directly into the box. + - Inside Windows Terminal + - Inside the new Settings UI, we will likely need a page that configures the delegation keys in `HKCU\Console` or a link out to the Windows Settings panel, should we manage to get the settings configurable there. + - Inside the console property sheet + - Same as for Terminal but with `comctl` controlsover XAML +/- a link to the Windows Settings panel + - Inside the Settings panel for Windows (probably on the developer settings page) + - The ultimate location for this is likely a panel directly inside Windows. This is the hardest one to accomplish because of the timelines of the Windows product. We may not get this in an initial revision, but it should likely be our ultimate goal. + - Operation: + - Specify paths/server IDs - This is the initial revision + - Offer a list of registered servers or discovered manifests from the app catalog - This is the ideal scenario where we search the installed app catalog +/- the COM catalog and offer a list of apps that conform to the contract in a drop-down. + +- Configuration of the legacy console state: + - Since we could end up in an experience where the default launch experience gets you directly into Windows Terminal, we believe that the Terminal will likely need an additional setting or settings in the new Settings UI that will allow the toggling of some of the `HKCU\Console` values to do things like set/remove the legacy console state. + +Concerns: +- State separation policy for Windows. I believe `HKCU\Console` is already specified as a part of the "user state" that should be mutable and carried forward on OS Swap, especially as we have been improving the OS swap experience. +- Ability for MSIs/elevated scripts to stomp the Delegation keys + - This was a long time problem for default app registrations and was limited in our OS. Are we about to run down the same path? + - What is the alternative here? To use a protocol handler? To store this configuration state data with other protected state in a registry area that is mutable, but only ACL'd to the `SYSTEM` user like some other things in the Settings control panel? ## Capabilities From d907fddfcc20996d114091e4ca0a22157cb81969 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Wed, 26 Aug 2020 11:09:43 -0700 Subject: [PATCH 4/8] Migrate spelling-0.0.19 changes from main --- .github/actions/spelling/allow/allow.txt | 18 ++---- .github/actions/spelling/allow/apis.txt | 19 ------ .github/actions/spelling/allow/names.txt | 1 - .github/actions/spelling/excludes.txt | 2 - .github/actions/spelling/expect/expect.txt | 62 +++++++------------ .github/actions/spelling/expect/web.txt | 9 --- .../actions/spelling/patterns/patterns.txt | 5 +- 7 files changed, 30 insertions(+), 86 deletions(-) diff --git a/.github/actions/spelling/allow/allow.txt b/.github/actions/spelling/allow/allow.txt index bdbcfc923bd..35742a6111e 100644 --- a/.github/actions/spelling/allow/allow.txt +++ b/.github/actions/spelling/allow/allow.txt @@ -1,14 +1,12 @@ -admins apc -Apc -bsd calt ccmp changelog +cybersecurity +Apc clickable clig copyable -cybersecurity dalet dcs Dcs @@ -23,33 +21,29 @@ Fitt formattings ftp fvar -gcc geeksforgeeks ghe gje -godbolt hostname hostnames hyperlink hyperlinking hyperlinks img -inlined It'd kje liga lje -Llast -Lmid locl lorem +Llast +Lmid Lorigin maxed mkmk -mnt mru -nje noreply +nje ogonek ok'd overlined @@ -77,9 +71,7 @@ UIs und unregister versioned -vsdevcmd We'd wildcards yeru zhe -allcolors diff --git a/.github/actions/spelling/allow/apis.txt b/.github/actions/spelling/allow/apis.txt index 062bba9f622..19f5fb48776 100644 --- a/.github/actions/spelling/allow/apis.txt +++ b/.github/actions/spelling/allow/apis.txt @@ -1,7 +1,5 @@ ACCEPTFILES ACCESSDENIED -acl -aclapi alignas alignof APPLYTOSUBMENUS @@ -11,7 +9,6 @@ BUILDBRANCH BUILDMSG BUILDNUMBER BYPOSITION -BYCOMMAND charconv CLASSNOTAVAILABLE cmdletbinding @@ -19,11 +16,9 @@ COLORPROPERTY colspan COMDLG comparand -commandlinetoargv cstdint CXICON CYICON -Dacl dataobject dcomp DERR @@ -43,14 +38,12 @@ fullkbd futex GETDESKWALLPAPER GETHIGHCONTRAST -GETMOUSEHOVERTIME Hashtable HIGHCONTRASTON HIGHCONTRASTW hotkeys href hrgn -HTCLOSE IActivation IApp IAppearance @@ -92,17 +85,13 @@ LSHIFT MENUCOMMAND MENUDATA MENUINFO -MENUITEMINFOW memicmp mptt -MOUSELEAVE mov msappx MULTIPLEUSE NCHITTEST NCLBUTTONDBLCLK -NCMOUSELEAVE -NCMOUSEMOVE NCRBUTTONDBLCLK NIF NIN @@ -125,19 +114,15 @@ OSVERSIONINFOEXW otms OUTLINETEXTMETRICW overridable -PACL PAGESCROLL -PEXPLICIT PICKFOLDERS pmr -ptstr rcx REGCLS RETURNCMD rfind roundf RSHIFT -SACL schandle semver serializer @@ -168,16 +153,12 @@ TASKBARCREATED TBPF THEMECHANGED tlg -TME tmp tolower toupper -TRACKMOUSEEVENT TTask TVal UChar -UFIELD -ULARGE UPDATEINIFILE userenv wcsstr diff --git a/.github/actions/spelling/allow/names.txt b/.github/actions/spelling/allow/names.txt index 2a13d67badd..3635d37234e 100644 --- a/.github/actions/spelling/allow/names.txt +++ b/.github/actions/spelling/allow/names.txt @@ -9,7 +9,6 @@ Diviness dsafa duhowett ekg -eryksun ethanschoonover Firefox Gatta diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt index 7d64932c95a..81bfde27718 100644 --- a/.github/actions/spelling/excludes.txt +++ b/.github/actions/spelling/excludes.txt @@ -61,14 +61,12 @@ SUMS$ ^src/host/runft\.bat$ ^src/host/runut\.bat$ ^src/interactivity/onecore/BgfxEngine\. -^src/renderer/atlas/ ^src/renderer/wddmcon/WddmConRenderer\. ^src/terminal/adapter/ut_adapter/run\.bat$ ^src/terminal/parser/delfuzzpayload\.bat$ ^src/terminal/parser/ft_fuzzer/run\.bat$ ^src/terminal/parser/ft_fuzzer/VTCommandFuzzer\.cpp$ ^src/terminal/parser/ft_fuzzwrapper/run\.bat$ -^src/terminal/parser/ut_parser/Base64Test.cpp$ ^src/terminal/parser/ut_parser/run\.bat$ ^src/tools/integrity/packageuwp/ConsoleUWP\.appxSources$ ^src/tools/lnkd/lnkd\.bat$ diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt index 84fcd8e14b5..dccd6d7405a 100644 --- a/.github/actions/spelling/expect/expect.txt +++ b/.github/actions/spelling/expect/expect.txt @@ -12,6 +12,7 @@ ACTCTXW activatable ACTIVEBORDER ACTIVECAPTION +adaa ADDALIAS ADDREF addressof @@ -160,7 +161,6 @@ Borland BOTTOMLEFT BOTTOMRIGHT boutput -boxheader BPBF bpp BPPF @@ -189,6 +189,7 @@ cacafire callee capslock CARETBLINKINGENABLED +carlos CARRIAGERETURN cascadia cassert @@ -287,6 +288,8 @@ codepage codepath codepoint codeproject +coffgroup +coffgrp coinit COLLECTIONURI colorizing @@ -297,7 +300,6 @@ colorspaces colorspec colortable colortbl -colortest colortool COLR combaseapi @@ -383,14 +385,12 @@ CPINFOEX CPLINFO cplusplus cpp -CPPARM CPPCORECHECK cppcorecheckrules cppm cpprest cpprestsdk cppwinrt -CPPx CProc cpx crbegin @@ -401,7 +401,6 @@ creativecommons cred cref crend -Crisman CRLFs crloew Crt @@ -480,6 +479,7 @@ dai DATABLOCK DATAVIEW DATAW +datetime DBatch dbcs DBCSCHAR @@ -508,7 +508,6 @@ dealloc Debian debolden debugtype -DECAC DECALN DECANM DECAUPSS @@ -609,7 +608,6 @@ DINLINE directio DIRECTX Dirs -DISABLEDELAYEDEXPANSION DISABLENOSCROLL DISPLAYATTRIBUTE DISPLAYATTRIBUTEPROPERTY @@ -634,14 +632,13 @@ doskey dotnet doubleclick downlevel -DPG +dpg dpi DPIAPI DPICHANGE DPICHANGED dpix dpiy -dpnx DRAWFRAME DRAWITEM DRAWITEMSTRUCT @@ -673,8 +670,8 @@ dxgidwm dxinterop dxsm dxttbmp -Dyreen eachother +eae eaf EASTEUROPE ECH @@ -689,13 +686,13 @@ edputil edu Efast EHsc -EINS EJO ELEMENTNOTAVAILABLE elems elif elseif emacs +emplate EMPTYBOX enabledelayedexpansion endian @@ -715,7 +712,6 @@ enumranges envvar eol EPres -EQU ERASEBKGND errno errorlevel @@ -765,13 +761,11 @@ fdw fesb FFDE FFrom -fgbg FGCOLOR fgetc fgetwc FGHIJ fgidx -FGs FILEDESCRIPTION fileno filepath @@ -796,7 +790,6 @@ FIXEDCONVERTED FIXEDFILEINFO Flg flyout -fmix fmodern fmtarg fmtid @@ -825,7 +818,6 @@ FORCEOFFFEEDBACK FORCEONFEEDBACK FORCEV foreach -forground fprintf framebuffer FRAMECHANGED @@ -858,6 +850,7 @@ gcy gdi gdip gdirenderer +GENPROFILE geopol GETALIAS GETALIASES @@ -942,12 +935,9 @@ groupbox gset gsl GTP -GTR -guardxfg guc gui guidatom -guiddef GValue GWL GWLP @@ -978,6 +968,7 @@ hfont hfontresource hglobal hhh +HHmm hhook hhx HIBYTE @@ -1007,6 +998,7 @@ horiz HORZ hostable hostlib +Hostx HPA HPAINTBUFFER HPCON @@ -1133,6 +1125,7 @@ INPUTPROCESSORPROFILE inputrc Inputreadhandledata INSERTMODE +installationpath intellisense INTERACTIVITYBASE INTERCEPTCOPYPASTE @@ -1162,6 +1155,7 @@ IRaw IRead IReference IRender +IRenderer IScheme ISelection IShell @@ -1360,7 +1354,6 @@ lstrcmp lstrcmpi LTEXT LTLTLTLTL -ltrim ltype LUID lval @@ -1387,7 +1380,6 @@ MAXDIMENSTRING maxing MAXLENGTH MAXSHORT -maxval maxversiontested MAXWORD maybenull @@ -1433,6 +1425,7 @@ mkdir MMBB mmcc MMCPL +MMdd mmsystem MNC MNOPQ @@ -1474,6 +1467,7 @@ msix msrc msvcrt MSVCRTD +MSVS msys msysgit MTSM @@ -1541,7 +1535,6 @@ NOCOLOR NOCOMM NOCONTEXTHELP NOCOPYBITS -nodefaultlib nodiscard NODUP noexcept @@ -1581,7 +1574,6 @@ nothrow NOTICKS NOTIMPL notin -notmatch NOTNULL NOTOPMOST NOTRACK @@ -1589,7 +1581,6 @@ NOTSUPPORTED nouicompat nounihan NOUPDATE -novtable NOWAIT NOYIELD NOZORDER @@ -1691,7 +1682,6 @@ OUTOFCONTEXT OUTOFMEMORY outout Outptr -outstr OVERLAPPEDWINDOW OWNDC OWNERDRAWFIXED @@ -1768,7 +1758,6 @@ PFONTENUMDATA PFS pgd pgdn -PGONu pgorepro pgort PGU @@ -1803,7 +1792,6 @@ PNTSTATUS POBJECT Podcast POINTSLIST -Poli POLYTEXTW popd POPF @@ -1989,6 +1977,7 @@ REGISTERVDM regkey REGSTR reingest +Relayout RELBINPATH remoting renamer @@ -2051,8 +2040,6 @@ rtf RTFTo Rtl RTLREADING -Rtn -rtrim RTTI ruleset runas @@ -2069,7 +2056,6 @@ runut runxamlformat rvalue RVERTICAL -rvpa RWIN rxvt safearray @@ -2182,6 +2168,7 @@ SHOWNOACTIVATE SHOWNORMAL SHOWWINDOW SHRT +sid sidebyside SIF SIGDN @@ -2212,6 +2199,7 @@ somefile SOURCEBRANCH sourced SOURCESDIRECTORY +SPACEBAR spammy spand sprintf @@ -2244,7 +2232,6 @@ STARTWPARMSW Statusline stdafx STDAPI -stdc stdcall stdcpp stderr @@ -2269,7 +2256,6 @@ strrev strsafe strtok structs -STUBHEAD STUVWX STX stylecop @@ -2391,7 +2377,6 @@ TIcon tif tilunittests Timeline -timelines titlebar TITLEISLINKNAME TJson @@ -2490,7 +2475,6 @@ uint uintptr ulcch ulong -umd Unadvise unattend uncomment @@ -2518,6 +2502,7 @@ unmark UNORM unparseable unpause +Unregister unregistering untests untextured @@ -2530,6 +2515,7 @@ upvote uri url urlencoded +Urxvt USASCII usebackq USECALLBACK @@ -2574,6 +2560,7 @@ Vcount vcpkg vcprintf vcproj +vcvarsall vcxitems vcxproj vec @@ -2658,7 +2645,6 @@ wddmcon wddmconrenderer WDDMCONSOLECONTEXT wdm -webclient webpage website websocket @@ -2733,7 +2719,6 @@ Winperf WInplace winres winrt -winsdk wintelnet winternl winuser @@ -2780,7 +2765,6 @@ WRITECONSOLE WRITECONSOLEINPUT WRITECONSOLEOUTPUT WRITECONSOLEOUTPUTSTRING -wrkstr wrl wrp WRunoff @@ -2829,9 +2813,9 @@ xdy XEncoding xes xff -xfg XFile XFORM +xIcon XManifest XMath XMFLOAT @@ -2864,6 +2848,7 @@ YCast YCENTER YCount YDPI +yIcon yml YOffset YPosition @@ -2871,6 +2856,7 @@ YSize YSubstantial YVIRTUALSCREEN YWalk +zamora ZCmd ZCtrl zsh diff --git a/.github/actions/spelling/expect/web.txt b/.github/actions/spelling/expect/web.txt index 4b95ef2e627..826edf1af8e 100644 --- a/.github/actions/spelling/expect/web.txt +++ b/.github/actions/spelling/expect/web.txt @@ -17,12 +17,3 @@ mdtauk cppreference gfycat Guake -askubuntu -dostips -viewtopic -rosettacode -Rexx -tldp -HOWTO -uwspace -uwaterloo diff --git a/.github/actions/spelling/patterns/patterns.txt b/.github/actions/spelling/patterns/patterns.txt index 2fc6e0b708c..47f902f904f 100644 --- a/.github/actions/spelling/patterns/patterns.txt +++ b/.github/actions/spelling/patterns/patterns.txt @@ -4,7 +4,7 @@ https://www\.itscj\.ipsj\.or\.jp/iso-ir/[-0-9]+\.pdf https://www\.vt100\.net/docs/[-a-zA-Z0-9#_\/.]* https://www.w3.org/[-a-zA-Z0-9?&=\/_#]* https://(?:(?:www\.|)youtube\.com|youtu.be)/[-a-zA-Z0-9?&=]* -https://(?:[a-z-]+\.|)github(?:usercontent|)\.com/[-a-zA-Z0-9?%&=_\/.+]* +https://(?:[a-z-]+\.|)github(?:usercontent|)\.com/[-a-zA-Z0-9?%&=_\/.]* https://www.xfree86.org/[-a-zA-Z0-9?&=\/_#]* [Pp]ublicKeyToken="?[0-9a-fA-F]{16}"? (?:[{"]|UniqueIdentifier>)[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}(?:[}"]| Date: Thu, 13 Jan 2022 17:27:03 -0800 Subject: [PATCH 5/8] Finish off the spec based on what actually happened. --- doc/specs/#492 - Default Terminal/spec.md | 95 ++++++++++++++--------- 1 file changed, 57 insertions(+), 38 deletions(-) diff --git a/doc/specs/#492 - Default Terminal/spec.md b/doc/specs/#492 - Default Terminal/spec.md index 5714f99a313..7c1101fbd8b 100644 --- a/doc/specs/#492 - Default Terminal/spec.md +++ b/doc/specs/#492 - Default Terminal/spec.md @@ -1,7 +1,7 @@ --- author: Michael Niksa @miniksa created on: 2020-08-14 -last updated: 2020-08-26 +last updated: 2022-01-13 issue id: #492 --- @@ -29,7 +29,7 @@ There are three components to the proposed design: And there are a few scenarios here to consider: -1. Replacement console API server and replacement terminal UX. +1. Replacement console API server and replacement terminal UX. 1. This is the Windows Terminal scenario today. `OpenConsole.exe` is packed in the package to be the console API server and ConPTY environment for `WindowsTerminal.exe`. 1. Replacement console API server and legacy terminal UX. 1. We don't explicitly distribute this today, but it's technically possible to just run `OpenConsole.exe` to accomplish this. @@ -67,34 +67,43 @@ This workflow affords us several benefits: - This makes it easy to squeeze in early in the development of the solution and get it into the Windows OS product as soon as possible for self-hosting, validation, and potentially shipping in the OS before the remainder of the solution has shaken out - This also makes it potentially possible to backport this portion of the code change to popular in-market versions of Windows 10. For instance, WSL2 has just backported to 1903 and 1909. The less churn and risk, the easier it is to sell backporting. -**To be decided:** -- If no updated console exists, potentially check for registration of a terminal UX that is willing to use the inbox ConPTY bits, start it, and transition to being a PTY instead. +*Potential future:* +- ~~If no updated console exists, potentially check for registration of a terminal UX that is willing to use the inbox ConPTY bits, start it, and transition to being a PTY instead.~~ +- **CUT FROM v1**: To simplify the story for end-users, we're offering this as a package deal in the first revision. Explaining the difference between consoles and terminals to end users is very difficult. The registration would operate as follows: -- A registry key in `HKCU\Console` (format `REG_SZ`, name `DelegationConsole`) would specify the path to the replacement console that would be used to service the remainder of the connection process. - - Alternatively or additionally, this same `REG_SZ` could list a COM server ID that could be looked up in the classes root and invoked +- A registry key in `HKCU\Console\%%Startup` (format `REG_SZ`, name `DelegationConsole`) would specify ~~the path to ~~the replacement console that would be used to service the remainder of the connection process. + - Alternatively or additionally, this same `REG_SZ` could list a COM server ID that could be looked up in the classes root and invoked. **V1 NOTE:** This was what was done. - Packaged applications and classic applications can easily register a COM server - - **To be confirmed:** WinRT libraries should be able to be easily registered as the COM server as well (given WinRT is COM underneath) + - WinRT libraries should be able to be easily registered as the COM server as well (given WinRT is COM underneath) + - WinRT cannot be exposed outside of the package context itself, so the `conhost.exe` that is in the OS and is naturally outside the package cannot find it. + - **V1 NOTE:** The subkey `%%Startup` was chosen to separate these keys (this one and the `DelegationTerminal` one below) in case we needed to ACL them or protect them in some way. We want a per-user choice of which Terminal/Console are used, but we might need to take action to prevent these keys from being slammed at some point in the future. Why `%%`? The subkeys are traditionally used to resolve paths to client binaries that have their own console preferences set. The `%%` should never be resolvable as it won't lead to a valid path or expanded path variable. The delegation process would operate as follows: - A method contract is established between the existing inbox console and any updated console (an interface). - - `HRESULT ConsoleEstablishHandoff(HANDLE server, HANDLE driverInputEvent, const PortableArguments* const args, const PortableConnectMessage* const msg)` + - `HRESULT ConsoleEstablishHandoff(HANDLE server, HANDLE driverInputEvent, const PortableConnectMessage* const msg, HANDLE signalPipe, HANDLE inboxProcess, HANDLE* process)` - `HANDLE server`: This is the server side handle to the console driver, used with `DeviceIoControl` to receive/send messages with the client command-line application - `HANDLE driverInputEvent`: The input event is created and assigned to the driver immediately on first connection, before any messages are read from the driver, to ensure that it can track a blocking state should first message be an input request that we do not yet have data to fill. As such, the inbox console will have created this and assigned it to the driver before pulling off the connection packet and determining that it wants to delegate. Therefore, we will transfer ownership of this event to the updated console. - - `const PortableArguments* const args`: This contains the startup argument information that was passed in when the process was started including the original command line and the in/out handles. - - The `ConsoleArguments` structure could technically change between versions, so we will make a version agnostic portable structure that just carries the communication from the old one to the new one. + - ~~`const PortableArguments* const args`: This contains the startup argument information that was passed in when the process was started including the original command line and the in/out handles.~~ + - ~~The `ConsoleArguments` structure could technically change between versions, so we will make a version agnostic portable structure that just carries the communication from the old one to the new one.~~ + - **CUT FROM V1**: The only arguments coming in from a default light-up are the server handle. Pretty much all the other arguments are related to the operation of the PTY. Since this feature is about "default application" launches where no arguments are specified, this was cut from the initial revision. - `const PortableConnectMessage* const msg`: - The `CONSOLE_API_MSG` structure contains both the actual packet data from the driver as well as some overhead/administration data related to the packet state, ordering, completion, errors, and buffers. It's a broad scope structure for every type of message we process and it can change over time as we improve the way the `conserver.lib` handles packets. - This represents a version agnostic variant for ONLY the connect message that can pass along the initial connect information structure, the packet sequencing information, and other relevant payload only to that one message type. It will purposefully discard references to things like a specific set of API servicing routines because the point of handing off is to get updated routines, if necessary. - + - **V1 NOTE:** This was named `CONSOLE_PORTABLE_ATTACH_MSG` + - `HANDLE signalPipe`: During authoring, it was identified that Ctrl+C and other similar signals need to make it back to the original `conhost.exe` application as the Operating System grants it special privilege over the originally attached client application. This privilege cannot be transferred to the delegated console. So this channel remains for the delegated one to send its signals back through the original one for commanding the underlying client. (This also implies the original `conhost.exe` inbox cannot close and must remain a part of the process tree for the life of the session to maintain this control.) + - `HANDLE inboxProcess`: Since we have to keep the inbox `conhost.exe` running for signal/ownership reasons, we also need to track its lifetime. If it disappears for whatever reason, we need to tear down the entire chain as part of our operation has been compromised. + - `HANDLE* process`: On the contrary to `inboxProcess`, we need to give our process handle back so it can also be tracked. After the inbox console delegates, it remains in a very limited capacity. If the delegation one disappears, the session will no longer function and needs to be torn down (and the client closed). - *Return* `HRESULT`: This is one of the older style methods in the initialization. We moved them from mostly `NTSTATUS` to mostly `HRESULT` a while ago to take advantage of `wil`. This one will continue to follow the pattern and not move to exceptions. A return of `S_OK` will symbolize that the handoff worked and the inbox console can clean itself up and stop handling the session. - When the connection packet is parsed for visibility information (see `srvinit.cpp`), we will attempt to resolve the registered handoff and call it. - - In the initial revision here, I have this as a `LoadLibrary`/`GetProcAddress` to the above exported contract method from the updated console. This maintains the server session in the same process space and avoids: - 1. The issue of passing the server, event, and other handles into another process space. We're not entirely sure if the console driver will happily accept these things moving to a different process. It probably should, but unconfirmed. - 1. Some command-line client applications rely on spelunking the process tree to figure out who is their servicing application. Maintaining the delegated/updated console inside the same process space maintains some level of continuity for these sorts of applications. - - **Alternative:** We may make this just be a COM server/client contract. An in-proc COM server should operate in much the same fashion here (loading the DLL into the process and running particular method) while being significantly more formal and customizable (version revisions, moving to out-of-proc, not really needing to know the binary path because the catalog knows). - - **Not considering:** WinRT. `conhost.exe` has no WinRT. Adding WinRT to it would significantly increase the complexity of compilation in the inbox and out of box code base. It would also significantly increase the compilation time, binary size, library link list, etc... unless we use just the ABI to access it. But I don't see an advantage to that over just using classic COM at that point. This is only one handoff method and a rather simplistic one at that. Every benefit WinRT provides is outweighed by the extra effort that would be required over just a classic COM server in this case. + - ~~In the initial revision here, I have this as a `LoadLibrary`/`GetProcAddress` to the above exported contract method from the updated console. This maintains the server session in the same process space and avoids:~~ + 1. ~~The issue of passing the server, event, and other handles into another process space. We're not entirely sure if the console driver will happily accept these things moving to a different process. It probably should, but unconfirmed.~~ + 1. ~~Some command-line client applications rely on spelunking the process tree to figure out who is their servicing application. Maintaining the delegated/updated console inside the same process space maintains some level of continuity for these sorts of applications.~~ + - **Alternative:** We may make this just be a COM server/client contract. ~~An in-proc COM server should operate in much the same fashion here (loading the DLL into the process and running particular method) while being significantly more formal and customizable (version revisions, moving to out-of-proc, not really needing to know the binary path because the catalog knows).~~ + - **V1 NOTE:** We landed on an out-of-proc COM server/client here. This maintains the isolation of the newly running code from the old code. Since we're maintaining the original `conhost.exe` for signaling purposes, we're no longer worried about the spelunking the process tree and not having the relationship for clients to find. + - **Not considering:** ~~WinRT. `conhost.exe` has no WinRT. Adding WinRT to it would significantly increase the complexity of compilation in the inbox and out of box code base. It would also significantly increase the compilation time, binary size, library link list, etc... unless we use just the ABI to access it. But I don't see an advantage to that over just using classic COM at that point. This is only one handoff method and a rather simplistic one at that. Every benefit WinRT provides is outweighed by the extra effort that would be required over just a classic COM server in this case.~~ - After delegation is complete, the inbox console will have to clean up any threads, handles, and state related to the session. We do a fairly good job with this normally, but some portions of the `conhost.exe` codebase are reliant on the process exiting for final cleanup. There may be a bit of extra effort to do some explicit cleanup here. + - **V1 NOTE:** The inbox one cleans up everything it can and sits in a state waiting for the child/delegated process handle to exit. It also maintains a thread listening for the signals to come through in case it needs to send a command to the client application using the privilege granted to it by the driver. #### Updated console @@ -102,27 +111,27 @@ The updated replacement console will have the same console API server capabiliti On receiving the handoff from the method signature listed above, the updated console will: - Establish its own set of IO threading, device communication infrastructure, and API messaging routines while storing the handles given -- Re-parse the command line arguments, if necessary, and store them for guiding the remainder of launch +- ~~Re-parse the command line arguments, if necessary, and store them for guiding the remainder of launch~~ - Dispatch the attach message as if it were received normally - Continue execution from there -There will then either be a registration for a Terminal UX to take over the session by using ConPTY, or the updated console will choose to launch its potentially updated version of the `conhost` UX. +There will then either be a registration for a Terminal UX to take over the session by using ConPTY, ~~or the updated console will choose to launch its potentially updated version of the `conhost` UX~~. For registration, we repeat the dance above with another key: -- A registry key in `HKCU\Console` (format `REG_SZ`, name `DelegationTerminal`) would specify the path to the replacement console that would be used to service the remainder of the connection process. - - Alternatively or additionally, this same `REG_SZ` could list a COM server ID that could be looked up in the classes root and invoked - - Packaged applications and classic applications can easily register a COM server - - **To be confirmed:** WinRT libraries should be able to be easily registered as the COM server as well (given WinRT is COM underneath) +- A registry key in `HKCU\Console\%%Startup` (format `REG_SZ`, name `DelegationTerminal`). The delegation repeats the same dance as above as well: - A contract (interface) is established between the updated console and the terminal - - **METHOD SIGNATURE NOT DETERMINED** - - `HANDLE hSignal`: The signal handle for the ConPTY for out-of-band communication between PTY server and Terminal application - - `HANDLE hOut`: The handle to write user input from the Terminal to the ConPTY - - `HANDLE hIn`: The handle to read client application output from the ConPTY and display on the Terminal - - **To be confirmed:** `COORD size`: The initial window size from the starting application, as it can be a preference in the connection structure. (A resize message may get sent back downward almost immediately from the Terminal as its dimensions could be different.) - - **Alternative:** This should likely just be a COM server/client contract as well. This would be consistent with the above and wouldn't require argument parsing or wink/nudge understanding of standard handle passing. It also conveys the same COM flexibility as described in the inbox console section. -- The contract is called and on success, responsibility of the UX is given over to the Terminal. The console sits in PTY mode. + - `HRESULT EstablishPtyHandoff(HANDLE in, HANDLE out, HANDLE signal, HANDLE ref, HANDLE server, HANDLE client)` + - `HANDLE in`: The handle to read client application output from the ConPTY and display on the Terminal + - `HANDLE out`: The handle to write user input from the Terminal to the ConPTY + - `HANDLE signal`: The signal handle for the ConPTY for out-of-band communication between PTY server and Terminal application + - ~~`COORD size`: The initial window size from the starting application, as it can be a preference in the connection structure. (A resize message may get sent back downward almost immediately from the Terminal as its dimensions could be different.)~~ **V1 NOTE:** This proved unnecessary as the resize operations sorted themselves out naturally. + - `HANDLE ref`: This is a "client reference handle" to the console driver and session. We hold onto a copy of this in the Terminal so the session will stay alive until we let go. (The other console hosts in the chain also hold one of these, as should the client.) + - `HANDLE server`: This is a process handle to the PTY we're attached to. We monitor this to know when the PTY is still alive from the Terminal side. + - `HANDLE client`: This is a process handle to the underlying client application. The terminal tracks this for exit handling. + - **Alternative:** This should likely just be a COM server/client contract as well. This would be consistent with the above and wouldn't require argument parsing or wink/nudge understanding of standard handle passing. It also conveys the same COM flexibility as described in the inbox console section. **V1 NOTE:** We used this alternative. We used COM, not a well-known exported function from the prototype. +- The contract is called and on success, responsibility of the UX is given over to the Terminal. The console sits in PTY mode. - On failure, the console launches interactive. #### Terminal UX @@ -132,7 +141,7 @@ The terminal will be its own complete presentation and input solution on top of Today the Terminal knows how to start and then launches a ConPTY under it. The Terminal will need to be updated to accept a pre-existing ConPTY connection on launch (or when the multi-process model arrives, as an inbound connection), and connect that to a new tab/pane instead of using the `winconpty.lib` libraries to make its own. For now, I'm considering only the fresh-start scenario. -- The Terminal will have to detect the inbound connection through its argument parsing (or through a new entrypoint in the COM alternative) and store the PTY in/out/signal handles for that connection in the startup arguments information +- The Terminal will have to detect the inbound connection through ~~its argument parsing (or through~~ a new entrypoint in the COM alternative ~~)~~ and store the PTY in/out/signal handles for that connection in the startup arguments information - When the control is instantiated on a new tab, that initial creation where normally the "default profile" is launched will instead have to place the PTY in/out/signal handles already received into the `ConPtyConnection` object and use that as if it was already created. - The Terminal can then let things run normally and the connection will come through and be hosted inside the session. @@ -164,24 +173,29 @@ The settings experience includes: - With the registry - This is what's going to be available first and will remain available. We will progress to some or all of the below after. - We will need to potentially add specifications to this to both the default profile (for new installations of Windows) or to upgrade/migration profiles (for users coming from previous editions of Windows) to enable the delegation process, especially if we put a copy of Windows Terminal directly into the box. + - **V1 NOTE:** we didn't add additional migration logic here as `HKCU\Console*` and subkeys were already in the migration logic, so adding another should just carry along. - Inside Windows Terminal - - Inside the new Settings UI, we will likely need a page that configures the delegation keys in `HKCU\Console` or a link out to the Windows Settings panel, should we manage to get the settings configurable there. + - Inside the new Settings UI, we will likely need a page that configures the delegation keys in `HKCU\Console\%%Startup` ~~or a link out to the Windows Settings panel, should we manage to get the settings configurable there~~. - Inside the console property sheet - - Same as for Terminal but with `comctl` controlsover XAML +/- a link to the Windows Settings panel + - Same as for Terminal but with `comctl` controls over XAML +/- a link to the Windows Settings panel - Inside the Settings panel for Windows (probably on the developer settings page) - - The ultimate location for this is likely a panel directly inside Windows. This is the hardest one to accomplish because of the timelines of the Windows product. We may not get this in an initial revision, but it should likely be our ultimate goal. + - The ultimate location for this is likely a panel directly inside Windows. This is the hardest one to accomplish because of the timelines of the Windows product. We may not get this in an initial revision, but it should likely be our ultimate goal. **V1 NOTE:** We did it! - Operation: - Specify paths/server IDs - This is the initial revision - Offer a list of registered servers or discovered manifests from the app catalog - This is the ideal scenario where we search the installed app catalog +/- the COM catalog and offer a list of apps that conform to the contract in a drop-down. + - The final process was to use [App Extensions](https://docs.microsoft.com/windows/uwp/launch-resume/how-to-create-an-extension) inside the Terminal APPX package to declare the COM GUIDs that were available for the `DelegationConsole` and `DelegationTerminal` fields respectively. A configuration class `DelegationConfig` was added to `propslib.lib` that enables the lookup of these from the application state catalog and presents a list of them to choose from. It also manages reading and writing the registry keys. + - **V1 NOTE:** Our configuration options currently allow pairings of replacement consoles and terminals to be adjusted in lock-step from the UI. That's not to say further combinations are not possible or even necessarily inhibited by the code. We just went for minimal confusion in our first round. - Configuration of the legacy console state: - - Since we could end up in an experience where the default launch experience gets you directly into Windows Terminal, we believe that the Terminal will likely need an additional setting or settings in the new Settings UI that will allow the toggling of some of the `HKCU\Console` values to do things like set/remove the legacy console state. + - ~~Since we could end up in an experience where the default launch experience gets you directly into Windows Terminal, we believe that the Terminal will likely need an additional setting or settings in the new Settings UI that will allow the toggling of some of the `HKCU\Console` values to do things like set/remove the legacy console state.~~ **V1 NOTE:** Cut as low priority. Switch back to console and configure it that way or use the existing property sheet or tamper with registry keys. + - We have left the per-launch debugging and advanced access hole of calling something like `conhost.exe cmd.exe` which will use the inbox conhost to launch `cmd.exe` even if there is a default specified. Concerns: - State separation policy for Windows. I believe `HKCU\Console` is already specified as a part of the "user state" that should be mutable and carried forward on OS Swap, especially as we have been improving the OS swap experience. - Ability for MSIs/elevated scripts to stomp the Delegation keys - This was a long time problem for default app registrations and was limited in our OS. Are we about to run down the same path? - What is the alternative here? To use a protocol handler? To store this configuration state data with other protected state in a registry area that is mutable, but only ACL'd to the `SYSTEM` user like some other things in the Settings control panel? + - **V1 NOTE:** We set ourselves up for some future ACL thing with the subkey, but we otherwise haven't enforced anything at this time. ## Capabilities @@ -193,7 +207,9 @@ The major players here that I am considering are NVDA, JAWS, and Narrator. As fa ### Security -Let's hit the elephant in the room. "You plan on pulling a completely different binary inside the `conhost.exe` process and just... delegating all activity to it?" Yes. +Let's hit the elephant in the room. "You plan on pulling a completely different binary inside the `conhost.exe` process and just... delegating all activity to it?" Yes. + +(**V1 NOTE:** Well, it's out of proc now. But it is at the same privilege level as the original one thanks to the mechanics of COM.) As far as I'm concerned, the `conhost.exe` that is started to host the command-line client application is running at the same integrity level as the client binary that is partially started and waiting for its server to be ready. This is the long-standing existing protection that we have from the Windows operating system. Anything running in the same integrity level is already expected to be able to tamper with anything else at the same integrity level. The delegated binary that we would be loading into our process space will also be at the same integrity level. Nothing really stops a malicious actor from launching that binary in any other way in the same integrity level as a part of the command-line client application's startup. @@ -218,6 +234,8 @@ Two considerations here: 1. At a minimum, we must offer an opt-out of the delegation to another terminal for the default application. 1. We may also want to offer a process-name, policy, manifest, or other per client application opt-out mechanism. +**V1 NOTE:** There is no per-client specific way of doing this. The toggle is per-user and can be adjusted in 3 different places. + ### Performance, Power, and Efficiency I expect to take some degree of performance, power, and efficiency hit by implementing this replacement default app scenario just by it's nature. We will be loading multiple processes, performing tests and branches during startup, and we will likely need to load COM/WinRT and packaging data that was not loaded prior to resolve the final state of default application load. I would expect this to accrue to some failures in the performance and power gates inside the Windows product. Additionally, the efficiency of running pretty much everything through the ConPTY is lower than just rendering it directly to `conhost.exe`'s embedded GDI-powered UI itself thanks to the multiple levels of translation and parsing that occur in this scenario. @@ -233,11 +251,12 @@ The mitigations to these losses are as follows: ## Potential Issues -[comment]: # What are some of the things that might cause problems with the fixes/features proposed? Consider how the user might be negatively impacted. +### Passing Handles with COM +COM doesn't inherently expose a way for us to pass handles directly between processes with the existing contracts. We know this is possible because Windows does it all the time, but it doesn't appear to be public. We believe the mission forward is to expose this functionality to the public as if it's good enough for us internally and it is a requirement to build complex functionality like this... then it should be good enough for the public. -## Future considerations +**V1 NOTE:** We gained approval to open this up and documented it. [`system_handle` attribute](https://docs.microsoft.com/windows/win32/midl/system-handle). It didn't require any code changes because the public IDL compiler already recognized the existence of this attribute and did the correct thing. It just wasn't documented for use. -[comment]: # What are some of the things that the fixes/features might unlock in the future? Does the implementation of this spec enable scenarios? +## Future considerations * We additionally would like to leave the door open to distributing updated `OpenConsole.exe`s in their own app package as a dependency that others could rely on. * This was one of the original management requests when we were open sourcing the console product as well as the Terminal back in spring of 2019. For the sake of ongoing servicing and maintainability, it was requested that we reach a point where our dependencies could be serviced potentially independently of the product as a whole static unit. We didn't achieve that goal initially, but this design would enable us to do something like this. From 4f0ceb7a55097a9357806b7f51b6500cc7a73e13 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 13 Jan 2022 17:29:43 -0800 Subject: [PATCH 6/8] pull spell patterns from main because something weird happened. --- .github/actions/spelling/allow/allow.txt | 18 ++++-- .github/actions/spelling/allow/apis.txt | 19 ++++++ .github/actions/spelling/allow/names.txt | 1 + .github/actions/spelling/excludes.txt | 2 + .github/actions/spelling/expect/expect.txt | 62 ++++++++++++------- .github/actions/spelling/expect/web.txt | 9 +++ .../actions/spelling/patterns/patterns.txt | 5 +- 7 files changed, 86 insertions(+), 30 deletions(-) diff --git a/.github/actions/spelling/allow/allow.txt b/.github/actions/spelling/allow/allow.txt index 35742a6111e..bdbcfc923bd 100644 --- a/.github/actions/spelling/allow/allow.txt +++ b/.github/actions/spelling/allow/allow.txt @@ -1,12 +1,14 @@ +admins apc +Apc +bsd calt ccmp changelog -cybersecurity -Apc clickable clig copyable +cybersecurity dalet dcs Dcs @@ -21,29 +23,33 @@ Fitt formattings ftp fvar +gcc geeksforgeeks ghe gje +godbolt hostname hostnames hyperlink hyperlinking hyperlinks img +inlined It'd kje liga lje -locl -lorem Llast Lmid +locl +lorem Lorigin maxed mkmk +mnt mru -noreply nje +noreply ogonek ok'd overlined @@ -71,7 +77,9 @@ UIs und unregister versioned +vsdevcmd We'd wildcards yeru zhe +allcolors diff --git a/.github/actions/spelling/allow/apis.txt b/.github/actions/spelling/allow/apis.txt index 19f5fb48776..062bba9f622 100644 --- a/.github/actions/spelling/allow/apis.txt +++ b/.github/actions/spelling/allow/apis.txt @@ -1,5 +1,7 @@ ACCEPTFILES ACCESSDENIED +acl +aclapi alignas alignof APPLYTOSUBMENUS @@ -9,6 +11,7 @@ BUILDBRANCH BUILDMSG BUILDNUMBER BYPOSITION +BYCOMMAND charconv CLASSNOTAVAILABLE cmdletbinding @@ -16,9 +19,11 @@ COLORPROPERTY colspan COMDLG comparand +commandlinetoargv cstdint CXICON CYICON +Dacl dataobject dcomp DERR @@ -38,12 +43,14 @@ fullkbd futex GETDESKWALLPAPER GETHIGHCONTRAST +GETMOUSEHOVERTIME Hashtable HIGHCONTRASTON HIGHCONTRASTW hotkeys href hrgn +HTCLOSE IActivation IApp IAppearance @@ -85,13 +92,17 @@ LSHIFT MENUCOMMAND MENUDATA MENUINFO +MENUITEMINFOW memicmp mptt +MOUSELEAVE mov msappx MULTIPLEUSE NCHITTEST NCLBUTTONDBLCLK +NCMOUSELEAVE +NCMOUSEMOVE NCRBUTTONDBLCLK NIF NIN @@ -114,15 +125,19 @@ OSVERSIONINFOEXW otms OUTLINETEXTMETRICW overridable +PACL PAGESCROLL +PEXPLICIT PICKFOLDERS pmr +ptstr rcx REGCLS RETURNCMD rfind roundf RSHIFT +SACL schandle semver serializer @@ -153,12 +168,16 @@ TASKBARCREATED TBPF THEMECHANGED tlg +TME tmp tolower toupper +TRACKMOUSEEVENT TTask TVal UChar +UFIELD +ULARGE UPDATEINIFILE userenv wcsstr diff --git a/.github/actions/spelling/allow/names.txt b/.github/actions/spelling/allow/names.txt index 3635d37234e..2a13d67badd 100644 --- a/.github/actions/spelling/allow/names.txt +++ b/.github/actions/spelling/allow/names.txt @@ -9,6 +9,7 @@ Diviness dsafa duhowett ekg +eryksun ethanschoonover Firefox Gatta diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt index 81bfde27718..7d64932c95a 100644 --- a/.github/actions/spelling/excludes.txt +++ b/.github/actions/spelling/excludes.txt @@ -61,12 +61,14 @@ SUMS$ ^src/host/runft\.bat$ ^src/host/runut\.bat$ ^src/interactivity/onecore/BgfxEngine\. +^src/renderer/atlas/ ^src/renderer/wddmcon/WddmConRenderer\. ^src/terminal/adapter/ut_adapter/run\.bat$ ^src/terminal/parser/delfuzzpayload\.bat$ ^src/terminal/parser/ft_fuzzer/run\.bat$ ^src/terminal/parser/ft_fuzzer/VTCommandFuzzer\.cpp$ ^src/terminal/parser/ft_fuzzwrapper/run\.bat$ +^src/terminal/parser/ut_parser/Base64Test.cpp$ ^src/terminal/parser/ut_parser/run\.bat$ ^src/tools/integrity/packageuwp/ConsoleUWP\.appxSources$ ^src/tools/lnkd/lnkd\.bat$ diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt index dccd6d7405a..84fcd8e14b5 100644 --- a/.github/actions/spelling/expect/expect.txt +++ b/.github/actions/spelling/expect/expect.txt @@ -12,7 +12,6 @@ ACTCTXW activatable ACTIVEBORDER ACTIVECAPTION -adaa ADDALIAS ADDREF addressof @@ -161,6 +160,7 @@ Borland BOTTOMLEFT BOTTOMRIGHT boutput +boxheader BPBF bpp BPPF @@ -189,7 +189,6 @@ cacafire callee capslock CARETBLINKINGENABLED -carlos CARRIAGERETURN cascadia cassert @@ -288,8 +287,6 @@ codepage codepath codepoint codeproject -coffgroup -coffgrp coinit COLLECTIONURI colorizing @@ -300,6 +297,7 @@ colorspaces colorspec colortable colortbl +colortest colortool COLR combaseapi @@ -385,12 +383,14 @@ CPINFOEX CPLINFO cplusplus cpp +CPPARM CPPCORECHECK cppcorecheckrules cppm cpprest cpprestsdk cppwinrt +CPPx CProc cpx crbegin @@ -401,6 +401,7 @@ creativecommons cred cref crend +Crisman CRLFs crloew Crt @@ -479,7 +480,6 @@ dai DATABLOCK DATAVIEW DATAW -datetime DBatch dbcs DBCSCHAR @@ -508,6 +508,7 @@ dealloc Debian debolden debugtype +DECAC DECALN DECANM DECAUPSS @@ -608,6 +609,7 @@ DINLINE directio DIRECTX Dirs +DISABLEDELAYEDEXPANSION DISABLENOSCROLL DISPLAYATTRIBUTE DISPLAYATTRIBUTEPROPERTY @@ -632,13 +634,14 @@ doskey dotnet doubleclick downlevel -dpg +DPG dpi DPIAPI DPICHANGE DPICHANGED dpix dpiy +dpnx DRAWFRAME DRAWITEM DRAWITEMSTRUCT @@ -670,8 +673,8 @@ dxgidwm dxinterop dxsm dxttbmp +Dyreen eachother -eae eaf EASTEUROPE ECH @@ -686,13 +689,13 @@ edputil edu Efast EHsc +EINS EJO ELEMENTNOTAVAILABLE elems elif elseif emacs -emplate EMPTYBOX enabledelayedexpansion endian @@ -712,6 +715,7 @@ enumranges envvar eol EPres +EQU ERASEBKGND errno errorlevel @@ -761,11 +765,13 @@ fdw fesb FFDE FFrom +fgbg FGCOLOR fgetc fgetwc FGHIJ fgidx +FGs FILEDESCRIPTION fileno filepath @@ -790,6 +796,7 @@ FIXEDCONVERTED FIXEDFILEINFO Flg flyout +fmix fmodern fmtarg fmtid @@ -818,6 +825,7 @@ FORCEOFFFEEDBACK FORCEONFEEDBACK FORCEV foreach +forground fprintf framebuffer FRAMECHANGED @@ -850,7 +858,6 @@ gcy gdi gdip gdirenderer -GENPROFILE geopol GETALIAS GETALIASES @@ -935,9 +942,12 @@ groupbox gset gsl GTP +GTR +guardxfg guc gui guidatom +guiddef GValue GWL GWLP @@ -968,7 +978,6 @@ hfont hfontresource hglobal hhh -HHmm hhook hhx HIBYTE @@ -998,7 +1007,6 @@ horiz HORZ hostable hostlib -Hostx HPA HPAINTBUFFER HPCON @@ -1125,7 +1133,6 @@ INPUTPROCESSORPROFILE inputrc Inputreadhandledata INSERTMODE -installationpath intellisense INTERACTIVITYBASE INTERCEPTCOPYPASTE @@ -1155,7 +1162,6 @@ IRaw IRead IReference IRender -IRenderer IScheme ISelection IShell @@ -1354,6 +1360,7 @@ lstrcmp lstrcmpi LTEXT LTLTLTLTL +ltrim ltype LUID lval @@ -1380,6 +1387,7 @@ MAXDIMENSTRING maxing MAXLENGTH MAXSHORT +maxval maxversiontested MAXWORD maybenull @@ -1425,7 +1433,6 @@ mkdir MMBB mmcc MMCPL -MMdd mmsystem MNC MNOPQ @@ -1467,7 +1474,6 @@ msix msrc msvcrt MSVCRTD -MSVS msys msysgit MTSM @@ -1535,6 +1541,7 @@ NOCOLOR NOCOMM NOCONTEXTHELP NOCOPYBITS +nodefaultlib nodiscard NODUP noexcept @@ -1574,6 +1581,7 @@ nothrow NOTICKS NOTIMPL notin +notmatch NOTNULL NOTOPMOST NOTRACK @@ -1581,6 +1589,7 @@ NOTSUPPORTED nouicompat nounihan NOUPDATE +novtable NOWAIT NOYIELD NOZORDER @@ -1682,6 +1691,7 @@ OUTOFCONTEXT OUTOFMEMORY outout Outptr +outstr OVERLAPPEDWINDOW OWNDC OWNERDRAWFIXED @@ -1758,6 +1768,7 @@ PFONTENUMDATA PFS pgd pgdn +PGONu pgorepro pgort PGU @@ -1792,6 +1803,7 @@ PNTSTATUS POBJECT Podcast POINTSLIST +Poli POLYTEXTW popd POPF @@ -1977,7 +1989,6 @@ REGISTERVDM regkey REGSTR reingest -Relayout RELBINPATH remoting renamer @@ -2040,6 +2051,8 @@ rtf RTFTo Rtl RTLREADING +Rtn +rtrim RTTI ruleset runas @@ -2056,6 +2069,7 @@ runut runxamlformat rvalue RVERTICAL +rvpa RWIN rxvt safearray @@ -2168,7 +2182,6 @@ SHOWNOACTIVATE SHOWNORMAL SHOWWINDOW SHRT -sid sidebyside SIF SIGDN @@ -2199,7 +2212,6 @@ somefile SOURCEBRANCH sourced SOURCESDIRECTORY -SPACEBAR spammy spand sprintf @@ -2232,6 +2244,7 @@ STARTWPARMSW Statusline stdafx STDAPI +stdc stdcall stdcpp stderr @@ -2256,6 +2269,7 @@ strrev strsafe strtok structs +STUBHEAD STUVWX STX stylecop @@ -2377,6 +2391,7 @@ TIcon tif tilunittests Timeline +timelines titlebar TITLEISLINKNAME TJson @@ -2475,6 +2490,7 @@ uint uintptr ulcch ulong +umd Unadvise unattend uncomment @@ -2502,7 +2518,6 @@ unmark UNORM unparseable unpause -Unregister unregistering untests untextured @@ -2515,7 +2530,6 @@ upvote uri url urlencoded -Urxvt USASCII usebackq USECALLBACK @@ -2560,7 +2574,6 @@ Vcount vcpkg vcprintf vcproj -vcvarsall vcxitems vcxproj vec @@ -2645,6 +2658,7 @@ wddmcon wddmconrenderer WDDMCONSOLECONTEXT wdm +webclient webpage website websocket @@ -2719,6 +2733,7 @@ Winperf WInplace winres winrt +winsdk wintelnet winternl winuser @@ -2765,6 +2780,7 @@ WRITECONSOLE WRITECONSOLEINPUT WRITECONSOLEOUTPUT WRITECONSOLEOUTPUTSTRING +wrkstr wrl wrp WRunoff @@ -2813,9 +2829,9 @@ xdy XEncoding xes xff +xfg XFile XFORM -xIcon XManifest XMath XMFLOAT @@ -2848,7 +2864,6 @@ YCast YCENTER YCount YDPI -yIcon yml YOffset YPosition @@ -2856,7 +2871,6 @@ YSize YSubstantial YVIRTUALSCREEN YWalk -zamora ZCmd ZCtrl zsh diff --git a/.github/actions/spelling/expect/web.txt b/.github/actions/spelling/expect/web.txt index 826edf1af8e..4b95ef2e627 100644 --- a/.github/actions/spelling/expect/web.txt +++ b/.github/actions/spelling/expect/web.txt @@ -17,3 +17,12 @@ mdtauk cppreference gfycat Guake +askubuntu +dostips +viewtopic +rosettacode +Rexx +tldp +HOWTO +uwspace +uwaterloo diff --git a/.github/actions/spelling/patterns/patterns.txt b/.github/actions/spelling/patterns/patterns.txt index 47f902f904f..2fc6e0b708c 100644 --- a/.github/actions/spelling/patterns/patterns.txt +++ b/.github/actions/spelling/patterns/patterns.txt @@ -4,7 +4,7 @@ https://www\.itscj\.ipsj\.or\.jp/iso-ir/[-0-9]+\.pdf https://www\.vt100\.net/docs/[-a-zA-Z0-9#_\/.]* https://www.w3.org/[-a-zA-Z0-9?&=\/_#]* https://(?:(?:www\.|)youtube\.com|youtu.be)/[-a-zA-Z0-9?&=]* -https://(?:[a-z-]+\.|)github(?:usercontent|)\.com/[-a-zA-Z0-9?%&=_\/.]* +https://(?:[a-z-]+\.|)github(?:usercontent|)\.com/[-a-zA-Z0-9?%&=_\/.+]* https://www.xfree86.org/[-a-zA-Z0-9?&=\/_#]* [Pp]ublicKeyToken="?[0-9a-fA-F]{16}"? (?:[{"]|UniqueIdentifier>)[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}(?:[}"]| Date: Fri, 14 Jan 2022 08:17:15 -0800 Subject: [PATCH 7/8] adjust spelling to satisfy checker. --- doc/specs/#492 - Default Terminal/spec.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/specs/#492 - Default Terminal/spec.md b/doc/specs/#492 - Default Terminal/spec.md index 7c1101fbd8b..6727bb38298 100644 --- a/doc/specs/#492 - Default Terminal/spec.md +++ b/doc/specs/#492 - Default Terminal/spec.md @@ -65,7 +65,7 @@ This workflow affords us several benefits: - The only inbox component we have to change is `conhost.exe`, the one we already regularly update from open source on a regular basis. There is no change to the `kernelbase.dll` console initialization routines, `conclnt.lib` communication protocol, nor the `condrv.sys` driver. - We should be able to make this change quickly, relatively easily, and the code delta should be relatively small - This makes it easy to squeeze in early in the development of the solution and get it into the Windows OS product as soon as possible for self-hosting, validation, and potentially shipping in the OS before the remainder of the solution has shaken out - - This also makes it potentially possible to backport this portion of the code change to popular in-market versions of Windows 10. For instance, WSL2 has just backported to 1903 and 1909. The less churn and risk, the easier it is to sell backporting. + - This also makes it potentially possible to backport this portion of the code change to popular in-market versions of Windows 10. For instance, WSL2 has just backported to 1903 and 1909. The less churn and risk, the easier it is to sell a backport. *Potential future:* - ~~If no updated console exists, potentially check for registration of a terminal UX that is willing to use the inbox ConPTY bits, start it, and transition to being a PTY instead.~~ @@ -164,7 +164,7 @@ The user experience for this feature overall should be: 1. Using the established settings, the console system transparently starts, delegates itself to the updated console, switches itself into ConPTY mode, and a copy of Windows Terminal launches with the first tab open to host the command-line client application. - **NOTE:** I'm not precluding 3rd party registrations of either the delegation updated console nor the delegation terminal. It is our intention to allow either or both of these pieces to be replaced to the user's desires. The example is for brevity of our golden path and motivation for this scenario. 1. The user is able to interact with the command-line client application as they would with the original console host. - - The user receives the additional benefit that short-running executions of a command-line application may not "blink in and disappear" as they do today when a user runs something like `ipconfig` from the runbox. The Terminal's default states tend to leave the tab open and say that the client has exited. This would allow a Run Dialog `ipconfig` user an improved experience over the default console host state of disappearing quickly. + - The user receives the additional benefit that short-running executions of a command-line application may not "blink in and disappear" as they do today when a user runs something like `ipconfig` from the run dialog. The Terminal's default states tend to leave the tab open and say that the client has exited. This would allow a Run Dialog `ipconfig` user an improved experience over the default console host state of disappearing quickly. 1. If any portion of the delegation fails, we will progressively degrade back to a `conhost` style Win32+GDI UX and nothing will be different from before. The settings experience includes: @@ -192,7 +192,7 @@ The settings experience includes: Concerns: - State separation policy for Windows. I believe `HKCU\Console` is already specified as a part of the "user state" that should be mutable and carried forward on OS Swap, especially as we have been improving the OS swap experience. -- Ability for MSIs/elevated scripts to stomp the Delegation keys +- Ability for installers/elevated scripts to stomp the Delegation keys - This was a long time problem for default app registrations and was limited in our OS. Are we about to run down the same path? - What is the alternative here? To use a protocol handler? To store this configuration state data with other protected state in a registry area that is mutable, but only ACL'd to the `SYSTEM` user like some other things in the Settings control panel? - **V1 NOTE:** We set ourselves up for some future ACL thing with the subkey, but we otherwise haven't enforced anything at this time. @@ -227,7 +227,7 @@ Another layer of this is where either `conhost.exe` or the delegated `OpenConsol ### Compatibility -One particular scenario that this could break is an application that makes use of spelunking the process tree when a command-line application starts to identify the hosting terminal application window by HWND to inject input, extract output, or otherwise hook and bind to hosting services. As the default application UI that will launch may not have the `conhost.exe` name (for spelunking via searching processes) and the HWND located may either be the ConPTY fakeout HWND or an HWND belonging to a completely different UI, these applications might not work. +One particular scenario that this could break is an application that makes use of spelunking the process tree when a command-line application starts to identify the hosting terminal application window by HWND to inject input, extract output, or otherwise hook and bind to hosting services. As the default application UI that will launch may not have the `conhost.exe` name (for spelunking via searching processes) and the HWND located may either be the ConPTY fake HWND or an HWND belonging to a completely different UI, these applications might not work. Two considerations here: @@ -259,7 +259,7 @@ COM doesn't inherently expose a way for us to pass handles directly between proc ## Future considerations * We additionally would like to leave the door open to distributing updated `OpenConsole.exe`s in their own app package as a dependency that others could rely on. - * This was one of the original management requests when we were open sourcing the console product as well as the Terminal back in spring of 2019. For the sake of ongoing servicing and maintainability, it was requested that we reach a point where our dependencies could be serviced potentially independently of the product as a whole static unit. We didn't achieve that goal initially, but this design would enable us to do something like this. + * This was one of the original management requests when we were opening the source of the console product as well as the Terminal back in spring of 2019. For the sake of ongoing servicing and maintainability, it was requested that we reach a point where our dependencies could be serviced potentially independently of the product as a whole static unit. We didn't achieve that goal initially, but this design would enable us to do something like this. * One negative to this scenario is that dependency resolution and the installation of dependent packages through APPX is currently lacking in several ways. It's difficult/impossible to do in environments where the store or the internet is unavailable. And it's a problem often enough that the Windows Terminal package embeds the VC runtimes inside itself instead of relying on the dependency resolution of the app platform. ## Resources From 289ccd9cade0e94914a0f4c6863f9662b966ee8e Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Wed, 23 Feb 2022 13:21:38 -0800 Subject: [PATCH 8/8] Update spec.md Add references from PR to this. --- doc/specs/#492 - Default Terminal/spec.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/specs/#492 - Default Terminal/spec.md b/doc/specs/#492 - Default Terminal/spec.md index 6727bb38298..e54b4d71b9d 100644 --- a/doc/specs/#492 - Default Terminal/spec.md +++ b/doc/specs/#492 - Default Terminal/spec.md @@ -264,4 +264,7 @@ COM doesn't inherently expose a way for us to pass handles directly between proc ## Resources -(link here to default app spec) +- [Windows Terminal Process Model 2.0 spec](https://github.com/microsoft/terminal/pull/7240) +- [Windows Terminal 2.0 Process Model Improvements](https://github.com/microsoft/terminal/issues/5000) +- [Console allocation policy specifications](https://github.com/microsoft/terminal/pull/7337) +- [Fine-grained console allocation policy feature](https://github.com/microsoft/terminal/issues/7335)