WindowsSignalHandlerRegistration.cs 715 B

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