Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions azure-pipelines/build-openconsole.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
steps:
- task: VSBuild@1
displayName: 'Build OpenConsole'
displayName: 'Build OpenConsole x86'
inputs:
solution: 'dep/terminal/OpenConsole.sln'
msbuildArgs: /t:Conhost\winconpty_DLL;Conhost\Host_EXE
platform: 'x86'
configuration: '$(BuildConfiguration)'

- task: VSBuild@1
displayName: 'Build OpenConsole'
displayName: 'Build OpenConsole x64'
inputs:
solution: 'dep/terminal/OpenConsole.sln'
msbuildArgs: /t:Conhost\winconpty_DLL;Conhost\Host_EXE
platform: 'x64'
configuration: '$(BuildConfiguration)'
- task: VSBuild@1
displayName: 'Build OpenConsole Arm64'
inputs:
solution: 'dep/terminal/OpenConsole.sln'
msbuildArgs: /t:Conhost\winconpty_DLL;Conhost\Host_EXE
platform: 'Arm64'
configuration: '$(BuildConfiguration)'
11 changes: 1 addition & 10 deletions azure-pipelines/build-winpty.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
steps:
# - task: UsePythonVersion@0
# inputs:
# versionSpec: 3.6
# addToPath: true
# architecture: x64

- powershell: azure-pipelines/Set-MSBuildPath.ps1

- script: echo $PATH
displayName: Print PATH

- script: dep/winpty/vcbuild.bat --msvc-platform Win32 --toolset v142 --gyp-msvs-version 2017
displayName: Build x86 winpty

- script: dep/winpty/vcbuild.bat --msvc-platform x64 --toolset v142 --gyp-msvs-version 2017
displayName: Build x64 winpty
displayName: Build x64 WinPty
2 changes: 1 addition & 1 deletion azure-pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- Linux
- MacOS
pool:
vmImage: Ubuntu 16.04
vmImage: Ubuntu 18.04
condition: succeededOrFailed()
steps:
- checkout: self
Expand Down
44 changes: 36 additions & 8 deletions src/OSS.Sign/OSS.Sign.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,48 @@

<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
<ItemGroup>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)\Win32\Release\conpty.dll" Condition="Exists($(OpenConsoleReleasePath))">
<!-- Release build ConPty files -->
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)\Win32\Release\conpty.dll" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Release'">
<PackagePath>x86</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)\Win32\Release\OpenConsole.exe" Condition="Exists($(OpenConsoleReleasePath))">
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)\Win32\Release\OpenConsole.exe" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Release'">
<PackagePath>x86</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)\x64\Release\conpty.dll" Condition="Exists($(OpenConsoleReleasePath))">
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)x64\Release\conpty.dll" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Release'">
<PackagePath>x64</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)\x64\Release\OpenConsole.exe" Condition="Exists($(OpenConsoleReleasePath))">
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)x64\Release\OpenConsole.exe" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Release'">
<PackagePath>x64</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)Arm64\Release\conpty.dll" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Release'">
<PackagePath>Arm64</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)Arm64\Release\OpenConsole.exe" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Release'">
<PackagePath>Arm64</PackagePath>
</OpenConsoleFiles>
</ItemGroup>
<ItemGroup>
<!-- Debug build ConPty files -->
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)\Win32\Debug\conpty.dll" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Debug'">
<PackagePath>x86</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)\Win32\Debug\OpenConsole.exe" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Debug'">
<PackagePath>x86</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)x64\Debug\conpty.dll" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Debug'">
<PackagePath>x64</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)x64\Debug\OpenConsole.exe" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Debug'">
<PackagePath>x64</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)Arm64\Debug\conpty.dll" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Debug'">
<PackagePath>Arm64</PackagePath>
</OpenConsoleFiles>
<OpenConsoleFiles Include="$(OpenConsoleReleasePath)Arm64\Debug\OpenConsole.exe" Condition="Exists($(OpenConsoleReleasePath)) And '$(Configuration)'=='Debug'">
<PackagePath>Arm64</PackagePath>
</OpenConsoleFiles>
</ItemGroup>
<!--<ItemGroup>
<WinPtyFiles Include="$(WinptyReleasePath)\Win32\winpty.dll" Condition="Exists($(WinptyReleasePath))">
<PackagePath>x86</PackagePath>
</WinPtyFiles>
Expand All @@ -37,8 +65,8 @@
<WinPtyFiles Include="$(WinptyReleasePath)\x64\winpty-agent.exe" Condition="Exists($(WinptyReleasePath))">
<PackagePath>x64</PackagePath>
</WinPtyFiles>
</ItemGroup>
<Copy SourceFiles="@(WinPtyFiles)" DestinationFolder="$(OutputPath)\winpty\%(WinPtyFiles.PackagePath)" />
</ItemGroup>-->
<!--<Copy SourceFiles="@(WinPtyFiles)" DestinationFolder="$(OutputPath)\winpty\%(WinPtyFiles.PackagePath)" />-->
<Copy SourceFiles="@(OpenConsoleFiles)" DestinationFolder="$(OutputPath)\conpty\%(OpenConsoleFiles.PackagePath)" />
</Target>

Expand All @@ -58,10 +86,10 @@

<Target Name="CopySignedFiles" AfterTargets="Build">
<ItemGroup>
<SignedWinPty Include="$(OutputPath)\winpty\**\*" />
<!--<SignedWinPty Include="$(OutputPath)\winpty\**\*" />-->
<SignedOpenConsole Include="$(OutputPath)\conpty\**\*" />
</ItemGroup>
<Copy SourceFiles="@(SignedWinPty)" DestinationFolder="$(RepoRootPath)\bin\winpty\%(SignedWinPty.RecursiveDir)" />
<!--<Copy SourceFiles="@(SignedWinPty)" DestinationFolder="$(RepoRootPath)\bin\winpty\%(SignedWinPty.RecursiveDir)" />-->
<Copy SourceFiles="@(SignedOpenConsole)" DestinationFolder="$(RepoRootPath)\bin\conpty\%(SignedOpenConsole.RecursiveDir)" />
</Target>
</Project>
34 changes: 29 additions & 5 deletions src/Pty.Net/Pty.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@
</PropertyGroup>

<ItemGroup>
<None Include="$(WinptyReleasePath)\x64\*.dll;$(WinptyReleasePath)\x64\*.exe">
<!--<None Include="$(WinptyReleasePath)\x64\*.dll;$(WinptyReleasePath)\x64\*.exe">
<Visible>false</Visible>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</None>-->

<None Include="$(OpenConsoleReleasePath)\x86\Release\*.dll;$(OpenConsoleReleasePath)\x86\Release\*.exe">
<Visible>false</Visible>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<LinkBase>os86\</LinkBase>
</None>

<None Include="$(OpenConsoleReleasePath)\x64\Release\*.dll;$(OpenConsoleReleasePath)\x64\Release\*.exe">
<Visible>false</Visible>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<LinkBase>os64\</LinkBase>
</None>

<None Include="$(OpenConsoleReleasePath)\Arm64\Release\*.dll;$(OpenConsoleReleasePath)\Arm64\Release\*.exe">
<Visible>false</Visible>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<LinkBase>arm64\</LinkBase>
</None>

<None Include="Pty.Net.targets">
<Pack>true</Pack>
<PackagePath>build\</PackagePath>
Expand All @@ -30,13 +42,14 @@

<Target Name="CollectNugetFiles" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<OutputPtyFiles Include="$(RepoRootPath)\bin\winpty\**\*" />
<!--<OutputPtyFiles Include="$(RepoRootPath)\bin\winpty\**\*" />-->

<None Include="@(OutputPtyFiles)">
<!-- <None Include="@(OutputPtyFiles)">
<Pack>true</Pack>
<PackagePath>build\</PackagePath>
</None>
</None> -->

<!-- x86 version of ConPty and OpenConsole -->
<None Include="$(RepoRootPath)\bin\conpty\x86\conpty.dll">
<Pack>true</Pack>
<PackagePath>build\x86\os86</PackagePath>
Expand All @@ -54,6 +67,7 @@
<PackagePath>build\x86\os64</PackagePath>
</None>

<!-- x64 version of ConPty and OpenConsole -->
<None Include="$(RepoRootPath)\bin\conpty\x64\conpty.dll">
<Pack>true</Pack>
<PackagePath>build\x64\os86</PackagePath>
Expand All @@ -70,6 +84,16 @@
<Pack>true</Pack>
<PackagePath>build\x64\os64</PackagePath>
</None>

