【发布时间】:2017-07-08 08:26:38
【问题描述】:
我想访问和编辑内存中的多个地址。 如果它含糊不清,问题是:如果我使用内存扫描器并且结果是地址列表,我将如何访问和编辑它们? 我已经被告知尝试将所有地址放入一个数组中,我该怎么做?
这是目前为止的代码:
//
#include "stdafx.h"
#include "iostream"
#include "Windows.h"
#include <cstdint>
#include <stdint.h>
using namespace std;
int main()
{
int newValue = 0;
int* p;
p = (int*)0x4F6DCFE3DC; // now p points to address 0x220202
HWND hwnd = FindWindowA(NULL, "Call of Duty®: Modern Warfare® 3 Multiplayer");// Finds Window
if (hwnd == NULL) {// Tests for success
cout << "The window is not open" << endl;
Sleep(3000);
exit(-1);
}
else {
cout << "It's open boss!";
}
else {// If Successful Begins the following
DWORD procID;
GetWindowThreadProcessId(hwnd, &procID);
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);//Gets handle on process
if (procID == NULL) {
cout << "Cannot obtain process." << endl;
Sleep(3000);
exit(-1);
}
else {//Begins writing to memory
while (newValue == 0) {
/*This Writes*/WriteProcessMemory(handle, (LPVOID)0x04F6DCFE3DC, &newValue, sizeof(newValue), 0);
cout << p;
Sleep(3000);
}
}
}
}
【问题讨论】:
-
请使用tour,尤其是How to Ask。不发文字图片,发文字。制作minimal reproducible example。描述你想要达到的目标。描述地址列表的含义。为什么要编辑它们?描述您如何访问地址列表,代码图片显示通过常量进行的访问。编辑问题以获取更多信息,不要将信息写入问题的答案。
-
p = (int*)0x4F6DCFE3DC; // now p points to address 0x220202嗯!?这就是为什么 cmets 不应该描述明显的代码。代码经常更改,而 cmets 不会。然后它只是引起了人们的注意。 -
@StoryTeller 你的问题是评论说的很明显吗?
-
if {...} else {...} else {...}错了。 -
我投了反对票,因为这个问题一团糟。不想劝阻新用户,但如果你要粗鲁......
标签: c++ memory memory-address