Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void crash(LPVOID addr) {
- DWORD oldProtect;
- //protect address to read only
- VirtualProtect(addr, 1, PAGE_READONLY, &oldProtect);
- typedef void (*FuncPtr)();
- FuncPtr func = reinterpret_cast<FuncPtr>(addr);
- func(); //execute so you crash
- }
- BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
- {
- switch (dwReasonForCall)
- {
- case DLL_PROCESS_ATTACH:
- crash(reinterpret_cast<LPVOID>(0xDEADC0DE));
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement