Last active
March 2, 2021 18:56
-
-
Save TheEpicFace007/14816335fb67a2e421b2611c9daf997e to your computer and use it in GitHub Desktop.
ignore all exception
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <iostream> | |
LONG WINAPI RedirectedSetUnhandledExceptionFilter(EXCEPTION_POINTERS *ExceptionInfo);; | |
int main() | |
{ | |
SetUnhandledExceptionFilter(RedirectedSetUnhandledExceptionFilter); | |
} | |
LONG WINAPI RedirectedSetUnhandledExceptionFilter(EXCEPTION_POINTERS *ExceptionInfo) | |
{ | |
auto result = MessageBoxA(NULL, "An exception has been caught. Do you wish to continue the execution of the program?", "Exception handling", MB_ICONQUESTION | MB_YESNO); | |
if (result == IDYES) | |
return EXCEPTION_CONTINUE_EXECUTION; | |
else | |
return EXCEPTION_EXECUTE_HANDLER; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <iostream> | |
LONG WINAPI RedirectedSetUnhandledExceptionFilter(EXCEPTION_POINTERS *ExceptionInfo);; | |
int main() | |
{ | |
SetUnhandledExceptionFilter(RedirectedSetUnhandledExceptionFilter); | |
} | |
LONG WINAPI RedirectedSetUnhandledExceptionFilter(EXCEPTION_POINTERS * ExceptionInfo) | |
{ | |
//When the CRT calls SetUnhandledExceptionFilter with NULL parameter | |
// our handler will not get removed. | |
std::cerr << "Caught an exception.\n"; | |
std::cerr << "Ignoring the exception\n"; | |
return EXCEPTION_CONTINUE_EXECUTION; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment