简体   繁体   English

ReadProcessMemory CheatEngine 值

[英]ReadProcessMemory CheatEngine Value

I want to get a value from a Proccess, here it's a simple test with "Calculator".我想从进程中获取一个值,这是一个使用“计算器”的简单测试。 First, I get the address with CheatEngine.首先,我使用 CheatEngine 获取地址。 Secondly I put it in ReadProcessMemory.其次,我把它放在 ReadProcessMemory 中。 But ReadProcessMemory return 0, I think I miss something, I've found something with BaseAddress, but I still have bad results.但是 ReadProcessMemory 返回 0,我想我错过了一些东西,我用 BaseAddress 找到了一些东西,但我仍然有不好的结果。 Google is out of results for me, so I ask you!谷歌对我来说没有结果,所以我问你!

#include <windows.h>
#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    int value;
    DWORD pid;
    HWND hwnd = FindWindow(NULL,"Calculatrice");
    if(!hwnd)
    {
             cout << "Window not found!";
    }
    else
    {
        GetWindowThreadProcessId(hwnd,&pid);
        HANDLE phandle = OpenProcess(PROCESS_ALL_ACCESS,0,pid);
        if(!phandle)
        {
                cout <<"Could not get handle!";
        }
        else
        {
                cout << ReadProcessMemory(phandle,(LPVOID)0xC71657E900,&value,sizeof(value),0) << endl;
                cout << value;
                getch();
                return 0;
        }
    }
}

Resolved !解决 ! When the address is too big, because it's a 64bit address, the program change to a 32bit address, that's why it don't work.当地址过大时,因为是64bit地址,程序改成32bit地址,所以不工作。

So, in Visual Studio, set to x64.因此,在 Visual Studio 中,设置为 x64。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM