chore: rework windows signal notify
This commit is contained in:
parent
b54acec2f2
commit
b7517a7fee
3 changed files with 50 additions and 30 deletions
38
src/Process.Win.Notify/Interop.cs
Normal file
38
src/Process.Win.Notify/Interop.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue