Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <Windows.h>
- using namespace std;
- HWND hwnd;
- HANDLE phandle;
- DWORD pid;
- int displayValue;
- void printMenu()
- {
- cout << "Running:\n Current Value:\t" << displayValue <<"\t"; // "Running: (nextline) Current Value : 103"
- }
- void WriteToMemory(UINT address, int value)
- {
- if (WriteProcessMemory(phandle, (void*)address, &value, sizeof(value), 0))
- {
- cout << "Something went wrong in WriteToMemory\n" << endl;
- }
- else
- {
- cout << "Overwrite success";
- }
- }
- int ReadIntFromAddress(UINT address)
- {
- int val = 0;
- //cout << hex << address << endl;
- if (ReadProcessMemory(phandle, (void*)address, &val, sizeof(val), NULL) == 0)
- {
- cout << "Something went wrong in ReadIntFromAddress" << endl; // print error code if something goes wrong
- }
- return val;
- }
- // Purpose:
- // Set animation to anything :v
- // thru the uparrow and downarrow keys scrolling thru the list
- //
- // up - down increase/decrease values of 'value' from pointer 'attackState'
- // right - quits program
- // thanks Matte :3 for coming up with 90% of code
- int main()
- {
- cout << "Animation Set-er\n";
- int attackState = 0x019F9F5C;
- hwnd = FindWindowA(NULL, "Gunz the Second Duel 1.0.0.55354");
- if (!hwnd) //If none, display an error
- {
- cout << "Window not found!\n";
- system("pause");
- return 0;
- }
- GetWindowThreadProcessId(hwnd, &pid); //Get the process id and place it in pid
- //phandle = OpenProcess(PROCESS_VM_READ, 0, pid); //Get permission to read
- phandle = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_READ | PROCESS_VM_OPERATION, 0, pid);
- cout << "Test breakpoint 5\n";
- if (!phandle) //Once again, if it fails, tell us
- {
- cout << "Could not get handle!\n";
- system("pause");
- return 0;
- }
- int value = (ReadIntFromAddress(attackState));
- int turnoff = 0;
- while (turnoff==0)
- {
- if (GetAsyncKeyState(VK_UP)) // uparrow increases value by 1
- value = value + 0x1;
- if (GetAsyncKeyState(VK_DOWN))//downarrow decreases value by 1
- value = value - 0x1;
- if (GetAsyncKeyState(VK_RIGHT))//right arrow exits
- turnoff = 1;
- displayValue = value;
- WriteToMemory(attackState, value);
- value = ReadIntFromAddress(attackState);
- printMenu();
- Sleep(500);
- system("cls");
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement