terminal/src/winconpty/winconpty.h
Dustin L. Howett (MSFT) e0762f6bb3
Open-source the PseudoConsole family of functions in a new DLL (#2611)
This pull request introduces a copy of the code from kernel32.dll that
implements CreatePseudoConsole, ClosePseudoConsole and
ResizePseudoConsole. Apart from some light modifications to fit into the
infrastructure in this project and support launching OpenConsole.exe, it
is intended to be 1:1 with the code that ships in Windows.

Any guideline violations in this code are likely intentional. Since this
was built into kernel32, it uses the STL only _very sparingly._

Consumers of this library must make sure that conpty.lib lives earlier
in the link line than onecoreuap_apiset, onecoreuap, onecore_apiset,
onecore or kernel32.

Refs #1130.
2019-09-04 12:03:44 -07:00

44 lines
1.3 KiB
C

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "precomp.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _PseudoConsole
{
HANDLE hSignal;
HANDLE hPtyReference;
HANDLE hConPtyProcess;
} PseudoConsole;
// Signals
// These are not defined publicly, but are used for controlling the conpty via
// the signal pipe.
#define PTY_SIGNAL_RESIZE_WINDOW (8u)
// Implementations of the various PseudoConsole functions.
HRESULT _CreatePseudoConsole(const HANDLE hToken,
const COORD size,
const HANDLE hInput,
const HANDLE hOutput,
const DWORD dwFlags,
_Inout_ PseudoConsole* pPty);
HRESULT _ResizePseudoConsole(_In_ const PseudoConsole* const pPty, _In_ const COORD size);
void _ClosePseudoConsoleMembers(_In_ PseudoConsole* pPty);
VOID _ClosePseudoConsole(_In_ PseudoConsole* pPty);
HRESULT CreatePseudoConsoleAsUser(_In_ HANDLE hToken,
_In_ COORD size,
_In_ HANDLE hInput,
_In_ HANDLE hOutput,
_In_ DWORD dwFlags,
_Out_ HPCON* phPC);
#ifdef __cplusplus
}
#endif