Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "../Win32Tools/Win32Tools.h"
- DWORD
- get_current_zoom_offset (HANDLE process)
- {
- char *mask = create_mask_from_file("zoom_patterns.txt");
- char *pattern =
- "\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\x80"
- "\x89\x44\x00\xC0\xB7\x44\x00\x80\x89\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44"
- "\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x7C\xFF"
- "\x8B\x00\x64\x3E\x8F\x00\x54\x3E\x8F\x00\x00\x00\x00\x00\x7C\xFF\x8B\x00"
- "\xC4\x3E\x8F\x00\x70\x3E\x8F\x00\xE8\x03\x00\x00\x7C\xFF\x8B\x00\x28\x3F"
- "\x8F\x00\xD8\x3E\x8F\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
- "\x00\x04\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\xC0\xB7\x44\x00\xC0"
- "\xB7\x44\x00\x80\x89\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44\x00\xC0\xB7\x44"
- "\x7C\xFF\x8B\x00\xA8\x5C\x8F\x00\x94\x5C\x8F\x00\x00\x00\x00\x00\x6C\xFF"
- "\x8B\x00\xCC\x5C\x8F\x00\xB0\x5C\x8F\x00\x00\x00\xC8\x42\x6C\xFF\x8B\x00"
- "\x00\x5D\x8F\x00\xE4\x5C\x8F\x00\x00\x00\x48\x42\x6C\xFF\x8B\x00\x38\x5D"
- "\x8F\x00\x18\x5D\x8F\x00\x00\x00\x48\x43\x6C\xFF\x8B\x00\x64\x5D\x8F\x00"
- "\x44\x5D\x8F\x00\x00\x40\x35\x45\x6C\xFF\x8B\x00\x90\x5D\x8F\x00\x70\x5D"
- "\x8F\x00\x00\x48\x55\x46\x6C\xFF\x8B\x00\xBC\x5D\x8F\x00\x9C\x5D\x8F\x00"
- "\x00\x40\x1C\x46";
- DWORD address = find_pattern_process(process, 0x800000, 0xC00000, (PBYTE) pattern, mask);
- if (address == 0)
- return 0;
- return address + strlen(mask);
- }
- DWORD
- get_max_zoom_offset (HANDLE process)
- {
- char *mask = "xxxx???xxxxxxxxx";
- char *pattern = "\x00\xA0\x0C\x45\x74\x46\x63\x46\x00\x00\x70\x41\x00\x00\xFA\x43";
- return find_pattern_process(process, 0x800000, 0xC00000, (PBYTE) pattern, mask);
- }
- void
- display_info (DWORD pid, DWORD current_zoom, DWORD max_zoom, int old_max_zoom_value, int max_zoom_value, int zoom_value)
- {
- console_stack_pos(PUSH_POS);
- console_set_col(0x0F);
- console_set_pos(50, 0); printf("================ Info ================");
- console_set_pos(50, 1); printf("PID . . . . . . . . . . . : %d", (int) pid);
- console_set_pos(50, 2); printf("Zoom Address. . . . . . . : 0x%p", (void *) current_zoom);
- console_set_pos(50, 3); printf("MaxZoom Address . . . . . : 0x%p", (void *) max_zoom);
- console_set_pos(50, 4); printf("Old MaxZoom value . . . . : %d", old_max_zoom_value);
- console_set_pos(50, 5); printf("New MaxZoom value . . . . : %d", max_zoom_value);
- console_set_pos(50, 6); printf("Current Zoom value. . . . : %d", zoom_value);
- console_stack_pos(POP_POS);
- }
- int
- main (int argc, char *argv[])
- {
- HWND window;
- HANDLE process;
- DWORD pid;
- DWORD current_zoom;
- DWORD max_zoom;
- int zoom_value, old_max_zoom_value;
- unsigned int max_zoom_value = 1168455296;
- unsigned int loading_screen = 1;
- console_set_size(90, 30);
- console_set_col(0x0F);
- printf (
- " -----------------------------------------\n"
- " ------ League Of Legends Zoom Hack ------\n"
- " ---------- Date : 2012-04-04 ------------\n"
- " - Last working game version : 1.0.0.136 -\n"
- " ----------- Author : Spl3en -------------\n"
- " ------------ Version : 1.0 --------------\n"
- " -----------------------------------------\n\n\n");
- warning("Waiting League Of Legends.exe window...");
- while (1)
- {
- if ((window = FindWindowA(NULL, "League of Legends (TM) Client")) != 0)
- {
- loading_screen--;
- break;
- }
- loading_screen++;
- Sleep(1000);
- }
- info("League Of Legends in-game window found !");
- if (loading_screen > 5)
- info("Loading Screen detected.");
- else
- loading_screen = 0;
- GetWindowThreadProcessId(window, &pid);
- process = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
- if (process == 0)
- error("OpenProcess failed!");
- if ((current_zoom = get_current_zoom_offset(process)) == 0)
- error("Zoom address has not been found. Maybe an update ?");
- while (1)
- {
- if ((max_zoom = get_max_zoom_offset(process)) == 0)
- {
- if (loading_screen)
- {
- info("Waiting for the end of loading screen... 10s pause");
- Sleep(1000 * 10);
- }
- else
- 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.");
- }
- else
- break;
- }
- if ((old_max_zoom_value = read_memory_as_int(process, max_zoom)) == 0)
- warning("Old max zoom value cannot be read.");
- if (!write_memory_as_int(process, max_zoom, max_zoom_value))
- warning("The max zoom cannot be patched. Please restart the program.");
- else
- info("Max zoom patched !");
- /* ---------------------------------------------------- */
- while (1)
- {
- zoom_value = read_memory_as_int (process, current_zoom);
- max_zoom_value = read_memory_as_int (process, max_zoom);
- display_info(pid, current_zoom, max_zoom, old_max_zoom_value, max_zoom_value, zoom_value);
- if (zoom_value == 0)
- {
- // Something went maybe wrong, let's check the PID
- GetWindowThreadProcessId(window, &pid);
- if (pid == -1)
- {
- warning("League Of Legends.exe seems now closed.");
- break;
- }
- else
- {
- // the PID changed. We need to get the new process
- if ((process = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)) == 0)
- {
- warning("League Of Legends.exe seems now closed.");
- break;
- }
- if ((current_zoom = get_current_zoom_offset(process)) == 0)
- {
- warning("League Of Legends.exe seems now closed");
- break;
- }
- }
- }
- Sleep(100);
- }
- info("Good bye !");
- return 0;
- }
Add Comment
Please, Sign In to add comment