Advertisement
Hidend

Untitled

Apr 18th, 2024
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. void crash(LPVOID addr) {
  2. DWORD oldProtect;
  3. //protect address to read only
  4. VirtualProtect(addr, 1, PAGE_READONLY, &oldProtect);
  5. typedef void (*FuncPtr)();
  6. FuncPtr func = reinterpret_cast<FuncPtr>(addr);
  7. func(); //execute so you crash
  8. }
  9.  
  10. BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
  11. {
  12. switch (dwReasonForCall)
  13. {
  14. case DLL_PROCESS_ATTACH:
  15. crash(reinterpret_cast<LPVOID>(0xDEADC0DE));
  16. break;
  17. case DLL_THREAD_ATTACH:
  18. case DLL_THREAD_DETACH:
  19. case DLL_PROCESS_DETACH:
  20. break;
  21. }
  22. return TRUE;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement