This repository has been archived by the owner on Jul 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
138 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/Kernel32/storebanned/Kernel32+CreatePseudoConsoleFlags.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright © .NET Foundation and Contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace PInvoke | ||
{ | ||
using System; | ||
using System.Diagnostics; | ||
|
||
/// <content> | ||
/// Contains the <see cref="CreatePseudoConsoleFlags"/> nested type. | ||
/// </content> | ||
public partial class Kernel32 | ||
{ | ||
/// <summary> | ||
/// Flags for the <see cref="CreatePseudoConsole(COORD, SafeObjectHandle, SafeObjectHandle, CreatePseudoConsoleFlags, out SafePseudoConsoleHandle)"/> method. | ||
/// </summary> | ||
public enum CreatePseudoConsoleFlags | ||
{ | ||
/// <summary> | ||
/// Perform a standard pseudoconsole creation. | ||
/// </summary> | ||
None = 0, | ||
|
||
/// <summary> | ||
/// The created pseudoconsole session will attempt to inherit the cursor position of the parent console. | ||
/// </summary> | ||
PSEUDOCONSOLE_INHERIT_CURSOR = 1, | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/Kernel32/storebanned/Kernel32+SafePseudoConsoleHandle.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright © .NET Foundation and Contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace PInvoke | ||
{ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
/// <content> | ||
/// Contains the <see cref="SafePseudoConsoleHandle"/> nested type. | ||
/// </content> | ||
public static partial class Kernel32 | ||
{ | ||
/// <summary> | ||
/// Represents a Win32 handle that can be closed with <see cref="ClosePseudoConsole"/>. | ||
/// </summary> | ||
public class SafePseudoConsoleHandle : SafeHandle | ||
{ | ||
/// <summary> | ||
/// An invalid handle that may be used in place of <see cref="INVALID_HANDLE_VALUE"/>. | ||
/// </summary> | ||
public static readonly SafePseudoConsoleHandle Invalid = new SafePseudoConsoleHandle(); | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="SafePseudoConsoleHandle"/> class. | ||
/// </summary> | ||
public SafePseudoConsoleHandle() | ||
: base(INVALID_HANDLE_VALUE, true) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="SafePseudoConsoleHandle"/> class. | ||
/// </summary> | ||
/// <param name="preexistingHandle">An object that represents the pre-existing handle to use.</param> | ||
/// <param name="ownsHandle"> | ||
/// <see langword="true" /> to have the native handle released when this safe handle is disposed or finalized; | ||
/// <see langword="false" /> otherwise. | ||
/// </param> | ||
public SafePseudoConsoleHandle(IntPtr preexistingHandle, bool ownsHandle = true) | ||
: base(IntPtr.Zero, ownsHandle) | ||
{ | ||
this.SetHandle(preexistingHandle); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override bool IsInvalid => this.handle == INVALID_HANDLE_VALUE; | ||
|
||
/// <inheritdoc /> | ||
protected override bool ReleaseHandle() | ||
{ | ||
ClosePseudoConsole(this.handle); | ||
return true; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters