所以我是c ++的新手(很新),我一直在尝试使用这段代码7个小时, 而且我不知道为什么它不起作用,它的编译很好,但它看起来像写错了地址,我有一种感觉我弄错了,谢谢。
#include<iostream>
#include<windows.h>
#include<stdlib.h>
using namespace std;
int main() {
DWORD id;
HANDLE handle;
HWND wnd;
unsigned int baseadd = {0x021da060};
unsigned int ptemp;
unsigned int pointer;
unsigned int newdata = 5000;
wnd = FindWindow(NULL, "AssaultCube");
GetWindowThreadProcessId(wnd,&id);
handle = OpenProcess(PROCESS_ALL_ACCESS,FALSE,id);
ReadProcessMemory(handle,(LPVOID)baseadd,&ptemp,sizeof(ptemp),0);
pointer =ptemp + 0x384;
ReadProcessMemory(handle,(LPVOID)pointer,&ptemp,sizeof(ptemp),0);
pointer =ptemp + 0x14;
ReadProcessMemory(handle,(LPVOID)baseadd,&ptemp,sizeof(ptemp),0);
pointer =ptemp + 0x0;
cout << &pointer; // just to check if it was the right address , its not
WriteProcessMemory(handle,(LPVOID)pointer,&newdata,sizeof(newdata),NULL);
}
答案 0 :(得分:1)
问题可能是您实际上并未打印pointer
变量的值,而是打印其位置。 address-of运算符&
返回指向变量的指针。