对内存位置的访问无效。 [英] Invalid access to memory location.

查看:1108
本文介绍了对内存位置的访问无效。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何修复此错误:"对内存位置的访问无效。"

How to fix this error: "Invalid access to memory location."

错误代码:998。

这我使用WriteProcessMemory时出现错误。可能与其他函数如ReadProcessMemory一样出现。

This error appears when I using WriteProcessMemory. May be with other functions like ReadProcessMemory appear too.

我不知道。

我的代码C ++:

#include <Windows.h>

__int64 Base = 0x7FF71F9AD418;
__int64 Score = Base + 0x30 + 0x120;
int hundred = 1000;

int main() {
    HWND hwnd = FindWindow(0, L"Purble Place");
    DWORD pID;
    HANDLE h;
    if (!hwnd) { MessageBox(0, L"Start game", 0, 0); return 0; }
    GetWindowThreadProcessId(hwnd, &pID);
    h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID);
    if (!h) { MessageBox(0, L"Handle not found.", 0, 0); return 0; }
//If all good
    WriteProcessMemory(h, (LPVOID)Score, &hundred, sizeof(hundred), NULL); 

    return 0;
}

如何解决?

推荐答案

这实际上非常简单。连续两次运行相同的应用程序可能不会每次都将所有内容放在同一个地方。事实上,它更可能没有在同一个地方。

This is actually quite simple. Running the same application two times in a row may not place everything in the same place every time. In fact, it is more likely to not have things in the same place.

你是如何得到那个基地址的?如果你再次运行应用程序并使用相同的方法来检测基址,你会得到相同的结果吗?

How did you get that base address? if you ran the application again and used the same method to detect the base address, do you get the same result?


这篇关于对内存位置的访问无效。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