31 lines
1 KiB
C#
31 lines
1 KiB
C#
using Microsoft.Win32.SafeHandles;
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace GUIConsole.ConPTY.Native
|
|
{
|
|
/// <summary>
|
|
/// PInvoke signatures for Win32's PseudoConsole API.
|
|
/// </summary>
|
|
static class PseudoConsoleApi
|
|
{
|
|
internal const uint PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE = 0x00020016;
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
internal struct COORD
|
|
{
|
|
public short X;
|
|
public short Y;
|
|
}
|
|
|
|
[DllImport("kernel32.dll", SetLastError = true)]
|
|
internal static extern int CreatePseudoConsole(COORD size, SafeFileHandle hInput, SafeFileHandle hOutput, uint dwFlags, out IntPtr phPC);
|
|
|
|
[DllImport("kernel32.dll", SetLastError = true)]
|
|
internal static extern int ClosePseudoConsole(IntPtr hPC);
|
|
|
|
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
|
internal static extern bool CreatePipe(out SafeFileHandle hReadPipe, out SafeFileHandle hWritePipe, IntPtr lpPipeAttributes, int nSize);
|
|
}
|
|
}
|