terminal/src/winconpty/device.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

28 lines
814 B
C

/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- device.h
Abstract:
- This header exists to reduce the differences in winconpty
from the in-box windows source.
- Relies on components from Server to reach into ntdll for NtOpenFile
to get at the NT namespace, which is required to open the console device.
--*/
#pragma once
#include "../server/DeviceHandle.h"
[[nodiscard]] static inline NTSTATUS CreateClientHandle(PHANDLE Handle, HANDLE ServerHandle, PCWSTR Name, BOOLEAN Inheritable)
{
return DeviceHandle::CreateClientHandle(Handle, ServerHandle, Name, Inheritable);
}
[[nodiscard]] static inline NTSTATUS CreateServerHandle(PHANDLE Handle, BOOLEAN Inheritable)
{
return DeviceHandle::CreateServerHandle(Handle, Inheritable);
}