所以我是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);
}
问题可能是您实际上没有打印pointer
变量的值,而是打印了变量的位置。地址运算符&
返回指向变量的指针。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句