Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <signal.h>
- #define NOMINMAX
- #include <Windows.h>
- #include <iostream>
- LONG ExFilter(unsigned long no)
- {
- return (no == EXCEPTION_ILLEGAL_INSTRUCTION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
- }
- void sigHandler(int )
- {
- std::cout << "caught by signal\n";
- }
- int main()
- {
- signal(SIGILL, sigHandler);
- __try
- {
- _asm __emit 0Fh
- _asm __emit 3fh
- _asm __emit 07h
- _asm __emit 0Bh
- }
- __except (ExFilter(GetExceptionCode()))
- {
- std::cout << "Illegal caught by exception";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment