process/src/Process.Win.Notify/Interop.cs
Louis Seubert d3bd04fe39
All checks were successful
default / dotnet default workflow (8.0) (push) Successful in 47s
chore: add copyright header
2024-05-10 21:49:43 +02:00

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);
}
}