【发布时间】:2018-12-03 07:28:04
【问题描述】:
我有一个用于游戏(类似于 Minecraft)的 C++ 程序 hack,它可以为我提供更多物品,并且运行良好。但令人讨厌的是,每当我关闭程序并重新启动它时,值都会发生变化。我通过 static Values 克服了那部分,但我意识到您不能将它们放入 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) 它会给我一个错误说 identifier "p" is undefined 和 *Expected成员名 *
无论如何,如果我将它放入 C++ 程序并下载到其他计算机上,我就不必经常更改值
【问题讨论】:
-
如果没有最小的、可验证的示例,很难为您提供帮助。
-
你要什么资料,我可以解释的蛮多的
-
“只是为了让你知道,除非你下载了游戏,否则这是行不通的。”请花点时间接受the tour 并通过minimal, verifiable, example 重新发布您的问题,这样我们才能真正帮助您。
标签: c++