rdsedmundo

OldHack.cpp

May 31st, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.66 KB | None | 0 0
  1. #include <windows.h>
  2.  
  3. extern int ShowForm();
  4.  
  5. bool isFormLoaded = false;
  6.  
  7. void eFormLoad() {
  8.     memmove(NULL, NULL, sizeof(NULL));
  9.     DWORD Fuck;
  10.     VirtualProtect(NULL, sizeof(NULL), Fuck, &Fuck);
  11.  
  12.     return;
  13. }
  14.  
  15. void fMClose() {
  16.     ExitProcess(0);
  17. }
  18.  
  19. int hExit() {
  20.    return 0;
  21. }
  22.  
  23. void __declspec(naked) nExit() {
  24.     hExit();
  25. }
  26.  
  27. void _cdecl pCode() {
  28.     if(!isFormLoaded) {
  29.         isFormLoaded = true;
  30.         //FreeLibrary(GetModuleHandleA("BugTrap.dll"));
  31.         ShowForm();
  32.         return;
  33.     }
  34.     return;
  35. }
  36.  
  37. void WriteJMP(byte* location,byte* newFunction){
  38.         DWORD dwOldProtection;
  39.         VirtualProtect(location,5, PAGE_EXECUTE_READWRITE,&dwOldProtection);
  40.                 location[0]=0xE9;
  41.                 *((int*)(location+1))=(int)(newFunction - location)-5;
  42.         VirtualProtect(location,5, dwOldProtection,&dwOldProtection);
  43. }
  44.  
  45. void WINAPI fHook(LPCSTR nMol, LPCSTR fName, byte* nFunc) {
  46.     WriteJMP((byte*) GetProcAddress(GetModuleHandleA(nMol), fName), nFunc);
  47. }
  48.  
  49. void DoStuff() {
  50.    /*fHook("kernel32.dll", "ExitProcess", (byte*) nExit);
  51.    fHook("kernel32.dll", "TerminateProcess", (byte*) nExit);*/
  52.  //  fHook("kernel32.dll", "ExitThread", (byte*) nExit);
  53.    //fHook("kernel32.dll", "GetTickCount", (byte*) pCode);
  54. /*  WriteJMP((byte*)GetProcAddress(GetModuleHandleA("Winmm.dll"), "timeGetTime"), (byte*) UndecCode);
  55.     WriteJMP((byte*)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetPQueryPerformanceCounter"), (byte*) UndecCode);
  56. */
  57. }
  58.  
  59. BOOL WINAPI DllMain ( HMODULE hModule, DWORD dwReason, LPVOID lpvReserved )
  60. {
  61.     if ( dwReason == DLL_PROCESS_ATTACH) {
  62.             DisableThreadLibraryCalls(hModule);
  63.             DoStuff();
  64.     }
  65.     return TRUE;
  66. }
Add Comment
Please, Sign In to add comment