我有一个游戏的C ++程序黑客(类似于Minecraft),可以为我提供更多物品,并且效果很好。但是令人讨厌的是,每当我关闭程序并重新启动它时,值都会改变。我通过静态值克服了这一部分,但是我意识到您不能将它们放入C ++程序中。这是代码的样子。 (只是告诉您,除非您下载了游戏,否则这将无法工作)
#include "stdafx.h"
#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
// Important Pointers-----------------
DWORD item = 0x23CE113C; // <- this part will change every time game is closed
//------------------------
DWORD processID;
int hackeditem;
int main() {
std::cout << "Looking For Selected Game";
Sleep(1000);
system("cls");
HWND hwnd = FindWindow(0, ("Block Story")); //This searches for Window
if (hwnd) {
cout << "Found Selected Game!" << endl;
system("pause");
system("cls");
int item;
cout << "What Item Do You Want To Hack?" << endl;
cout << "1. Wood" << endl;
cin >> item;
if (item == 1) {
system("cls");
cout << "Enter The Amount Of The Item You Want: " << flush;
cin >> hackeditem;
cout << "Press Enter When Ready To Hack" << endl;
system("pause");
system("cls");
}
else {
cout << "Selected Game Not Found :(" << endl;
Sleep(1000);
cout << "Hint, Try opening Selected Game First, Then This" << endl;
system("pause");
return 0;
}
GetWindowThreadProcessId(hwnd, &processID);
HANDLE pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processID);
WriteProcessMemory(pHandle, (LPVOID)item, &hackeditem, sizeof(hackeditem), 0);
// Code above this gets game memory, and code above edits it
}
else {
return 0;
}
return 0;
}
,这是指针的样子:
但是,如果我将指针放在那里(p-> 2310905C),则会给我一个错误,提示 标识符“ p”未定义 和 *期望会员名称*
无论如何,如果我将其放在C ++程序中并下载到someelses计算机上,则不必不断更改值
答案 0 :(得分:0)
没有太多信息很难帮助您。是您关闭作弊程序还是游戏的“程序”?我会说要在程序运行时保存并关闭游戏,然后关闭程序。
答案 1 :(得分:0)
在外部培训师中,如果您想使用Cheat Engine记录的多级指针,可以使用流行的FindDMAAddy()函数。它将取消引用每个指针并为您添加偏移量,并返回指针链指向的最终地址。然后,您可以使用WriteProcessMemory写入结果地址
uintptr_t FindDMAAddy(HANDLE hProc, uintptr_t ptr, std::vector<unsigned int> offsets)
{
uintptr_t addr = ptr;
for (unsigned int i = 0; i < offsets.size(); ++i)
{
ReadProcessMemory(hProc, (BYTE*)addr, &addr, sizeof(addr), 0);
addr += offsets[i];
}
return addr;
}
//example
uintptr_t ammoAddr = FindDMAAddy(hProcess, dynamicPtrBaseAddr, { 0x374, 0x14, 0x0 });