<!-- Arm64 version of ConPty and OpenConsole -->
<None Include="$(RepoRootPath)\bin\conpty\Arm64\conpty.dll">
<Pack>true</Pack>
<PackagePath>build\arm64</PackagePath>
</None>
<None Include="$(RepoRootPath)\bin\conpty\Arm64\OpenConsole.exe">
<Pack>true</Pack>
<PackagePath>build\arm64</PackagePath>
</None>
</ItemGroup>
</Target>
</Project>
6 changes: 5 additions & 1 deletion src/Pty.Net/Pty.Net.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<Project>
<ItemGroup>
<ConPtyFiles Condition="'$(PlatformTarget)' != '' And '$(PlatformTarget)' != 'AnyCPU'"
<ConPtyFiles Condition="'$(PlatformTarget)' != '' And '$(PlatformTarget)' == 'x64'"
Include="$(MSBuildThisFileDirectory)\$(PlatformTarget)\**\*" />
<ConPtyFiles Condition="'$(PlatformTarget)' != '' And '$(PlatformTarget)' == 'x86'"
Include="$(MSBuildThisFileDirectory)\$(PlatformTarget)\**\*" />
<ConPtyFiles Condition="'$(PlatformTarget)' != '' And '$(PlatformTarget)' == 'Arm64'"
Include="$(MSBuildThisFileDirectory)\$(PlatformTarget)*" />
</ItemGroup>

<Target Name="CopyPtyNativeFiles">
Expand Down
59 changes: 38 additions & 21 deletions src/Pty.Net/Windows/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,43 @@ internal static extern bool CreateProcess(

internal static int CreatePseudoConsole(Coord coord, IntPtr input, IntPtr output, uint flags, out IntPtr consoleHandle)
{
if (Environment.Is64BitOperatingSystem)
{
return CreatePseudoConsole64(coord, input, output, flags, out consoleHandle);
}
else
{
return CreatePseudoConsole86(coord, input, output, flags, out consoleHandle);
switch (RuntimeInformation.ProcessArchitecture)
{
case Architecture.Arm64:
return CreatePseudoConsoleArm64(coord, input, output, flags, out consoleHandle);
case Architecture.X64:
return CreatePseudoConsole64(coord, input, output, flags, out consoleHandle);
default:
return CreatePseudoConsole86(coord, input, output, flags, out consoleHandle);
}
}

internal static int ResizePseudoConsole(SafePseudoConsoleHandle consoleHandle, Coord coord)
{
if (Environment.Is64BitOperatingSystem)
{
return ResizePseudoConsole64(consoleHandle, coord);
}
else
{
return ResizePseudoConsole86(consoleHandle, coord);
switch (RuntimeInformation.ProcessArchitecture)
{
case Architecture.Arm64:
return ResizePseudoConsoleArm64(consoleHandle, coord);
case Architecture.X64:
return ResizePseudoConsole64(consoleHandle, coord);
default:
return ResizePseudoConsole86(consoleHandle, coord);
}
}

internal static void ClosePseudoConsole(IntPtr consoleHandle)
{
if (Environment.Is64BitOperatingSystem)
{
ClosePseudoConsole64(consoleHandle);
}
else
{
ClosePseudoConsole86(consoleHandle);
switch (RuntimeInformation.ProcessArchitecture)
{
case Architecture.Arm64:
ClosePseudoConsoleArm64(consoleHandle);
break;
case Architecture.X64:
ClosePseudoConsole64(consoleHandle);
break;
default:
ClosePseudoConsole86(consoleHandle);
break;
}
}

Expand All @@ -127,6 +133,17 @@ internal static extern bool CreatePipe(
[DllImport("kernel32.dll")]
internal static extern IntPtr GetProcAddress(IntPtr hModule, [MarshalAs(UnmanagedType.LPStr)] string procName);

[DllImport("arm64\\conpty.dll", EntryPoint = "CreatePseudoConsole")]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
private static extern int CreatePseudoConsoleArm64(Coord coord, IntPtr input, IntPtr output, uint flags, out IntPtr consoleHandle);

[DllImport("arm64\\conpty.dll", EntryPoint = "ResizePseudoConsole")]
private static extern int ResizePseudoConsoleArm64(SafePseudoConsoleHandle consoleHandle, Coord coord);

[DllImport("arm64\\conpty.dll", EntryPoint = "ClosePseudoConsole")]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
private static extern void ClosePseudoConsoleArm64(IntPtr consoleHandle);

[DllImport("os64\\conpty.dll", EntryPoint = "CreatePseudoConsole")]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
private static extern int CreatePseudoConsole64(Coord coord, IntPtr input, IntPtr output, uint flags, out IntPtr consoleHandle);
Expand Down