Guest User

Untitled

a guest
Jul 22nd, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.46 KB | None | 0 0
  1. #include "../Win32Tools/Win32Tools.h"
  2.  
  3. DWORD
  4. get_current_zoom_offset (HANDLE process)
  5. {
  6.     char *mask = create_mask_from_file("zoom_patterns.txt");
  7.  
  8.     char *pattern =
  9.         "\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\x80"
  10.         "\x89\x44\x00\xC0\xB7\x44\x00\x80\x89\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44"
  11.         "\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x7C\xFF"
  12.         "\x8B\x00\x64\x3E\x8F\x00\x54\x3E\x8F\x00\x00\x00\x00\x00\x7C\xFF\x8B\x00"
  13.         "\xC4\x3E\x8F\x00\x70\x3E\x8F\x00\xE8\x03\x00\x00\x7C\xFF\x8B\x00\x28\x3F"
  14.         "\x8F\x00\xD8\x3E\x8F\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  15.         "\x00\x04\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\xC0\xB7\x44\x00\xC0"
  16.         "\xB7\x44\x00\x80\x89\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44"
  17.         "\x7C\xFF\x8B\x00\xA8\x5C\x8F\x00\x94\x5C\x8F\x00\x00\x00\x00\x00\x6C\xFF"
  18.         "\x8B\x00\xCC\x5C\x8F\x00\xB0\x5C\x8F\x00\x00\x00\xC8\x42\x6C\xFF\x8B\x00"
  19.         "\x00\x5D\x8F\x00\xE4\x5C\x8F\x00\x00\x00\x48\x42\x6C\xFF\x8B\x00\x38\x5D"
  20.         "\x8F\x00\x18\x5D\x8F\x00\x00\x00\x48\x43\x6C\xFF\x8B\x00\x64\x5D\x8F\x00"
  21.         "\x44\x5D\x8F\x00\x00\x40\x35\x45\x6C\xFF\x8B\x00\x90\x5D\x8F\x00\x70\x5D"
  22.         "\x8F\x00\x00\x48\x55\x46\x6C\xFF\x8B\x00\xBC\x5D\x8F\x00\x9C\x5D\x8F\x00"
  23.         "\x00\x40\x1C\x46";
  24.  
  25.     DWORD address = find_pattern_process(process, 0x800000, 0xC00000, (PBYTE) pattern, mask);
  26.  
  27.     if (address == 0)
  28.         return 0;
  29.  
  30.     return address + strlen(mask);
  31. }
  32.  
  33. DWORD
  34. get_max_zoom_offset (HANDLE process)
  35. {
  36.     char *mask = "xxxx???xxxxxxxxx";
  37.     char *pattern = "\x00\xA0\x0C\x45\x74\x46\x63\x46\x00\x00\x70\x41\x00\x00\xFA\x43";
  38.  
  39.     return find_pattern_process(process, 0x800000, 0xC00000, (PBYTE) pattern, mask);
  40. }
  41.  
  42. void
  43. display_info (DWORD pid, DWORD current_zoom, DWORD max_zoom, int old_max_zoom_value, int max_zoom_value, int zoom_value)
  44. {
  45.     console_stack_pos(PUSH_POS);
  46.     console_set_col(0x0F);
  47.     console_set_pos(50, 0); printf("================ Info ================");
  48.     console_set_pos(50, 1); printf("PID . . . . . . . . . . . : %d", (int) pid);
  49.     console_set_pos(50, 2); printf("Zoom Address. . . . . . . : 0x%p", (void *) current_zoom);
  50.     console_set_pos(50, 3); printf("MaxZoom Address . . . . . : 0x%p", (void *) max_zoom);
  51.     console_set_pos(50, 4); printf("Old MaxZoom value . . . . : %d", old_max_zoom_value);
  52.     console_set_pos(50, 5); printf("New MaxZoom value . . . . : %d", max_zoom_value);
  53.     console_set_pos(50, 6); printf("Current Zoom value. . . . : %d", zoom_value);
  54.     console_stack_pos(POP_POS);
  55. }
  56.  
  57.  
  58. int
  59. main (int argc, char *argv[])
  60. {
  61.     HWND window;
  62.     HANDLE process;
  63.     DWORD pid;
  64.     DWORD current_zoom;
  65.     DWORD max_zoom;
  66.     int zoom_value, old_max_zoom_value;
  67.     unsigned int max_zoom_value = 1168455296;
  68.     unsigned int loading_screen = 1;
  69.  
  70.     console_set_size(90, 30);
  71.  
  72.     console_set_col(0x0F);
  73.     printf (
  74.             " -----------------------------------------\n"
  75.             " ------ League Of Legends Zoom Hack ------\n"
  76.             " ---------- Date : 2012-04-04 ------------\n"
  77.             " - Last working game version : 1.0.0.136 -\n"
  78.             " ----------- Author : Spl3en -------------\n"
  79.             " ------------ Version : 1.0 --------------\n"
  80.             " -----------------------------------------\n\n\n");
  81.  
  82.     warning("Waiting League Of Legends.exe window...");
  83.  
  84.     while (1)
  85.     {
  86.         if ((window = FindWindowA(NULL, "League of Legends (TM) Client")) != 0)
  87.         {
  88.             loading_screen--;
  89.             break;
  90.         }
  91.  
  92.         loading_screen++;
  93.         Sleep(1000);
  94.     }
  95.  
  96.     info("League Of Legends in-game window found !");
  97.  
  98.     if (loading_screen > 5)
  99.         info("Loading Screen detected.");
  100.     else
  101.         loading_screen = 0;
  102.  
  103.     GetWindowThreadProcessId(window, &pid);
  104.  
  105.     process = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
  106.  
  107.     if (process == 0)
  108.         error("OpenProcess failed!");
  109.  
  110.     if ((current_zoom = get_current_zoom_offset(process)) == 0)
  111.         error("Zoom address has not been found. Maybe an update ?");
  112.  
  113.     while (1)
  114.     {
  115.         if ((max_zoom = get_max_zoom_offset(process)) == 0)
  116.         {
  117.             if (loading_screen)
  118.             {
  119.                 info("Waiting for the end of loading screen... 10s pause");
  120.                 Sleep(1000 * 10);
  121.             }
  122.  
  123.             else
  124.                 error("Max Zoom address has not been found.\nIt means that the client was :\n\t- 1) already patched\n\t- 2) modified\n\t- 3) Not ready yet (Loading Screen)\nPlease restart the program.");
  125.         }
  126.         else
  127.             break;
  128.     }
  129.  
  130.     if ((old_max_zoom_value = read_memory_as_int(process, max_zoom)) == 0)
  131.         warning("Old max zoom value cannot be read.");
  132.  
  133.     if (!write_memory_as_int(process, max_zoom, max_zoom_value))
  134.         warning("The max zoom cannot be patched. Please restart the program.");
  135.  
  136.     else
  137.         info("Max zoom patched !");
  138.  
  139.     /* ---------------------------------------------------- */
  140.     while (1)
  141.     {
  142.         zoom_value     = read_memory_as_int (process, current_zoom);
  143.         max_zoom_value = read_memory_as_int (process, max_zoom);
  144.  
  145.         display_info(pid, current_zoom, max_zoom, old_max_zoom_value, max_zoom_value, zoom_value);
  146.  
  147.         if (zoom_value == 0)
  148.         {
  149.             // Something went maybe wrong, let's check the PID
  150.             GetWindowThreadProcessId(window, &pid);
  151.  
  152.             if (pid == -1)
  153.             {
  154.                 warning("League Of Legends.exe seems now closed.");
  155.                 break;
  156.             }
  157.  
  158.             else
  159.             {
  160.                 // the PID changed. We need to get the new process
  161.                 if ((process = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)) == 0)
  162.                 {
  163.                     warning("League Of Legends.exe seems now closed.");
  164.                     break;
  165.                 }
  166.  
  167.                 if ((current_zoom = get_current_zoom_offset(process)) == 0)
  168.                 {
  169.                     warning("League Of Legends.exe seems now closed");
  170.                     break;
  171.                 }
  172.             }
  173.         }
  174.  
  175.         Sleep(100);
  176.     }
  177.  
  178.     info("Good bye !");
  179.  
  180.     return 0;
  181. }
Add Comment
Please, Sign In to add comment