-
-
Save olliencc/a17bb1e3b5aea320e8b9c69526fd3bed to your computer and use it in GitHub Desktop.
Toy code to demonstrate a malhandler
This file contains 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
void InstallHandlers() | |
{ | |
AddVectoredExceptionHandler(true, (PVECTORED_EXCEPTION_HANDLER)MyUnhandledExceptionFilter); | |
_tprintf(TEXT("[i] Registered exception handler %p\n"), &MyUnhandledExceptionFilter); | |
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)MyUnhandledExceptionFilter2); | |
_tprintf(TEXT("[i] Registered second exception handler %p\n"), &MyUnhandledExceptionFilter2); | |
// Register the third | |
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)MyUnhandledExceptionFilter3); | |
_tprintf(TEXT("[i] Registered third exception handler %p\n"), &MyUnhandledExceptionFilter3); | |
// Register the fourth | |
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)MyUnhandledExceptionFilter4); | |
_tprintf(TEXT("[i] Registered fourth exception handler %p\n"), &MyUnhandledExceptionFilter4); | |
// Register the fourth lots | |
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)MyUnhandledExceptionFilter4); | |
_tprintf(TEXT("[i] Registered fourth exception handler %p\n"), &MyUnhandledExceptionFilter4); | |
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)MyUnhandledExceptionFilter4); | |
_tprintf(TEXT("[i] Registered fourth exception handler %p\n"), &MyUnhandledExceptionFilter4); | |
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)MyUnhandledExceptionFilter4); | |
_tprintf(TEXT("[i] Registered fourth exception handler %p\n"), &MyUnhandledExceptionFilter4); | |
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)MyUnhandledExceptionFilter4); | |
_tprintf(TEXT("[i] Registered fourth exception handler %p\n"), &MyUnhandledExceptionFilter4); | |
LPVOID myMalHandler = NULL; | |
// Allocate some memory | |
myMalHandler = VirtualAlloc(NULL, 1000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE); | |
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)myMalHandler); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment