WindowsSignalHandlerRegistration.cs
1 using System; 2 using System.Runtime.InteropServices; 3 4 namespace Ryujinx.Cpu.Signal 5 { 6 static partial class WindowsSignalHandlerRegistration 7 { 8 [LibraryImport("kernel32.dll")] 9 private static partial IntPtr AddVectoredExceptionHandler(uint first, IntPtr handler); 10 11 [LibraryImport("kernel32.dll")] 12 private static partial ulong RemoveVectoredExceptionHandler(IntPtr handle); 13 14 public static IntPtr RegisterExceptionHandler(IntPtr action) 15 { 16 return AddVectoredExceptionHandler(1, action); 17 } 18 19 public static bool RemoveExceptionHandler(IntPtr handle) 20 { 21 return RemoveVectoredExceptionHandler(handle) != 0; 22 } 23 } 24 }