-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (36 loc) · 1.55 KB
/
main.cpp
File metadata and controls
40 lines (36 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <iostream>
#include <vector>
#include <Windows.h>
int main() {
HWND GameWindow = FindWindowA(NULL, "Command & Conquer Red Alert 3: Uprising");
DWORD pID, gameBaseAddress, pointAddress, baseAddress, pointsAddress;
gameBaseAddress = 0x00400000;
pointAddress = 0x008FC734;
baseAddress = NULL;
GetWindowThreadProcessId(GameWindow, &pID);
HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, false, pID);
std::vector<DWORD> pointsOffsets{0x28, 0x40, 0x70, 0x04, 0x34, 0x00, 0x04};
ReadProcessMemory(processHandle, (LPVOID)(gameBaseAddress + pointAddress), &baseAddress, sizeof(baseAddress), NULL);
pointsAddress = baseAddress;
for (int i = 0; i < pointsOffsets.size() - 1; i++)
{
ReadProcessMemory(processHandle, (LPVOID)(pointsAddress + pointsOffsets.at(i)), &pointsAddress, sizeof(pointsAddress), NULL);
}
pointsAddress += pointsOffsets.at(pointsOffsets.size() - 1);
std::cout << "Press Numpad 0 to EXIT" << std::endl;
std::cout << "Press Numpad 1 to set Points" << std::endl;
while (true) {
Sleep(50);
if (GetAsyncKeyState(VK_NUMPAD0)) {
return 0;
}
if (GetAsyncKeyState(VK_NUMPAD1)) {
std::cout << "How many credits would you like?" << std::endl;
int newPoints {};
std::cin >> newPoints;
WriteProcessMemory(processHandle, (LPVOID)(pointsAddress), &newPoints, sizeof(newPoints), NULL);
}
}
CloseHandle(processHandle);
return 0;
}