Guest User

Untitled

a guest
Oct 8th, 2017
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1.  
  2. #include <cstdlib>
  3. #include <signal.h>
  4. #define NOMINMAX
  5. #include <Windows.h>
  6. #include <iostream>
  7. LONG ExFilter(unsigned long no)
  8. {
  9. return (no == EXCEPTION_ILLEGAL_INSTRUCTION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
  10. }
  11.  
  12. void sigHandler(int )
  13. {
  14. std::cout << "caught by signal\n";
  15. }
  16. int main()
  17. {
  18. signal(SIGILL, sigHandler);
  19. __try
  20. {
  21. _asm __emit 0Fh
  22. _asm __emit 3fh
  23. _asm __emit 07h
  24. _asm __emit 0Bh
  25. }
  26. __except (ExFilter(GetExceptionCode()))
  27. {
  28. std::cout << "Illegal caught by exception";
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment