906edf7002
- Implements the default application behavior and handoff mechanisms between console and terminal. The inbox portion is done already. This adds the ability for our OpenConsole.exe to accept the incoming server connection from the Windows OS, stand up a PTY session, start the Windows Terminal as a listener for an incoming connection, and then send it the incoming PTY connection for it to launch a tab. - The tab is launched with default settings at the moment. - You must configure the default application using the `conhost.exe` propsheet or with the registry keys. Finishing the setting inside Windows Terminal will be a todo after this is complete. The OS Settings panel work to surface this setting is a dependency delivered by another team and you will not see it here. ## Validation Steps Performed - [x] Manual adjust of registry keys to the delegation conhost/terminal behavior - [x] Adjustment of the delegation options with the propsheet - [x] Launching things from the run box manually and watching them show in Terminal - [x] Launching things from shortcuts and watching them show in the Terminal Documentation on how it works will be a TODO post completion in #9462 References #7414 - Default Terminal spec Closes #492
57 lines
1.8 KiB
C
57 lines
1.8 KiB
C
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- CTerminalHandoff.h
|
|
|
|
Abstract:
|
|
- This module receives an incoming request to host a terminal UX
|
|
for a console mode application already started and attached to a PTY.
|
|
|
|
Author(s):
|
|
- Michael Niksa (MiNiksa) 31-Aug-2020
|
|
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
#include "ITerminalHandoff.h"
|
|
|
|
#if defined(WT_BRANDING_RELEASE)
|
|
#define __CLSID_CTerminalHandoff "E12CFF52-A866-4C77-9A90-F570A7AA2C6B"
|
|
#elif defined(WT_BRANDING_PREVIEW)
|
|
#define __CLSID_CTerminalHandoff "86633F1F-6454-40EC-89CE-DA4EBA977EE2"
|
|
#else
|
|
#define __CLSID_CTerminalHandoff "051F34EE-C1FD-4B19-AF75-9BA54648434C"
|
|
#endif
|
|
|
|
using NewHandoffFunction = HRESULT (*)(HANDLE, HANDLE, HANDLE, HANDLE);
|
|
|
|
struct __declspec(uuid(__CLSID_CTerminalHandoff))
|
|
CTerminalHandoff : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::RuntimeClassType::ClassicCom>, ITerminalHandoff>
|
|
{
|
|
#pragma region ITerminalHandoff
|
|
STDMETHODIMP EstablishPtyHandoff(HANDLE in,
|
|
HANDLE out,
|
|
HANDLE signal,
|
|
HANDLE process) noexcept override;
|
|
|
|
#pragma endregion
|
|
|
|
static HRESULT s_StartListening(NewHandoffFunction pfnHandoff) noexcept;
|
|
static HRESULT s_StopListening() noexcept;
|
|
};
|
|
|
|
// Disable warnings from the CoCreatableClass macro as the value it provides for
|
|
// automatic COM class registration is of much greater value than the nits from
|
|
// the static analysis warnings.
|
|
#pragma warning(push)
|
|
|
|
#pragma warning(disable : 26477) // Macro uses 0/NULL over nullptr.
|
|
#pragma warning(disable : 26476) // Macro uses naked union over variant.
|
|
|
|
CoCreatableClass(CTerminalHandoff);
|
|
|
|
#pragma warning(pop)
|