@@ -8,21 +8,25 @@ namespace YoutubeDl.Wpf.Utils;
88/// Related issue: https://github.com/dotnet/runtime/issues/14628
99/// Reference: https://stackoverflow.com/questions/283128/how-do-i-send-ctrlc-to-a-process-in-c
1010/// </summary>
11- internal static class CtrlCHelper
11+ internal static partial class CtrlCHelper
1212{
1313 internal const int CTRL_C_EVENT = 0 ;
1414
15- [ DllImport ( "kernel32.dll" ) ]
16- internal static extern bool GenerateConsoleCtrlEvent ( uint dwCtrlEvent , uint dwProcessGroupId ) ;
15+ [ LibraryImport ( "kernel32.dll" ) ]
16+ [ return : MarshalAs ( UnmanagedType . Bool ) ]
17+ internal static partial bool GenerateConsoleCtrlEvent ( uint dwCtrlEvent , uint dwProcessGroupId ) ;
1718
18- [ DllImport ( "kernel32.dll" , SetLastError = true ) ]
19- internal static extern bool AttachConsole ( uint dwProcessId ) ;
19+ [ LibraryImport ( "kernel32.dll" , SetLastError = true ) ]
20+ [ return : MarshalAs ( UnmanagedType . Bool ) ]
21+ internal static partial bool AttachConsole ( uint dwProcessId ) ;
2022
21- [ DllImport ( "kernel32.dll" , SetLastError = true , ExactSpelling = true ) ]
22- internal static extern bool FreeConsole ( ) ;
23+ [ LibraryImport ( "kernel32.dll" , SetLastError = true ) ]
24+ [ return : MarshalAs ( UnmanagedType . Bool ) ]
25+ internal static partial bool FreeConsole ( ) ;
2326
24- [ DllImport ( "kernel32.dll" ) ]
25- internal static extern bool SetConsoleCtrlHandler ( ConsoleCtrlDelegate ? HandlerRoutine , bool Add ) ;
27+ [ LibraryImport ( "kernel32.dll" ) ]
28+ [ return : MarshalAs ( UnmanagedType . Bool ) ]
29+ internal static partial bool SetConsoleCtrlHandler ( ConsoleCtrlDelegate ? HandlerRoutine , [ MarshalAs ( UnmanagedType . Bool ) ] bool Add ) ;
2630
2731 internal delegate bool ConsoleCtrlDelegate ( uint dwCtrlType ) ;
2832}
0 commit comments