Skip to content

Instantly share code, notes, and snippets.

@olliencc
Created January 3, 2022 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save olliencc/8dbf48bd93063ffe8ee66867545bb665 to your computer and use it in GitHub Desktop.
Save olliencc/8dbf48bd93063ffe8ee66867545bb665 to your computer and use it in GitHub Desktop.
void InstallHandler()
{
LPVOID myMalHandler = NULL;
// Allocate some memory
myMalHandler = VirtualAlloc(NULL, 1000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
//
// Copy shellcode or similar into myMalHandler here
//
// Add the handler
AddVectoredExceptionHandler(false, (PVECTORED_EXCEPTION_HANDLER)myMalHandler);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment