All checks were successful
default / dotnet default workflow (8.0) (push) Successful in 47s
41 lines
No EOL
1.1 KiB
C#
41 lines
No EOL
1.1 KiB
C#
// Copyright (c) The Geekeey Authors
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace Geekeey.Extensions.Process.Win.Notify;
|
|
|
|
internal static class Interop
|
|
{
|
|
// ReSharper disable MemberHidesStaticFromOuterClass
|
|
|
|
internal static class Libraries
|
|
{
|
|
internal const string Kernel32 = "kernel32.dll";
|
|
}
|
|
|
|
internal static class Kernel32
|
|
{
|
|
public delegate bool ConsoleCtrlDelegate(uint dwCtrlEvent);
|
|
|
|
[DllImport(Libraries.Kernel32)]
|
|
[SuppressGCTransition]
|
|
internal static extern int GetLastError();
|
|
|
|
[DllImport(Libraries.Kernel32)]
|
|
[SuppressGCTransition]
|
|
public static extern bool FreeConsole();
|
|
|
|
[DllImport(Libraries.Kernel32)]
|
|
[SuppressGCTransition]
|
|
public static extern bool AttachConsole(uint dwProcessId);
|
|
|
|
[DllImport(Libraries.Kernel32)]
|
|
[SuppressGCTransition]
|
|
public static extern bool SetConsoleCtrlHandler(ConsoleCtrlDelegate? handlerRoutine, bool add);
|
|
|
|
[DllImport(Libraries.Kernel32)]
|
|
[SuppressGCTransition]
|
|
public static extern bool GenerateConsoleCtrlEvent(uint dwCtrlEvent, uint dwProcessGroupId);
|
|
}
|
|
} |