Advertisement
electroduck

Heroes and Generals NORECOIL

May 28th, 2015
1,001
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.79 KB | None | 0 0
  1. // THIS HACK NO LONGER WORKS, AND MAY GET YOU B& !!!
  2. /***************************************************************
  3.  * HEROES AND GENERALS - NO RECOIL HACK           28. MAY 2015 *
  4.  ***************************************************************
  5.  * COMPILING: Create a Win32 C++ command line program in       *
  6.  * Visual Studio, set character set to Multi-Byte and compile. *
  7.  * USAGE: Run the program AS ADMINISTRATOR while you are on    *
  8.  * the respawn screen in a H&G action-game battle.             *
  9.  ***************************************************************/
  10.  
  11. #include <windows.h>
  12. #include <stdio.h>
  13. #include <tlhelp32.h>
  14. #include <tchar.h>
  15. #include <string>
  16.  
  17. HWND hwnd;
  18. DWORD pid;
  19. HANDLE handle;
  20.  
  21. DWORD playerDLL;
  22.  
  23. DWORD getPlayer(DWORD pid) {
  24.     HANDLE hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
  25.     MODULEENTRY32 me32;
  26.     me32.dwSize = sizeof(MODULEENTRY32);
  27.  
  28.     for (;;) {
  29.         Module32Next(hModuleSnap, &me32);
  30.  
  31.         std::string compare = me32.szModule;
  32.         printf("\n%s", me32.szModule);
  33.  
  34.         if (compare == "player.dll") {
  35.             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN);
  36.             printf(" <-- PLAYER.DLL found!\n");
  37.             break;
  38.         }
  39.     }
  40.  
  41.     return (DWORD)me32.modBaseAddr;
  42. }
  43.  
  44. char pressanykey( const char *prompt ) {
  45.     DWORD        mode;
  46.     HANDLE       hstdin;
  47.     INPUT_RECORD inrec;
  48.     DWORD        count;
  49.     char         default_prompt[] = "\n[Press any key to exit]\n";
  50.     char         result           = '\0';
  51.  
  52.     /* Set the console mode to no-echo, raw input, */
  53.     /* and no window or mouse events.              */
  54.     hstdin = GetStdHandle( STD_INPUT_HANDLE );
  55.     if (hstdin == INVALID_HANDLE_VALUE
  56.         || !GetConsoleMode( hstdin, &mode )
  57.         || !SetConsoleMode( hstdin, 0 ))
  58.         return result;
  59.  
  60.     if (!prompt) prompt = default_prompt;
  61.  
  62.     /* Instruct the user */
  63.     WriteConsole(
  64.         GetStdHandle( STD_OUTPUT_HANDLE ),
  65.         prompt,
  66.         lstrlen( prompt ),
  67.         &count,
  68.         NULL
  69.         );
  70.  
  71.     FlushConsoleInputBuffer( hstdin );
  72.  
  73.     /* Wait for and get a single key PRESS */
  74.     do ReadConsoleInput( hstdin, &inrec, 1, &count );
  75.     while ((inrec.EventType != KEY_EVENT) || !inrec.Event.KeyEvent.bKeyDown);
  76.  
  77.     /* Remember which key the user pressed */
  78.     result = inrec.Event.KeyEvent.uChar.AsciiChar;
  79.  
  80.     /* Wait for and get a single key RELEASE */
  81.     do ReadConsoleInput( hstdin, &inrec, 1, &count );
  82.     while ((inrec.EventType != KEY_EVENT) || inrec.Event.KeyEvent.bKeyDown);
  83.  
  84.     /* Restore the original console mode */
  85.     SetConsoleMode( hstdin, mode );
  86.  
  87.     return result;
  88. }
  89.  
  90.  
  91. int main() {
  92.     HANDLE w32out = GetStdHandle(STD_OUTPUT_HANDLE);
  93.     SetConsoleTextAttribute(w32out, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
  94.     puts("HEROES AND GENERALS NO-RECOIL HACK\nOriginal program by flowing_around, updated & compiled by Electroduck");
  95.     SetConsoleTextAttribute(w32out, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
  96.     puts("https://www.youtube.com/channel/UCORHlCc9y18DYBMRd-Br3ZA\n");
  97.     SetConsoleTextAttribute(w32out, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
  98.  
  99.     hwnd = FindWindowA(0, "H&G");
  100.     GetWindowThreadProcessId(hwnd, &pid);
  101.     handle = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, 0, pid);
  102.  
  103.     if (handle) {
  104.         playerDLL = getPlayer(pid);
  105.  
  106.         WriteProcessMemory(handle, (LPVOID)(playerDLL + 0x001F5C71), &"\x90\x90\x90\x90\x90", 5, 0);
  107.  
  108.         SetConsoleTextAttribute(w32out, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  109.         puts("HACK ACTIVATED!");
  110.     } else {
  111.         SetConsoleTextAttribute(w32out, FOREGROUND_RED | FOREGROUND_INTENSITY);
  112.         puts("Hack failed! Make sure that:\n * The H&G action game is running, i.e. you are actually in a battle\n * This program is run as administrator");
  113.     }
  114.     SetConsoleTextAttribute(w32out, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
  115.     pressanykey(0);
  116.    
  117.     return 0;
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement